示例#1
0
        /// <summary>添加一个好友
        ///     <remark>abu 2008-03-12 </remark>
        /// </summary>
        /// <param name="qq">The qq.</param>
        public void AddFriend(int qq)
        {
            AddFriendExPacket packet = new AddFriendExPacket(QQUser);

            packet.To = qq;
            QQClient.PacketManager.SendPacket(packet, QQPort.Main.Name, false);
        }
示例#2
0
        /// <summary>处理请求加一个好友的回复包
        ///     <remark>abu 2008-03-12 </remark>
        /// </summary>
        /// <param name="packet">The packet.</param>
        private void ProcessAddFriendExReply(AddFriendExReplyPacket inPacket, AddFriendExPacket outPacket)
        {
            QQEventArgs <AddFriendExReplyPacket, AddFriendExPacket> e = new QQEventArgs <AddFriendExReplyPacket, AddFriendExPacket>(client, inPacket, outPacket);

            if (inPacket.ReplyCode == ReplyCode.OK)
            {
                switch (inPacket.AuthCode)
                {
                case AuthType.No:
                    client.FriendManager.OnAddFriendSuccessed(e);
                    break;

                case AuthType.Need:
                    client.FriendManager.OnAddFriendNeedAuth(e);
                    break;

                case AuthType.Reject:
                    client.FriendManager.OnAddFriendDeny(e);
                    break;

                default:
                    break;
                }
            }
            else
            {
                if (inPacket.ReplyCode == ReplyCode.ADD_FRIEND_ALREADY)
                {
                    client.FriendManager.OnFriendAlready(e);
                }
                else
                {
                    client.FriendManager.OnAddFriendFailed(e);
                }
            }
        }