static void FriendManager_GetFriendListSuccessed(object sender, QQEventArgs <GetFriendListReplyPacket, GetFriendListPacket> e) { if (e.InPacket.Finished) { WL("共得到{0}位好友", e.QQClient.QQUser.Friends.Count); WL("开始读取在线好友"); e.QQClient.FriendManager.GetOnlineFriend(); int i = 0; List <int> list = new List <int>(); foreach (FriendInfo info in e.QQClient.QQUser.Friends.Values) { WL("第" + (i++).ToString() + "位好友:" + info.BasicInfo.Nick + "(" + info.BasicInfo.QQ.ToString() + ")"); //修改好友备注 FriendRemark remark = new FriendRemark(); remark.Name = "好友" + i.ToString(); e.QQClient.FriendManager.UploadFriendRemark(info.BasicInfo.QQ, remark); list.Add(info.BasicInfo.QQ); } //查询好友等级 e.QQClient.FriendManager.GetFriendLevel(list); //读取好友属性信息 e.QQClient.FriendManager.GetUserProperty(0); } else { WL("本次共得到{0}位好友", e.InPacket.Friends.Count); } }
/// <summary>上传好友备信息 /// Uploads the friend remark. /// </summary> /// <param name="qq">The qq.</param> /// <param name="remark">The remark.</param> public void UploadFriendRemark(int qq, FriendRemark remark) { FriendDataOpPacket packet = new FriendDataOpPacket(QQUser); packet.Remark = remark; packet.QQ = qq; QQClient.PacketManager.SendPacket(packet, QQPort.Main.Name); }
protected override void ParseBody(ByteBuffer buf) { //操作字节 SubCommand = (FriendOpSubCmd)buf.Get(); switch (SubCommand) { case FriendOpSubCmd.BATCH_DOWNLOAD_FRIEND_REMARK: HasRemark = buf.Get() == 0x0; Remarks = new Dictionary <uint, FriendRemark>(); while (buf.HasRemaining()) { uint qq = buf.GetUInt(); // 跳过一个未知字节0x0 buf.Get(); // 创建备注对象 FriendRemark r = new FriendRemark(); // 读入备注对象 r.Read(buf); // 加入到哈希表 Remarks.Add(qq, r); } break; case FriendOpSubCmd.UPLOAD_FRIEND_REMARK: break; case FriendOpSubCmd.REMOVE_FRIEND_FROM_LIST: ReplyCode = (ReplyCode)buf.Get(); break; case FriendOpSubCmd.DOWNLOAD_FRIEND_REMARK: if (buf.HasRemaining()) { // 读取操作对象的QQ号 QQ = buf.GetInt(); // 创建备注对象 Remark = new FriendRemark(); // 跳过一个未知字节0x0 buf.Get(); // 读入备注对象 Remark.Read(buf); HasRemark = true; } else { HasRemark = false; } break; default: break; } }
public FriendDataOpPacket(QQUser user) : base(QQCommand.Friend_Data_OP, true, user) { SubCommand = FriendOpSubCmd.UPLOAD_FRIEND_REMARK; Remark = new FriendRemark(); }
public FriendDataOpPacket(QQClient client) : base(QQCommand.Friend_Data_OP_05, true, client) { SubCommand = FriendOpSubCmd.UPLOAD_FRIEND_REMARK; Remark = new FriendRemark(); }