/// <summary>
 /// 处理得到群成员信息的回复包
 /// 2010/2/22 Veonax 修改
 /// 	<remark>abu 2008-02-22 </remark>
 /// </summary>
 /// <param name="buf">The buf.</param>
 private void ParseGetMemberInfoReply(ByteBuffer buf)
 {
     if (ReplyCode == ReplyCode.OK)
     {
         ClusterId = buf.GetUInt();
         // 成员信息
         MemberInfos = new List<QQFriend>();
         while (buf.HasRemaining())
         {
             QQFriend friend = new QQFriend();
             friend.ReadFromCluster(buf); // 从群成员信息GetClusterMemberInfo包中读取相关信息
             MemberInfos.Add(friend);
         }
     }
 }
Exemple #2
0
        internal void ProcessLoginGetListReply(LoginGetListReplyPacket loginGetListReplyPacket, LoginGetListPacket loginGetListPacket)
        {
            QQEventArgs<LoginGetListReplyPacket, LoginGetListPacket> e = new QQEventArgs<LoginGetListReplyPacket, LoginGetListPacket>(QQClient, loginGetListReplyPacket, loginGetListPacket);
            foreach (QQ.Entities.QQBasicInfo qq in loginGetListReplyPacket.QQList)
            {
                if(!QQClient.QQUser.QQList.ContainsKey(qq.QQ))
                QQClient.QQUser.QQList.Add(qq.QQ, qq);

            }
            StringBuilder sb = new StringBuilder();
            sb.AppendLine("本次得到QQ " + loginGetListReplyPacket.QQList.Count + " 个。");
            #if DEBUG
                foreach (QQ.Entities.QQBasicInfo qq in loginGetListReplyPacket.QQList)
            {
                    sb.AppendLine(string.Format("\t\tQQ:{0} type:{1}   group: {2} ", qq.QQ,qq.Type, qq.GroupId));

               }

            #endif
            QQClient.LogManager.Log(sb.ToString());
            //应该将QQ好友,QQ群存入存入QQuser对象
            if (!e.InPacket.Finished)//好友没有下载完,继续下载
            {
                //LoginGetList(e.InPacket.NextPos);

                LoginGetList(++lisPackets);
            }
            else //好友下载完毕 触发事件
            {
                QQClient.LogManager.Log("获取全部好友完成!");
                //分到各自的列表组
                foreach(QQBasicInfo qq in QQClient.QQUser.QQList.Values)
                {
                    switch(qq.Type)
                    {
                        case QQType.Cluster:
                            ClusterInfo ClusterInfo=new ClusterInfo();
                            ClusterInfo.QQBasicInfo=qq;
                            QQClient.QQUser.ClusterList.Add(qq.QQ,ClusterInfo);
                            break;
                        case QQType.QQ:
                            QQFriend QQFriend=new QQFriend();
                            QQFriend.QQBasicInfo=qq;
                            QQClient.QQUser.Friends.Add(qq.QQ,QQFriend);
                            break;
                        default:
                            QQClient.LogManager.Log("unknown QQ.Type: 0x"+qq.Type.ToString("X")+" qq="+qq.QQ.ToString() +" gid=0x"+qq.GroupId.ToString("X2"));
                            break;

                    }
                }
                OutPacket outPacket = new LoginSendInfoPacket(this.QQClient);
                QQClient.PacketManager.SendPacketAnyway(outPacket, QQPort.Main.Name);

            }
        }