捐赠 | 广告 | 注册 | 发布 | 上传 | 关于我们    
  沪ICP备05001939号 DELPHI盒子 | 盒子论坛 | 盒子文章 | 盒子问答悬赏 | 最新更新 | 论坛检索 | 下载中心 | 高级搜索    
  精品专区 | 繁體中文 | 奖励公告栏 | 直通车账号登陆 | 关闭GOOGLE广告 | 临时留言    
盒子资源分类
全部展开 - 全部合拢
使用Delphi模拟MSNP15协议登录过程
关键字:MSNP15协议 Delphi
来 自:原创
平 台:Win2k/XP/NT,Win2003 下载所需:0 火柴
深浅度:初级 完成时间:2009/5/26
发布者:oranje 发布时间:2009/5/26
编辑器:DELPHI7 语  种:简体中文
分 类:网络 下载浏览:1752/15909
加入到我的收藏
下载错误报错
登陆以后才能下载
 用户名:
 密 码:
自动登陆(30天有效)
图片如果打不开,说明流量不够了,请稍候下载……
MSN机器人不错,可惜是需要安装MSN客户端,以下是DELPHI开发模拟的MSNP15协议的登录过程,其中涉及到的msnssocprty.dll是验证Token的动态库(VS2005 C/C++),有需要的朋友可以联系我。NativeXml是DELPHI7的第三方控件,网上找找,很多的。

以下代码仅仅实现了登录过程,有兴趣的可以继续完善。

unit MSNP15;

{
使用MSNP15协议的MSN模拟客户端
author:sunnje@gmail.com
date:2009-03-07
通讯组件: INDY9 TIDTCPClient

主要事件:
     网络协议的回调 - 主要用于网络事件,例如断网、连接服务器状态等
     消息协议的回调 - 主要用于对话消息的回调处理 2009-03-07

协议和通讯:
     MSN协议发送和接收都是以<CRLF>(delphi表示为#13#10)为结尾符,
     如果采用INDY TIdTCPClient直接使用WriteLn和ReadLn来进行发送和接收工作

MSN 几个服务器的概念:
     DS:Dispatch Server 派遣服务器
       客户端最初连接的服务器。负责给客户端分配合适的通知服务器。
       域名是messenger.hotmail.com,标准服务端口是1863。
       完成派遣任务后,切断TCP连接

       
     NS:Notification Server 通知服务器
       客户端需要一直保持连接的服务器。很多任务要在这个会话内完成,
       包括登录、改变状态、获取用户列表、修改用户信息、发起聊天、接受呼叫、邮件通知、退出等等。
       服务端口由派遣服务器指定,通常也是1863

       
     SS:Switchboard Server 接线服务器
       客户端之间聊天使用的中转服务器。
       每开一个聊天窗口,客户端和服务器就建立一个TCP会话。
       当客户端之间需要进行文件传输或语音聊天时,发送系统消息,
       建 立"点对点"会话通道(可能转为使用UDP)。
       服务端口通常也是1863。
       "点对点" 通信使用的端口由客户端自动协商决定,如文件传输通常使用6891端口。

协议说明:http://msnpiki.msnfanatic.com/index.php/MSNP8:Authentication
协议命令说明:http://msnpiki.msnfanatic.com/index.php/Reference:Commands   
协议流程:MSNP15
    --> VER 1 MSNP15 MSNP14 MSNP13 CVR0    //向DS服务器发送协议比对请求
    <-- VER 1 MSNP15          //支持MSNP15协议

    --> CVR 2 0x0804 winnt 6.0 i386 MSNMSGR 8.1.0178 msmsgs homki@hotmail.com //发出客户端的OS、语言、MSN Messenger版本等信息
    <-- CVR 2 8.1.0178 8.1.0178 8.1.0178 http://msgruser.dlservice.microsoft.com/download/B/D/3/BD343317-2DBF-48FE-8BD9-9E3212D65E6A/Install_Messenger.exe http://download.live.com/?sku=messenger
    
    --> USR 3 SSO I homki@hotmail.com          //单点登录
    <-- XFR 3 NS 207.46.110.38:1863 U D    //服务器返回NS服务器地址,并重新登录

    Repeat:

    <-- GCF 0 6601          //告诉后面需要接收长协议内容 6601是后面的长度,这里表示安全策略的XML内容
          //http://msnpiki.msnfanatic.com/index.php/Command:GCF

}

interface


uses
Windows, Messages, Classes, SysUtils, ActiveX,
IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,
IdHTTP, MSXML, Variants, NativeXml;

CONST
//网络事件常量
nc_ConnErr = 0 ;          //连接服务器失败
nc_ConnOK = 1 ;          //连接服务器成功,可以不用处理该事件
//----------

Type
TNetCallBack = procedure (netcode:integer);   //网络事件回调原型
TMsgCallBack = procedure (msg:PChar);         //消息事件回调原型

//TCP监听数据线程
TClientThread = class(TThread)
private
    IdTCP:TIdTCPClient;
    Protocol:String;          //协议内容
protected
    procedure Execute; override;
public
    constructor Create(pIdTCP:TIdTCPClient);
    Destructor Destroy();override;
    procedure GetBinarySecurityToken;
end; 

TMyMSN15Client = class
private
    FIdTCP : TIdTCPClient;
    ClientThread : TClientThread;          //TIDTCP监听线程
    FProtocolNum : integer;          //发送协议中带的每条协议的唯一字符

public
    FUsername : String;          //登录用户名
    FPassword : String;          //登录密码
    FConnectTimeout:integer;          //连接超时时间限制 默认8000=8秒

    FBinarySecurityToken:String;
    FBinarySecret:String;
    FGivenPolicy:STring;
    FNonce:string;

    
    FNetCallBack : TNetCallBack;
    FMsgCallBack : TMsgCallBack;

      
    Constructor Create();
    Destructor Destroy();override;

    function GetAProtocolNum:String;

    procedure SendMsg(Str:String);
    procedure StLogin(ServerIP:String;ServerPort:integer);


published

end;

//初始化对象,并初始化socket
procedure MSN15Init;stdcall;
procedure MSN15Free;stdcall;

function GetSSOKey(key:PChar;challenge:PChar):PChar;stdcall external 'msnssocprty.dll' name '?GetSSOKey@@YGPADPAD0@Z';


var
_MyMSN15Client : TMyMSN15Client;
SSOXML : string;


implementation


//----------
//一些通用的函数
type
CharSet = Set of char;

function UTF8ToAnsi(x: string): ansistring;
var
i: integer;
b1, b2: byte;
begin
Result := x;
i := 1;
while i <= Length(Result) do begin
    if (ord(Result[i]) and $80) <> 0 then begin
      b1 := ord(Result[i]);
      b2 := ord(Result[i + 1]);
      if (b1 and $F0) <> $C0 then
        Result[i] := #128
      else begin
        Result[i] := Chr((b1 shl 6) or (b2 and $3F));
      Delete(Result, i + 1, 1);
      end;
    end;
    inc(i);
end;
end;


function AnsiToUtf8(x: ansistring): string;
var
i: integer;
b1, b2: byte;
begin
Result := x;
for i := Length(Result) downto 1 do
    if Result[i] >= #127 then begin
      b1 := $C0 or (ord(Result[i]) shr 6);
      b2 := $80 or (ord(Result[i]) and $3F);
      Result[i] := chr(b1);
      Insert(chr(b2), Result, i + 1);
    end;
end;


Function ExtractWord(N:Integer;S:String;WordDelims:CharSet):String;
Var
I,J:Word;
Count:Integer;
SLen:Integer;
Begin
Count := 0;
I := 1;
Result := '';
SLen := Length(S);
While I <= SLen Do Begin
    While (I <= SLen) And (S[I] In WordDelims) Do Inc(I);
    If I <= SLen Then Inc(Count);
      J := I;
    While (J <= SLen) And Not(S[J] In WordDelims) Do Inc(J);
    If Count = N Then Begin
      Result := Copy(S,I,J-I);
      Exit
    End;
    I := J;
End;
End;

function WordAt(const Text : string; Position : Integer) : string;
begin
Result := ExtractWord(Position, Text, [' ']);
end;

//----------


procedure MSN15Init;stdcall;
begin
if _MyMSN15Client = nil then
    _MyMSN15Client := TMyMSN15Client.Create;

SSOXML := '<?xml version="1.0" encoding="UTF-8" ?>';
SSOXML := SSOXML + '<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsse="http://schemas.xmlsoap.org/ws/2003/06/secext" ';
SSOXML := SSOXML + 'xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:wsp="http://schemas.xmlsoap.org/ws/2002/12/policy" ';
SSOXML := SSOXML + 'xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing" xmlns:wssc="http://schemas.xmlsoap.org/ws/2004/04/sc" ';
SSOXML := SSOXML + 'xmlns:wst="http://schemas.xmlsoap.org/ws/2004/04/trust">';
SSOXML := SSOXML + '<Header>';
SSOXML := SSOXML + '<ps:AuthInfo xmlns:ps="http://schemas.microsoft.com/Passport/SoapServices/PPCRL" Id="PPAuthInfo">';
SSOXML := SSOXML + ' <ps:HostingApp>{7108E71A-9926-4FCB-BCC9-9A9D3F32E423}</ps:HostingApp>';
SSOXML := SSOXML + ' <ps:BinaryVersion>4</ps:BinaryVersion>';
SSOXML := SSOXML + ' <ps:UIVersion>1</ps:UIVersion>';
SSOXML := SSOXML + ' <ps:Cookies />';
SSOXML := SSOXML + ' <ps:RequestParams>AQAAAAIAAABsYwQAAAAyMDUy</ps:RequestParams>';
SSOXML := SSOXML + ' </ps:AuthInfo>';
SSOXML := SSOXML + '<wsse:Security>';
SSOXML := SSOXML + '<wsse:UsernameToken Id="user">';
SSOXML := SSOXML + ' <wsse:Username>%USERNAME%</wsse:Username>';
SSOXML := SSOXML + ' <wsse:Password>%PASSWORD%</wsse:Password>';
SSOXML := SSOXML + ' </wsse:UsernameToken>';
SSOXML := SSOXML + ' </wsse:Security>';
SSOXML := SSOXML + ' </Header>';
SSOXML := SSOXML + '<Body>';
SSOXML := SSOXML + '<ps:RequestMultipleSecurityTokens xmlns:ps="http://schemas.microsoft.com/Passport/SoapServices/PPCRL" Id="RSTS">';
SSOXML := SSOXML + '<wst:RequestSecurityToken Id="RST0">';
SSOXML := SSOXML + ' <wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>';
SSOXML := SSOXML + '<wsp:AppliesTo>';
SSOXML := SSOXML + '<wsa:EndpointReference>';
SSOXML := SSOXML + ' <wsa:Address>http://Passport.NET/tb</wsa:Address>';
SSOXML := SSOXML + ' </wsa:EndpointReference>';
SSOXML := SSOXML + ' </wsp:AppliesTo>';
SSOXML := SSOXML + ' </wst:RequestSecurityToken>';
SSOXML := SSOXML + '<wst:RequestSecurityToken Id="RST1">';
SSOXML := SSOXML + ' <wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>';
SSOXML := SSOXML + '<wsp:AppliesTo>';
SSOXML := SSOXML + '<wsa:EndpointReference>';
SSOXML := SSOXML + ' <wsa:Address>messengerclear.live.com</wsa:Address>';
SSOXML := SSOXML + ' </wsa:EndpointReference>';
SSOXML := SSOXML + ' </wsp:AppliesTo>';
SSOXML := SSOXML + ' <wsse:PolicyReference URI="MBI_KEY_OLD" />';
SSOXML := SSOXML + ' </wst:RequestSecurityToken>';
SSOXML := SSOXML + '<wst:RequestSecurityToken Id="RST2">';
SSOXML := SSOXML + ' <wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>';
SSOXML := SSOXML + '<wsp:AppliesTo>';
SSOXML := SSOXML + '<wsa:EndpointReference>';
SSOXML := SSOXML + ' <wsa:Address>messenger.msn.com</wsa:Address>';
SSOXML := SSOXML + ' </wsa:EndpointReference>';
SSOXML := SSOXML + ' </wsp:AppliesTo>';
SSOXML := SSOXML + ' <wsse:PolicyReference URI="?id=507" />';
SSOXML := SSOXML + ' </wst:RequestSecurityToken>';
SSOXML := SSOXML + '<wst:RequestSecurityToken Id="RST3">';
SSOXML := SSOXML + ' <wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>';
SSOXML := SSOXML + '<wsp:AppliesTo>';
SSOXML := SSOXML + '<wsa:EndpointReference>';
SSOXML := SSOXML + ' <wsa:Address>contacts.msn.com</wsa:Address>';
SSOXML := SSOXML + ' </wsa:EndpointReference>';
SSOXML := SSOXML + ' </wsp:AppliesTo>';
SSOXML := SSOXML + ' <wsse:PolicyReference URI="MBI" />';
SSOXML := SSOXML + ' </wst:RequestSecurityToken>';
SSOXML := SSOXML + '<wst:RequestSecurityToken Id="RST4">';
SSOXML := SSOXML + ' <wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>';
SSOXML := SSOXML + '<wsp:AppliesTo>';
SSOXML := SSOXML + '<wsa:EndpointReference>';
SSOXML := SSOXML + ' <wsa:Address>messengersecure.live.com</wsa:Address>';
SSOXML := SSOXML + ' </wsa:EndpointReference>';
SSOXML := SSOXML + ' </wsp:AppliesTo>';
SSOXML := SSOXML + ' <wsse:PolicyReference URI="MBI_SSL" />';
SSOXML := SSOXML + ' </wst:RequestSecurityToken>';
SSOXML := SSOXML + '<wst:RequestSecurityToken Id="RST5">';
SSOXML := SSOXML + ' <wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>';
SSOXML := SSOXML + '<wsp:AppliesTo>';
SSOXML := SSOXML + '<wsa:EndpointReference>';
SSOXML := SSOXML + ' <wsa:Address>spaces.live.com</wsa:Address>';
SSOXML := SSOXML + ' </wsa:EndpointReference>';
SSOXML := SSOXML + ' </wsp:AppliesTo>';
SSOXML := SSOXML + ' <wsse:PolicyReference URI="MBI" />';
SSOXML := SSOXML + ' </wst:RequestSecurityToken>';
SSOXML := SSOXML + '<wst:RequestSecurityToken Id="RST6">';
SSOXML := SSOXML + ' <wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>';
SSOXML := SSOXML + '<wsp:AppliesTo>';
SSOXML := SSOXML + '<wsa:EndpointReference>';
SSOXML := SSOXML + ' <wsa:Address>storage.msn.com</wsa:Address>';
SSOXML := SSOXML + ' </wsa:EndpointReference>';
SSOXML := SSOXML + ' </wsp:AppliesTo>';
SSOXML := SSOXML + ' <wsse:PolicyReference URI="MBI" />';
SSOXML := SSOXML + ' </wst:RequestSecurityToken>';
SSOXML := SSOXML + ' </ps:RequestMultipleSecurityTokens>';
SSOXML := SSOXML + ' </Body>';
SSOXML := SSOXML + ' </Envelope>';
end;


procedure MSN15Free;stdcall;
begin
if _MyMSN15Client <> nil then
    FreeAndNil(_MyMSN15Client);
end;

{ TMyMSN15Client }

constructor TMyMSN15Client.Create;
begin
FIdTCP := TIdTCPClient.Create(nil);
FConnectTimeout := 8000;
FUsername := '';
FPassword := '';

FProtocolNum := 0;
end;

destructor TMyMSN15Client.Destroy;
begin
if ClientThread <> nil then begin
    ClientThread.Terminate;
    ClientThread := nil;
end;


if FIdTCP.Connected then
    FIdTCP.Disconnect;
FreeAndNil(FIdTCP);
inherited;
end;

{**********
获取一个唯一的每条协议的字符表示
}
function TMyMSN15Client.GetAProtocolNum: String;
begin
Inc(FProtocolNum);
result := IntToStr(FProtocolNum);
end;


{**********
发送协议,Str:协议内容
}

procedure TMyMSN15Client.SendMsg(Str: String);
begin
FIdTCP.WriteLn(Str);
end;


{**********
开始登录MSN服务器
}
procedure TMyMSN15Client.StLogin(ServerIP:String;ServerPort:integer);
var
catalog:String;   //协议类别
Protocol:String;

begin

if FIdTCP.Connected then FIdTCP.Disconnect;
FIdTCP.Host := ServerIP;//'messenger.hotmail.com';          //MSN登录服务器地址
FIdTCP.Port := ServerPort;//1863;
    
try
    FIdTCP.Connect(FConnectTimeout);
    FNetCallBack(nc_ConnOK);
except
    //连接服务器失败
    FNetCallBack(nc_ConnErr);
    Exit;
end;
//创建监听线程
if ClientThread = nil then
    ClientThread := TClientThread.Create(FIdTCP);

SendMsg('VER '+ GetAProtocolNum + ' MSNP15 CVR0');


end;

{ TClientThread }

constructor TClientThread.Create(pIdTCP:TIdTCPClient);
begin
inherited Create(false);
IdTCP := pIdTCP;
FreeOnTerminate := True;
IdTCP.MaxLineLength := 65535;
end;

destructor TClientThread.Destroy;
begin

inherited;
end;

procedure TClientThread.GetBinarySecurityToken;
var
http:IXMLHTTPRequest;
SSOXML,sp:string;
XML:TNativeXML;
XMLRoot,XMLFind:TXMLNode;
begin
_MyMSN15Client.FBinarySecurityToken := '';

http:=CoXMLHTTPREQUEST.Create;
XML := TNativeXML.Create;
try
    http.open('POST','https://login.live.com/RST.srf',false, EmptyParam, EmptyParam);
    http.SetRequestHeader('Content-Type','application/soap+xml\r\n');
    http.SetRequestHeader('Content-Length', IntToStr(Length(SSOXML))+'\r\n');
    http.send(SSOXML);
    sp := http.responseText;
    _MyMSN15Client.FMsgCallBack(PChar(sp));
    try
      XML.ReadFromString(sp);
      XMLRoot := XML.Root;
    except
    end;
      XMLFind := XMLRoot.FindNode('wsse:BinarySecurityToken');
      if XMLFind <> nil then
        _MyMSN15Client.FBinarySecurityToken := XMLFind.ValueAsString;
finally
    XML.Free;
    http := nil;
end;
_MyMSN15Client.FMsgCallBack(PChar('t='+_MyMSN15Client.FBinarySecurityToken));
end;

procedure TClientThread.Execute;
var
catalog,SK:String;   //协议类别
TMP:String;       //获取协议中的内容的临时
ReadLength,ORlen:integer;
tmpBuf   : array of Byte;

sp,sp1:string;
http:IXMLHTTPRequest;
XML:TNativeXML;
XMLRoot,XMLFind,XMLFir,XMLFind2:TXMLNode;
NodeList:TList;
NeedCoInitialize : boolean;
i:integer;
begin
while not Terminated do begin
    if Not IdTCP.Connected then begin
      Terminate;
    end;
    try
      Protocol := '';
      Protocol := IdTCP.ReadLn;
    except
      Terminate;
    end;

    catalog := UpperCase(Copy(Protocol,1,3));
    if catalog ='' then continue;

    if catalog = 'VER' then
      IdTCP.WriteLn('CVR '+_MyMSN15Client.GetAProtocolNum+' 0x0804 winnt 6.0 i386 MSNMSGR 8.1.0178 msmsgs '+_MyMSN15Client.FUsername);

    if catalog = 'CVR' then
      IdTCP.WriteLn('USR '+_MyMSN15Client.GetAProtocolNum+' SSO I '+_MyMSN15Client.FUsername);

    //XFR协议,服务器返回需要登录到NS   XFR 3 NS 207.46.110.38:1863 U D
    if catalog = 'XFR' then begin
      TMP := WordAt(Protocol, 4);     //207.46.110.38:1863
      if IdTCP.Connected then IdTCP.Disconnect;
      _MyMSN15Client.StLogin(Copy(TMP,1,Pos(':',TMP)-1),StrToInt(Copy(TMP,Pos(':',TMP)+1,Length(TMP))));
    end;


    //USR trid TWN S auth_string
    //USR 6 SSO S MBI_KEY_OLD H6YRMGfYgZRiJeAs5dF9Vh1DOtgdI2bURt48g3MI6sqgSV7zgOB6kVeC2qun43C/
    if catalog = 'USR' then begin
      TMP := UpperCase(WordAt(Protocol, 3));

      if TMP = 'OK' then begin


      
      end else if TMP = 'SSO' then begin

        TMP := WordAt(Protocol, 6);
        //_MyMSN15Client.FMsgCallBack(PChar('Ticket='+Protocol));
        _MyMSN15Client.FNonce := TMP;
        //开始进行POST HTTPS验证信息
        _MyMSN15Client.FBinarySecurityToken := '';
        _MyMSN15Client.FBinarySecret := '';
      
        NeedCoInitialize := Succeeded(CoInitialize(nil));
        http:=CoXMLHTTPREQUEST.Create;
        XML := TNativeXML.Create;
        NodeList := TList.Create;
        try
          sp := StringReplace(SSOXML,'%USERNAME%',_MyMSN15Client.FUsername,[rfReplaceAll]);
          sp := StringReplace(sp,'%PASSWORD%',_MyMSN15Client.FPassword,[rfReplaceAll]);
          sp1:= '';
          http.open('POST','https://login.live.com/RST.srf',false, EmptyParam, EmptyParam);
          http.SetRequestHeader('Content-Type','application/soap+xml');
          http.SetRequestHeader('Content-Length', IntToStr(Length(SSOXML)));
          try
          http.send(sp);
          sp1 := http.responseText;
          if sp1<>'' then begin
          XML.ReadFromString(sp1);
          XMLRoot := XML.Root;

          NodeList.Clear;
          XMLRoot.FindNodes('wst:RequestSecurityTokenResponse',NodeList);
          For i:=0 to NodeList.Count - 1 do begin
          XMLFir := TXMLNode(NodeList.Items[i]);
          XMLFind := XMLFir.FindNode('wsa:Address');
          if XMLFind = nil then Continue;
          if LowerCase(XMLFind.ValueAsString) <> 'messengerclear.live.com' then Continue;
          XMLFind := XMLFir.FindNode('wsse:BinarySecurityToken');
          XMLFind2 := XMLFir.FindNode('wst:BinarySecret');
          if (XMLFind = nil) or (XMLFind2 = nil) then Continue;
          _MyMSN15Client.FBinarySecurityToken := XMLFind.ValueAsString;
          _MyMSN15CLient.FBinarySecret := XMLFind2.ValueAsString;
          Break;
          end;
          end;
          except
          end;

        finally
          NodeList.Free;
          XML.Free;
          http := nil;
          if NeedCoInitialize then CoUninitialize;
        end;
        if (_MyMSN15Client.FBinarySecurityToken = '') or (_MyMSN15CLient.FBinarySecret = '') then begin
          _MyMSN15Client.FMsgCallBack('authfailed');
          if _MyMSN15Client.FIdTCP.Connected then _MyMSN15Client.FIdTCP.Disconnect;
          Terminate;
        end;
        _MyMSN15Client.FMsgCallBack(PChar('toket='+_MyMSN15Client.FBinarySecurityToken));
        _MyMSN15Client.FMsgCallBack(PChar('Nonce='+_MyMSN15Client.FNonce));
        SK := GetSSOKey(PChar(_MyMSN15CLient.FBinarySecret),PChar(_MyMSN15Client.FNonce));
        IdTCP.WriteLn('USR '+_MyMSN15Client.GetAProtocolNum+' SSO S '+_MyMSN15Client.FBinarySecurityToken + ' ' + SK);

        
      end;
    end;

    if catalog = 'GCF' then begin
      ReadLength := StrToInt(WordAt(Protocol, 3));
      _MyMSN15Client.FGivenPolicy := IdTCP.ReadString(ReadLength);
    end;


end;
end;


end.


----------

调用方法:

1、初始化

procedure ncb(netcode:integer);
begin

end;

procedure msgcb(msg:pchar);
begin
if msg <> nil then
frmMain.Memo1.Lines.Add('['+formatDateTime('yyyy-mm-dd hh:mm:ss',Now)+'] ' +msg)
end;

MSN15Init;
_MyMSN15Client.FNetCallBack := ncb;
_MyMSN15Client.FMsgCallBack := msgcb;


2、登录

_MyMSN15Client.FUsername := '你的MSN用户名';
_MyMSN15Client.FPassword := '你的MSN密码';
_MyMSN15Client.StLogin('messenger.hotmail.com',1863);

3、注销

MSN15Free;
Google
 
本站原创作品,未经作者许可,严禁任何方式转载;转载作品,如果侵犯了您的权益,请联系我们
龙脉加密锁 15元起 Grid++Report 报表 申请支付@网
 相关文章
没有相关文章
相关评论
共有评论8条 当前显示最后6条评论
oranje 2009/6/3 23:59:05
怎么不让上传源代码呢?还准备长期开源更新的
oranje 2009/6/4 9:20:11
源代码下载  http://code.google.com/p/dmsn/
hikaru 2009/6/5 15:17:38
希望oranje写点淘宝旺旺的机器人思路代码
wewaa 2009/10/17 11:29:25
咋不能下载?
skaly 2010/11/11 16:03:49
有人下载过这个东东(http://code.google.com/p/dmsn/)吗?
现在下载不了啦
windy106 2011/5/26 9:07:55
The requested URL /p/dmsn/ was not found on this server.
我要发表评论 查看全部评论
 
  DELPHI盒子版权所有 1999-2023 V4.01 粤ICP备10103342号-1 更新RSS列表