0

该片段来自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;
                }
            }
        }

    }
4

1 回答 1

0

似乎他们又一次将老客户拒之门外。Microsoft 有时会这样做,以使第三方客户端无法使用。他们处理协议异常的标准方法是立即断开连接。

于 2010-09-27T06:36:29.140 回答