是否支持MSNP9?

时间:2010-09-27 03:47:02

标签: php msn

该代码段来自importMsnm.class.php$data = $this->_get();在第二次循环时返回false,之前有效:

VER 1 MSNP9 CVR0
VER 1 CVR0
CVR 1 0x0409 win 4.10 i386 MSNMSGR 7.0.0816 MSMSGS username@hotmail.com
connection is lost


function connect($passport, $password)
    {
        $this->trID = 1;

        if (!$this->fp = @fsockopen($this->server, $this->port, $errno, $errstr, 2)) {    
            //die("Could not connect to messenger service");
            return array();
        } else {
            stream_set_timeout($this->fp, 2);
            $this->_put("VER $this->trID MSNP9 CVR0\r\n");
            while (! feof($this->fp)) 
            {
                $data = $this->_get();
                switch ($code = substr($data, 0, 3))
                {
                    default:
                        //echo $this->_get_error($code);
                        return false;
                    break;
                    case 'VER':
                        $this->_put("CVR $this->trID 0x0409 win 4.10 i386 MSNMSGR 7.0.0816 MSMSGS $passport\r\n");
                    break;
                    case 'CVR':
                        $this->_put("USR $this->trID TWN I $passport\r\n");
                    break;
                    case 'XFR':
                        list(, , , $ip)  = explode (' ', $data);
                        list($ip, $port) = explode (':', $ip);

                        if ($this->fp = @fsockopen($ip, $port, $errno, $errstr, 2))
                        {
                            $this->trID = 1;

                            $this->_put("VER $this->trID MSNP9 CVR0\r\n");
                        }
                        else
                        {
                            if (! empty($this->debug)) echo 'Unable to connect to msn server (transfer)';

                            return false;
                        }
                    break;
                    case 'USR':
                        if (isset($this->authed))
                        {
                            return true;
                        }
                        else
                        {
                            $this->passport = $passport;
                            $this->password = urlencode($password);

                            list(,,,, $code) = explode(' ', trim($data));

                            if ($auth = $this->_ssl_auth($code))
                            {
                                $this->_put("USR $this->trID TWN S $auth\r\n");

                                $this->authed = 1;
                            }
                            else
                            {
                                if (! empty($this->debug)) echo 'auth failed';

                                return false;
                            }
                        }
                    break;
                }
            }
        }

    }

1 个答案:

答案 0 :(得分:0)

似乎他们再次锁定了老客户。微软偶尔会这样做,以使第三方客户无法使用。他们处理协议异常的标准方法是立即拆除连接。