朋友网关于QQ相关的PHP代码(研究QQ的绝佳资料)(6)

function replyAdd($uin,$type,$msg)
    {
        //回应添加好友
        //VER=1.1&CMD=Ack_AddToList&SEQ=&UIN=&UN=&CD=&RS=
        //CD为响应状态,CD为0表示“通过验证”。CD为1表示“拒决加为对方为好友”。CD为2表示“为请求对方加为好友”。RS为你要请求的理由
        $str = "VER=1.2&CMD=Ack_AddToList&SEQ=".rand(1000,9000)."&UIN=".$this->uin."&UN=".$uin."&CD=".$type."&RS=".$this->gb2312_to_utf8($msg);
        $return = $this->encode($this->query($str));
       
        if($return['RES']==0 and $return['UIN'] == $this->uin)
        {
            //服务器成功得到信息
            return QQ_RETURN_SUCCESS;
        }
        else
        {
            //失败
            return QQ_RETURN_FAILED;           
        }
    }

function delFriend($uin)
    {
        //删除好友
        //VER=1.1&CMD=DelFromList&SEQ=&UIN=&UN=
        $str = "VER=1.1&CMD=DelFromList&SEQ=".rand(1000,9000)."&UIN=".$this->uin."&UN=$uin";
        $return = $this->encode($this->query($str));
        if($return['RES']==0 and $return['UIN'] == $this->uin)
        {
            //服务器成功得到信息
            return QQ_RETURN_SUCCESS;
        }
        else
        {
            //失败
            return QQ_RETURN_FAILED;
        }
    }

function changeStatus($status)
    {
        //改变状态
        //VER=1.1&CMD=Change_Stat&SEQ=&UIN=&ST=
        //ST为要改变的状态,10为上线,20为离线,30为忙碌。
        $str = "VER=1.1&CMD=Change_stat&SEQ=".rand(1000,9000)."&UIN=".$this->uin."&ST=".$status;
        $return = $this->encode($this->query($str));
        if($return['RES']==0 and $return['UIN'] == $this->uin)
        {
            //服务器成功得到信息
            return QQ_RETURN_SUCCESS;
        }
        else
        {
            //失败
            return QQ_RETURN_FAILED;
        }
    }

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/e7cf048b808aaaaf76e4422e219f844a.html