forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Connecting to MSN Messenger Service (version 2)
Goto page 1, 2  Next
 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript Open Source Projects
View previous topic :: View next topic  
Author Message
Tommy
Admin Team


Joined: 16 Nov 2002
Posts: 746
Location: The Netherlands

PostPosted: Wed May 08, 2002 12:38 pm    Post subject: Connecting to MSN Messenger Service (version 2) Reply with quote

The following script should be capable of connecting to the MSN Messenger Service and retrieve a list of users which are currently online. Additional functionality hasn't been implemented yet, but it should be very well possible to make a basic MSN client out of this. I expect this script to work using VDS 3 just as well.

Thanks to Sjoerd van der Hoorn for the idea! He mentioned the following useful URL to me:

http://www.venkydude.com/articles/msn.htm


Code:

  title MSN
  directory change,@path(%0)
  %%server = "64.4.13.58:1863"
  %%email = ""
  %%password = ""

  option decimalsep,.
  external vdsmd5.dll
  external vdsinet.dll,Public Freeware Key|90257236
  external vdsrun.dll
  %x = @rundll(load,net2,vdsinet2.dll,Public Freeware Key|90257236)
  DIALOG CREATE,MSN,-1,0,458,320
  DIALOG ADD,EDIT,EDIT1,8,8,224,24,EDIT1
  DIALOG ADD,EDIT,EDIT2,40,8,224,24,EDIT2
  DIALOG ADD,EDIT,EDIT3,72,8,224,24,EDIT3
  DIALOG ADD,EDIT,EDIT4,104,8,224,24,EDIT4
  DIALOG ADD,EDIT,EDIT5,136,8,224,24,EDIT5
  DIALOG ADD,BUTTON,BUTTON1,272,8,64,24,BUTTON1
  DIALOG ADD,BUTTON,BUTTON2,272,168,64,24,BUTTON2
  DIALOG ADD,LIST,lMessage,168,8,224,96
  DIALOG ADD,LIST,lContacts,8,240,208,288,,DBLCLICK
  DIALOG ADD,STATUS,sStatus
  DIALOG SHOW

  %%errorlist = 1
  list create,%%errorlist
  list loadtext,%%errorlist
"ERR_SYNTAX_ERROR|200
"ERR_INVALID_PARAMETER|201
"ERR_INVALID_USER|205
"ERR_FQDN_MISSING|206
"ERR_ALREADY_LOGIN|207
"ERR_INVALID_USERNAME|208
"ERR_INVALID_FRIENDLY_NAME|209
"ERR_LIST_FULL|210
"ERR_ALREADY_THERE|215
"ERR_NOT_ON_LIST|216
"ERR_ALREADY_IN_THE_MODE|218
"ERR_ALREADY_IN_OPPOSITE_LIST|219
"ERR_SWITCHBOARD_FAILED|280
"ERR_NOTIFY_XFR_FAILED|281
"ERR_REQUIRED_FIELDS_MISSING|300
"ERR_NOT_LOGGED_IN|302
"ERR_INTERNAL_SERVER|500
"ERR_DB_SERVER|501
"ERR_FILE_OPERATION|510
"ERR_MEMORY_ALLOC|520
"ERR_SERVER_BUSY|600
"ERR_SERVER_UNAVAILABLE|601
"ERR_PEER_NS_DOWN|602
"ERR_DB_CONNECT|603
"ERR_SERVER_GOING_DOWN|604
"ERR_CREATE_CONNECTION|707
"ERR_BLOCKING_WRITE|711
"ERR_SESSION_OVERLOAD|712
"ERR_USER_TOO_ACTIVE|713
"ERR_TOO_MANY_SESSIONS|714
"ERR_NOT_EXPECTED|715
"ERR_BAD_FRIEND_FILE|717
"ERR_AUTHENTICATION_FAILED|911
"ERR_NOT_ALLOWED_WHEN_OFFLINE|913
"ERR_NOT_ACCEPTING_NEW_USERS|920
  %%messagelist = 2
  list create,%%messagelist
  %%mimelist1 = 3
  list create,%%mimelist1
  %%mimelist2 = 4
  list create,%%mimelist2

  NET SOCKET,AUTO,
  NET SOCKET,VDSEVENTS,
  rundll net2,socket,auto,
  rundll net2,socket,vdsevents,
  %T = 0
  %%buffer =
  %%buffer2 =
  %%firstmessage =
  %%msgcount =
  %%init =
  gosub initiate
:evloop
  option fieldsep,|
  %e = @event(D)
  parse "%e;%w",%e
  if %e
    if @equal(%e,CLOSE)
      goto %e%w
    else
      goto %e
    end
  end
  %e = @net(socket,event)
  if %e
    goto %e
  end
  %e = @rundll(net2,socket,event)
  if %e
    goto %e"2"
  end
  wait 0.1
  goto evloop
:lContactsdblclick
  if @item(lContacts)
    %%item = @item(lContacts)
    option fieldsep,|
    parse "%%status;%%useremail;%%usernickname",%%item
    net socket,sendserver,XFR %T SB@cr()@chr(10)
  end
  goto evloop
:connect
  NET SOCKET,SENDSERVER,VER %T MSNP7 MSNP6 MSNP5 MSNP4 CVRO@cr()@chr(10)
  goto evloop
:connect2
  if %%init
    rundll net2,socket,sendserver,USR %%T2 %%email %%hash@cr()@chr(10)
  else
    dialog set,EDIT5,%%T2|%%email|%%hash|%%session
    rundll net2,socket,sendserver,ANS %%T2 %%email %%hash %%session@cr()@chr(10)
  end
  goto evloop
:network
  if %%dialog
    dialog select,0
  end
  %%buffer = %%buffer@net(socket,data)
  if @not(@zero(@pos(@cr()@chr(10),%%buffer)))
    repeat
      %%pos = @pos(@cr()@chr(10),%%buffer)
      if @greater(%%pos,1)
        %%data = @substr(%%buffer,1,@pred(%%pos))
        %%buffer = @strdel(%%buffer,1,@succ(%%pos))
      else
        %%data =
        %%buffer = @strdel(%%buffer,1,@succ(%%pos))
      end
      %%char = " "
      %%beforesplit = %%data

      gosub split
      %%servercommand = %%command
      dialog set,EDIT1,%%servercommand

      if @equal(%%servercommand,MSG)
        %%msg = 1
        %%message =
      else
        if %%msg
          if %%beforesplit
            %%message = %%message%%beforesplit@cr()
          else
            %%msg =
            dialog set,lMessage,%%message
            if %%firstmessage
              NET SOCKET,SENDSERVER,CHG %T NLN@cr()@chr(10)
              dialog set,sStatus,@net(cgi,convert,%%nickname): online
              %%firstmessage =
            end
          end
        else
          %%data = %%params
          gosub split
          if @equal(%%servercommand,RNG)
            %%session = %%command
          else
            if @numeric(%%command)
              %T = @succ(%%command)
              dialog set,EDIT2,%T
            end
          end
   
          if @equal(%%servercommand,VER)
            NET SOCKET,SENDSERVER,INF %T@cr()@chr(10)
          else
            if @equal(%%servercommand,INF)
              %%kind = %%params
              dialog set,EDIT5,%%kind
              NET SOCKET,SENDSERVER,USR %T MD5 I %%email@cr()@chr(10)
            else
              if @equal(%%servercommand,XFR)
                %%data = %%params
                gosub split
                %%kind = %%command
   
                %%data = %%params
                gosub split
                %%server = %%command
   
                dialog set,EDIT5,%%server
   
                if @equal(%%kind,NS)
                  %%extra = %%params
                  net socket,close
                  gosub initiate
                else
                  if @equal(%%kind,SB)
                    %%data = %%params
                    gosub split
                    %%kind2 = %%command
                    %%hash = %%params

                    %%T2 = 1
                    option fieldsep,:
                    parse "%%newip;%%newport",%%server
                    rundll net2,socket,addr,%%newip
                    rundll net2,socket,port,%%newport
                    rundll net2,socket,client
                    %%init = 1
                  end
                end
              else
                if @equal(%%servercommand,USR)
                  %%data = %%params
                  gosub split
                  %%kind = %%command
   
                  %%data = %%params
                  gosub split
                  %%extra = %%command
   
                  if @equal(%%kind,MD5)
                    %%hash = %%params
   
                    dialog set,EDIT5,%%extra
                    NET SOCKET,SENDSERVER,USR %T MD5 S @md5(string,%%hash%%password)@cr()@chr(10)
                  else
                    if @equal(%%kind,OK)
                      %%data = %%params
                      gosub split
                      %%nickname = @net(cgi,convert,%%command)
 
                      %%extra2 = %%params
                      dialog set,EDIT5,%%extra|%%extra2
 
                      dialog set,sStatus,%%nickname
                      %%firstmessage = 1
                    end
                  end
                else
                  if @equal(%%servercommand,ILN)
                    %%data = %%params
                    gosub split
                    %%status = %%command
 
                    %%data = %%params
                    gosub split
                    %%useremail = %%command
                    %%usernickname = @net(cgi,convert,%%params)
 
                    list add,lContacts,%%status|%%useremail|%%usernickname
                  else
                    if @equal(%%servercommand,CHL)
                      NET SOCKET,SENDSERVER,QRY %T "msmsgs@msnmsgr.com" 32@cr()@chr(10)@md5(string,%%params"Q1P7W2E4J9R8U3S5")
                    else
                      if @equal(%%servercommand,QRY)
                      else
                        if @equal(%%servercommand,OUT)
                          NET SOCKET,CLOSE
                        else
                          if @equal(%%servercommand,RNG)
                            %%data = %%params
                            gosub split
                            %%switchboard = %%command
 
                            %%data = %%params
                            gosub split
                            %%kind = %%command
 
                            %%data = %%params
                            gosub split
                            %%hash = %%command
 
                            %%data = %%params
                            gosub split
                            %%useremail = %%command
                            %%usernickname = @net(cgi,convert,%%params)
 
                            %%T2 = 1
                            option fieldsep,:
                            parse "%%newip;%%newport",%%switchboard
                            rundll net2,socket,addr,%%newip
                            rundll net2,socket,port,%%newport
                            rundll net2,socket,client
                            %%init =
                          else
                            if @numeric(%%servercommand)
                              list seek,%%errorlist,0
                              if @match(%%errorlist,|%%servercommand)
                                option fieldsep,|
                                parse "%%errorname;",@item(%%errorlist)
                                warn MSN error: %%errorname
                              else
                                warn Unexpected MSN error: %%servercommand
                              end
                            end
                          end
                        end
                      end
                    end
                  end
                end
              end
            end
          end
        end
      end

      dialog set,EDIT3,%%params
      dialog set,EDIT4,%%buffer
    until @zero(@pos(@cr()@chr(10),%%buffer))
  end
  if %%dialog
    dialog select,1
  end
  goto evloop
:network2
  if %%dialog
    dialog select,0
  end
  %%buffer2 = %%buffer2@rundll(net2,socket,data)
  repeat
    if %%msgcount
      if @greater(@len(%%buffer2),@pred(%%msgcount))
        %%mime = @substr(%%buffer2,1,%%msgcount)
        %%buffer2 = @strdel(%%buffer2,1,%%msgcount)
        %%msgcount =
        dialog set,lMessage,%%mime
        gosub parsemime
        if %%dialog
          dialog select,1
          %%mimefield = Content-Type
          gosub mimesearch
          %%char = ";"
          %%data = %%mimedata
          gosub split
          %%contenttype = @trim(%%command)
          %%charset = @trim(%%params)
          if @equal(%%contenttype,text/plain)
            dialog set,eMessages,%%usernickname says: %%mimemessage@cr()@chr(10)@cr()@chr(10)@dlgtext(eMessages)
            dialog set,sStatus,Last message received at @datetime(ddddd) at @datetime(t).
          else
            if @equal(%%contenttype,text/x-msmsgscontrol)
              %%mimefield = TypingUser
              gosub mimesearch
              %%typinguser = %%mimedata
              if @trim(%%typinguser)
                dialog set,sStatus,%%typinguser is entering a message...
              end
            end
          end
          dialog select,0
        end
      end
    else
      if @not(@zero(@pos(@cr()@chr(10),%%buffer2)))
        %%pos = @pos(@cr()@chr(10),%%buffer2)
        if @greater(%%pos,1)
          %%data = @substr(%%buffer2,1,@pred(%%pos))
          %%buffer2 = @strdel(%%buffer2,1,@succ(%%pos))
        else
          %%data =
          %%buffer2 = @strdel(%%buffer2,1,@succ(%%pos))
        end
        %%char = " "
        %%beforesplit = %%data
 
        gosub split
        %%servercommand = %%command
        dialog set,EDIT1,%%servercommand
 
        if @equal(%%servercommand,MSG)
          %%data = %%params
          gosub split
          %%useremail = %%command
 
          %%data = %%params
          gosub split
          %%usernickname = @net(cgi,convert,%%command)
          %%msgcount = %%params
          dialog set,EDIT5,%%msgcount
 
          %%message =
        else
          if @not(@equal(%%servercommand,JOI))
            %%data = %%params
            gosub split
            if @numeric(%%command)
              %%T2 = @succ(%%command)
              dialog set,EDIT2,%%T2
            end
          end
          if @numeric(%%servercommand)
            list seek,%%errorlist,0
            if @match(%%errorlist,|%%servercommand)
              option fieldsep,|
              parse "%%errorname;",@item(%%errorlist)
              warn MSN error: %%errorname
            else
              warn Unexpected MSN error: %%servercommand
            end
          else
            if @equal(%%servercommand,ANS)
              %%status = %%params
              dialog set,EDIT5,%%status
              if @equal(%%status,OK)
                gosub chatdialog
              end
            else
              if @equal(%%servercommand,IRO)
                %%data = %%params
                gosub split
                %%info1 = %%command
   
                %%data = %%params
                gosub split
                %%info2 = %%command
   
                %%data = %%params
                gosub split
                %%useremail = %%command
                %%usernickname = @net(cgi,convert,%%params)
                dialog set,EDIT5,%%useremail|%%usernickname
              else
                if @equal(%%servercommand,USR)
                  %%data = %%params
                  gosub split
                  %%status = %%command

                  %%data = %%params
                  gosub split
                  %%email = %%command
                  %%nickname = @net(cgi,convert,%%params)

                  if @equal(%%status,OK)
                    rundll net2,socket,sendserver,CAL %%T2 %%useremail@cr()@chr(10)
                  end
                else
                  if @equal(%%servercommand,CAL)
                    %%data = %%params
                    gosub split
                    %%kind = %%command
                    %%session = %%params
                    dialog set,EDIT5,%%kind|%%session
                  else
                    if @equal(%%servercommand,JOI)
                      %%data = %%params
                      gosub split
                      %%useremail = %%command
                      %%usernickname = @net(cgi,convert,%%params)
                      gosub chatdialog
                    end
                  end
                end
              end
            end
          end
        end
      end
    end
  until @zero(@pos(@cr()@chr(10),%%buffer2))@both(%%msgcount,@greater(%%msgcount,@len(%%buffer2)))
  if %%dialog
    dialog select,1
  end
  goto evloop
:closec
  if %%dialog
    dialog select,0
  end
  dialog set,sStatus,Disconnected
  if %%dialog
    dialog select,1
  end
  if %%close
    goto close0
  end
  goto evloop
:closec2
  dialog close
  rem "eat" last event
  %x = @event()
  %%dialog =
  goto evloop
:bSendbutton
  %%preparemessage = @dlgtext(eMessage)
  %%prepare = "MIME-Version: 1.0"@cr()@chr(10)
  %%prepare = %%prepare"Content-Type: text/plain; charset=UTF-8"@cr()@chr(10)
  %%prepare = %%prepare"X-MMS-IM-Format: FN=Microsoft%20Sans%20Serif; EF=; CO=0; CS=0; PF=22"@cr()@chr(10)
  %%prepare = %%prepare@cr()@chr(10)
  %%prepare = %%prepare%%preparemessage
  rundll net2,socket,sendserver,MSG %%T2 N @len(%%prepare)@cr()@chr(10)%%prepare
  dialog set,eMessages,%%nickname says: %%preparemessage@cr()@chr(10)@cr()@chr(10)@dlgtext(eMessages)
  dialog set,eMessage,
  goto evloop
:initiate
  option fieldsep,:
  parse "%%ip;%%port",%%server
  NET SOCKET,ADDR,%%ip
  NET SOCKET,PORT,%%port
  NET SOCKET,CLIENT
  exit
:chatdialog
  DIALOG CREATE,Chat,-1,0,506,400
  DIALOG ADD,STYLE,sNames,,,B,,
  DIALOG ADD,TEXT,tNames,8,8,,,%%usernickname,,sNames
  DIALOG ADD,EDIT,eMessages,32,8,488,256,,,WRAP,SCROLL,READONLY,MULTI
  DIALOG ADD,EDIT,eMessage,296,8,400,72,,,WRAP,MULTI
  DIALOG ADD,BUTTON,bSend,296,416,80,72,&Send,,DEFAULT
  DIALOG ADD,STATUS,sStatus
  DIALOG SHOW
  %%dialog = 1
  exit
:split
  if @zero(@pos(%%char,%%data))
    %%command = %%data
    %%params =
  else
    %%command = @substr(%%data,1,@pred(@pos(%%char,%%data)))
    %%params = @substr(%%data,@succ(@pos(%%char,%%data)),@len(%%data))
  end
  exit
:parsemime
  list clear,%%mimelist1
  list clear,%%mimelist2
  %%char = ":"
  repeat
    %%pos = @pos(@cr()@chr(10),%%mime)
    %%mimeline = @substr(%%mime,1,@pred(%%pos))
    %%mime = @strdel(%%mime,1,@succ(%%pos))
    if @trim(%%mimeline)
      %%data = %%mimeline
      gosub split
      list add,%%mimelist1,|@trim(%%command)|
      list add,%%mimelist2,@trim(%%params)
    end
  until @not(@trim(%%mimeline))
  %%mimemessage = @trim(%%mime)
  exit
:mimesearch
  if @greater(@count(%%mimelist1),0)
    list seek,%%mimelist1,0
  end
  if @match(%%mimelist1,|%%mimefield|)
    %%mimedata = @item(%%mimelist2,@index(%%mimelist1))
  else
    %%mimedata =
  end
  exit
:error
  warn Error: @net(socket,error)
  goto evloop
:error2
  warn "Error (2): "@rundll(net2,socket,error)
  goto evloop
:close1
  rundll net2,socket,sendserver,BYE@cr()@chr(10)
  goto evloop
:close0
  if @equal(@net(socket,status),connected)
    NET SOCKET,SENDSERVER,BYE@cr()@chr(10)
    %%close = 1
    goto evloop
  end
  list close,%%mimelist2
  list close,%%mimelist1
  list close,%%messagelist
  list close,%%errorlist
  net socket,close
  rundll net2,socket,close
  rundll unload,net2


Note: to actually build a full MSN client from this, you may need to combine it with PGWARE's VDSIPP DLL (it might be possible by loading multiple instances of my DLL using the VDSRUN DLL too) as my VDSINET DLL at this time only supports a single simultaneous connection.


I've updated the script. It should allow for a single simultaneous conversation now, initiated either by the script or by another user. It'll require the VDSRUN DLL now as well. Also you'll have to copy VDSINET.DLL to VDSINET2.DLL.


Tommy


Last edited by Tommy on Thu May 09, 2002 2:31 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
marty
Professional Member
Professional Member


Joined: 10 May 2001
Posts: 789

PostPosted: Wed May 08, 2002 1:08 pm    Post subject: Reply with quote

Tommy thanks a lot!

Funny I was starting working on the IM open source VDS project when you posted this....

Great timing!!



Marty
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
marty
Professional Member
Professional Member


Joined: 10 May 2001
Posts: 789

PostPosted: Thu May 09, 2002 12:27 pm    Post subject: VDSIPP Convertion Reply with quote

Ok to everyone who interested, I tried converting this script so that it uses VDSIPP.DLL but without any success.


VDS would completly crash sometimes when certain commands of the DLL were executed. But it's clearly mentionned in the HELP that the TCP protocol of the DLL isnt supported on all servers.


Anyway I gave up...

Will be using VDSINET.DLL from Tommy instead.
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
marty
Professional Member
Professional Member


Joined: 10 May 2001
Posts: 789

PostPosted: Thu May 09, 2002 4:33 pm    Post subject: MSN Clone Updated version Reply with quote

Ok here's an update.

What has been added:

- Username & Password prompt
- An extra list that will retrieve all you contact list buddies

Eventually I will update it so both list are combined and are separated from who is online or not... Smile

Code:
title MSN
  directory change,@path(%0)
  %%server = "64.4.13.58:1863"
  %%email = @INPUT(Enter Messenger email:,)
  %%password = @INPUT(Enter password:,,password)

  option decimalsep,.
  external @path(%0)\vdsmd5.dll
  external @path(%0)\vdsinet.dll,Public Freeware Key|90257236
  external @path(%0)\vdsrun.dll
  %x = @rundll(load,net2,vdsinet2.dll,Public Freeware Key|90257236)
  dialog CREATE,MSN,-1,0,673,320
  dialog ADD,EDIT,EDIT1,8,8,224,24,EDIT1
  dialog ADD,EDIT,EDIT2,40,8,224,24,EDIT2
  dialog ADD,EDIT,EDIT3,72,8,224,24,EDIT3
  dialog ADD,EDIT,EDIT4,104,8,224,24,EDIT4
  dialog ADD,EDIT,EDIT5,136,8,224,24,EDIT5
  dialog ADD,BUTTON,BUTTON1,272,8,64,24,BUTTON1
  dialog ADD,BUTTON,BUTTON2,272,168,64,24,BUTTON2
  dialog ADD,LIST,lMessage,168,8,224,96
  dialog ADD,LIST,lContacts,22,240,208,288,,DBLCLICK
  dialog ADD,STATUS,sStatus
   DIALOG ADD,LIST,allbuddies,22,470,186,274
  DIALOG ADD,TEXT,Online,3,246,,,Online Buddies
  DIALOG ADD,TEXT,Offliner,3,475,,,All Buddies
  dialog SHOW
 rem  dialog hide,offline
  %%errorlist = 1
  list create,%%errorlist
  list loadtext,%%errorlist
"ERR_SYNTAX_ERROR|200
"ERR_INVALID_PARAMETER|201
"ERR_INVALID_USER|205
"ERR_FQDN_MISSING|206
"ERR_ALREADY_LOGIN|207
"ERR_INVALID_USERNAME|208
"ERR_INVALID_FRIENDLY_NAME|209
"ERR_LIST_FULL|210
"ERR_ALREADY_THERE|215
"ERR_NOT_ON_LIST|216
"ERR_ALREADY_IN_THE_MODE|218
"ERR_ALREADY_IN_OPPOSITE_LIST|219
"ERR_SWITCHBOARD_FAILED|280
"ERR_NOTIFY_XFR_FAILED|281
"ERR_REQUIRED_FIELDS_MISSING|300
"ERR_NOT_LOGGED_IN|302
"ERR_INTERNAL_SERVER|500
"ERR_DB_SERVER|501
"ERR_FILE_OPERATION|510
"ERR_MEMORY_ALLOC|520
"ERR_SERVER_BUSY|600
"ERR_SERVER_UNAVAILABLE|601
"ERR_PEER_NS_DOWN|602
"ERR_DB_CONNECT|603
"ERR_SERVER_GOING_DOWN|604
"ERR_CREATE_CONNECTION|707
"ERR_BLOCKING_WRITE|711
"ERR_SESSION_OVERLOAD|712
"ERR_USER_TOO_ACTIVE|713
"ERR_TOO_MANY_SESSIONS|714
"ERR_NOT_EXPECTED|715
"ERR_BAD_FRIEND_FILE|717
"ERR_AUTHENTICATION_FAILED|911
"ERR_NOT_ALLOWED_WHEN_OFFLINE|913
"ERR_NOT_ACCEPTING_NEW_USERS|920
  %%messagelist = 2
  list create,%%messagelist
  %%mimelist1 = 3
  list create,%%mimelist1
  %%mimelist2 = 4
  list create,%%mimelist2

  net SOCKET,AUTO,
  net SOCKET,VDSEVENTS,
  rundll net2,socket,auto,
  rundll net2,socket,vdsevents,
  %t = 0
  %%buffer =
  %%buffer2 =
  %%firstmessage =
  %%msgcount =
  %%init =
  gosub initiate
:evloop
  option fieldsep,|
  %e = @event(D)
  parse "%e;%w",%e
  if %e
    if @equal(%e,CLOSE)
      goto %e%w
    else
      goto %e
    end
  end
  %e = @net(socket,event)
  if %e
    goto %e
  end
  %e = @rundll(net2,socket,event)
  if %e
    goto %e"2"
  end
  wait 0.1
  goto evloop
:lContactsdblclick
  if @item(lContacts)
    %%item = @item(lContacts)
    option fieldsep,|
   
    parse "%%status;%%useremail;%%usernickname",%%item
    net socket,sendserver,XFR %T SB@cr()@chr(10)
  end
  goto evloop
:connect
  net SOCKET,SENDSERVER,VER %T MSNP7 MSNP6 MSNP5 MSNP4 CVRO@cr()@chr(10)
  goto evloop
:connect2
  if %%init
    rundll net2,socket,sendserver,USR %%T2 %%email %%hash@cr()@chr(10)
  else
    dialog set,EDIT5,%%T2|%%email|%%hash|%%session
    rundll net2,socket,sendserver,ANS %%T2 %%email %%hash %%session@cr()@chr(10)
  end
  goto evloop
:network
  if %%dialog
    dialog select,0
  end
  %%buffer = %%buffer@net(socket,data)
  if @not(@zero(@pos(@cr()@chr(10),%%buffer)))
    repeat
      %%pos = @pos(@cr()@chr(10),%%buffer)
      if @greater(%%pos,1)
        %%data = @substr(%%buffer,1,@pred(%%pos))
        %%buffer = @strdel(%%buffer,1,@succ(%%pos))
      else
        %%data =
        %%buffer = @strdel(%%buffer,1,@succ(%%pos))
      end
      %%char = " "
      %%beforesplit = %%data

      gosub split
      %%servercommand = %%command
      dialog set,EDIT1,%%servercommand

      if @equal(%%servercommand,MSG)
        %%msg = 1
        %%message =
      else
        if %%msg
          if %%beforesplit
            %%message = %%message%%beforesplit@cr()
          else
            %%msg =
            dialog set,lMessage,%%message
            if %%firstmessage
              net SOCKET,SENDSERVER,CHG %T NLN@cr()@chr(10)
              dialog set,sStatus,@net(cgi,convert,%%nickname): online
              %%firstmessage =
            end
          end
        else
          %%data = %%params
          gosub split
          if @equal(%%servercommand,RNG)
            %%session = %%command
          else
            if @numeric(%%command)
              %t = @succ(%%command)
              dialog set,EDIT2,%T
            end
          end

          if @equal(%%servercommand,VER)
            net SOCKET,SENDSERVER,INF %T@cr()@chr(10)
          else
            if @equal(%%servercommand,INF)
              %%kind = %%params
              dialog set,EDIT5,%%kind
              net SOCKET,SENDSERVER,USR %T MD5 I %%email@cr()@chr(10)
            else
              if @equal(%%servercommand,XFR)
                %%data = %%params
                gosub split
                %%kind = %%command

                %%data = %%params
                gosub split
                %%server = %%command

                dialog set,EDIT5,%%server

                if @equal(%%kind,NS)
                  %%extra = %%params
                  net socket,close
                  gosub initiate
                else
                  if @equal(%%kind,SB)
                    %%data = %%params
                    gosub split
                    %%kind2 = %%command
                    %%hash = %%params

                    %%t2 = 1
                    option fieldsep,:
                    parse "%%newip;%%newport",%%server
                    rundll net2,socket,addr,%%newip
                    rundll net2,socket,port,%%newport
                    rundll net2,socket,client
                    %%init = 1
                  end
                end
              else
                if @equal(%%servercommand,USR)
            
                  %%data = %%params
                  gosub split
                  %%kind = %%command

                  %%data = %%params
                  gosub split
                  %%extra = %%command

                  if @equal(%%kind,MD5)
                    %%hash = %%params

                    dialog set,EDIT5,%%extra
                    net SOCKET,SENDSERVER,USR %T MD5 S @md5(string,%%hash%%password)@cr()@chr(10)
                  else
                    if @equal(%%kind,OK)
                 NET SOCKET,SENDSERVER,LST %t RL@cr()@chr(10)
                      %%data = %%params
                      gosub split
                      %%nickname = @net(cgi,convert,%%command)

                      %%extra2 = %%params
                      dialog set,EDIT5,%%extra|%%extra2
                         
                      dialog set,sStatus,%%nickname
                      %%firstmessage = 1
                    end
                  end
                else
                  if @equal(%%servercommand,ILN)
               
                    %%data = %%params
                    gosub split
                    %%status = %%command

                    %%data = %%params
                    gosub split
                    %%useremail = %%command
                    %%usernickname = @net(cgi,convert,%%params)
                   
                    list add,lContacts,%%status|%%useremail|%%usernickname
                  else
                 if @equal(%%servercommand,LST)
               
                        %%data = %%params
                        gosub split
                      %%status2 = %%command

                        %%data = %%params
                       gosub split
                        %%email2 = %%command
                        %%usernickname2 = @net(cgi,convert,%%params)
                  
                          list add,allbuddies,%%status2|%%email2|%%usernickname2
                  
                      else 
                    if @equal(%%servercommand,CHL)
                      net SOCKET,SENDSERVER,QRY %T "msmsgs@msnmsgr.com" 32@cr()@chr(10)@md5(string,%%params"Q1P7W2E4J9R8U3S5")
                    else
                      if @equal(%%servercommand,QRY)
                 else
                
                        if @equal(%%servercommand,OUT)
                          net SOCKET,CLOSE
                        else
                          if @equal(%%servercommand,RNG)
                            %%data = %%params
                            gosub split
                            %%switchboard = %%command

                            %%data = %%params
                            gosub split
                            %%kind = %%command

                            %%data = %%params
                            gosub split
                            %%hash = %%command

                            %%data = %%params
                            gosub split
                            %%useremail = %%command
                            %%usernickname = @net(cgi,convert,%%params)

                            %%t2 = 1
                            option fieldsep,:
                            parse "%%newip;%%newport",%%switchboard
                            rundll net2,socket,addr,%%newip
                            rundll net2,socket,port,%%newport
                            rundll net2,socket,client
                            %%init =
                          else
                            if @numeric(%%servercommand)
                              list seek,%%errorlist,0
                              if @match(%%errorlist,|%%servercommand)
                                option fieldsep,|
                                parse "%%errorname;",@item(%%errorlist)
                                warn MSN error: %%errorname
                              else
                                warn Unexpected MSN error: %%servercommand
                              end
                            end
                          end
                        end
                      end
                    end
                  end
                end
              end
            end
          end
        end
      end
    end
      dialog set,EDIT3,%%params
      dialog set,EDIT4,%%buffer
    until @zero(@pos(@cr()@chr(10),%%buffer))
  end
  if %%dialog
    dialog select,1
  end
  goto evloop
:network2
  if %%dialog
    dialog select,0
  end
  %%buffer2 = %%buffer2@rundll(net2,socket,data)
  repeat
    if %%msgcount
      if @greater(@len(%%buffer2),@pred(%%msgcount))
        %%mime = @substr(%%buffer2,1,%%msgcount)
        %%buffer2 = @strdel(%%buffer2,1,%%msgcount)
        %%msgcount =
        dialog set,lMessage,%%mime
        gosub parsemime
        if %%dialog
          dialog select,1
          %%mimefield = Content-Type
          gosub mimesearch
          %%char = ";"
          %%data = %%mimedata
          gosub split
          %%contenttype = @trim(%%command)
          %%charset = @trim(%%params)
          if @equal(%%contenttype,text/plain)
            dialog set,eMessages,%%usernickname says: %%mimemessage@cr()@chr(10)@cr()@chr(10)@dlgtext(eMessages)
            dialog set,sStatus,Last message received at @datetime(ddddd) at @datetime(t).
          else
            if @equal(%%contenttype,text/x-msmsgscontrol)
              %%mimefield = TypingUser
              gosub mimesearch
              %%typinguser = %%mimedata
              if @trim(%%typinguser)
                dialog set,sStatus,%%typinguser is entering a message...
              end
            end
          end
          dialog select,0
        end
      end
    else
      if @not(@zero(@pos(@cr()@chr(10),%%buffer2)))
        %%pos = @pos(@cr()@chr(10),%%buffer2)
        if @greater(%%pos,1)
          %%data = @substr(%%buffer2,1,@pred(%%pos))
          %%buffer2 = @strdel(%%buffer2,1,@succ(%%pos))
        else
          %%data =
          %%buffer2 = @strdel(%%buffer2,1,@succ(%%pos))
        end
        %%char = " "
        %%beforesplit = %%data

        gosub split
        %%servercommand = %%command
        dialog set,EDIT1,%%servercommand

        if @equal(%%servercommand,MSG)
          %%data = %%params
          gosub split
          %%useremail = %%command

          %%data = %%params
          gosub split
          %%usernickname = @net(cgi,convert,%%command)
          %%msgcount = %%params
          dialog set,EDIT5,%%msgcount

          %%message =
        else
          if @not(@equal(%%servercommand,JOI))
            %%data = %%params
            gosub split
            if @numeric(%%command)
              %%t2 = @succ(%%command)
              dialog set,EDIT2,%%T2
            end
          end
          if @numeric(%%servercommand)
            list seek,%%errorlist,0
            if @match(%%errorlist,|%%servercommand)
              option fieldsep,|
              parse "%%errorname;",@item(%%errorlist)
              warn MSN error: %%errorname
            else
              warn Unexpected MSN error: %%servercommand
            end
          else
            if @equal(%%servercommand,ANS)
              %%status = %%params
              dialog set,EDIT5,%%status
              if @equal(%%status,OK)
                gosub chatdialog
              end
            else
              if @equal(%%servercommand,IRO)
                %%data = %%params
                gosub split
                %%info1 = %%command

                %%data = %%params
                gosub split
                %%info2 = %%command

                %%data = %%params
                gosub split
                %%useremail = %%command
                %%usernickname = @net(cgi,convert,%%params)
                dialog set,EDIT5,%%useremail|%%usernickname
              else
                if @equal(%%servercommand,USR)
                  %%data = %%params
                  gosub split
                  %%status = %%command

                  %%data = %%params
                  gosub split
                  %%email = %%command
                  %%nickname = @net(cgi,convert,%%params)

                  if @equal(%%status,OK)
                    rundll net2,socket,sendserver,CAL %%T2 %%useremail@cr()@chr(10)
                  end
                else
                  if @equal(%%servercommand,CAL)
                    %%data = %%params
                    gosub split
                    %%kind = %%command
                    %%session = %%params
                    dialog set,EDIT5,%%kind|%%session
                  else
                    if @equal(%%servercommand,JOI)
                      %%data = %%params
                      gosub split
                      %%useremail = %%command
                      %%usernickname = @net(cgi,convert,%%params)
                      gosub chatdialog
                    end
                  end
                end
              end
            end
          end
        end
      end
    end
  until @zero(@pos(@cr()@chr(10),%%buffer2))@both(%%msgcount,@greater(%%msgcount,@len(%%buffer2)))
  if %%dialog
    dialog select,1
  end
  goto evloop
:closec
  if %%dialog
    dialog select,0
  end
  dialog set,sStatus,Disconnected
  if %%dialog
    dialog select,1
  end
  if %%close
    goto close0
  end
  goto evloop
:closec2
  dialog close
  rem "eat" last event
  %x = @event()
  %%dialog =
  goto evloop
:bSendbutton
  %%preparemessage = @dlgtext(eMessage)
  %%prepare = "MIME-Version: 1.0"@cr()@chr(10)
  %%prepare = %%prepare"Content-Type: text/plain; charset=UTF-8"@cr()@chr(10)
  %%prepare = %%prepare"X-MMS-IM-Format: FN=Microsoft%20Sans%20Serif; EF=; CO=0; CS=0; PF=22"@cr()@chr(10)
  %%prepare = %%prepare@cr()@chr(10)
  %%prepare = %%prepare%%preparemessage
  rundll net2,socket,sendserver,MSG %%T2 N @len(%%prepare)@cr()@chr(10)%%prepare
  dialog set,eMessages,%%nickname says: %%preparemessage@cr()@chr(10)@cr()@chr(10)@dlgtext(eMessages)
  dialog set,eMessage,
  goto evloop
:initiate
  option fieldsep,:
  parse "%%ip;%%port",%%server
  net SOCKET,ADDR,%%ip
  net SOCKET,PORT,%%port
  net SOCKET,CLIENT
  exit
:chatdialog
  dialog CREATE,Chat,-1,0,506,400
  dialog ADD,STYLE,sNames,,,B,,
  dialog ADD,TEXT,tNames,8,8,,,%%usernickname,,sNames
  dialog ADD,EDIT,eMessages,32,8,488,256,,,WRAP,SCROLL,READONLY,MULTI
  dialog ADD,EDIT,eMessage,296,8,400,72,,,WRAP,MULTI
  dialog ADD,BUTTON,bSend,296,416,80,72,&Send,,DEFAULT
  dialog ADD,STATUS,sStatus
  dialog SHOW
  %%dialog = 1
  exit
:split
  if @zero(@pos(%%char,%%data))
    %%command = %%data
    %%params =
  else
    %%command = @substr(%%data,1,@pred(@pos(%%char,%%data)))
    %%params = @substr(%%data,@succ(@pos(%%char,%%data)),@len(%%data))
  end
  exit
:parsemime
  list clear,%%mimelist1
  list clear,%%mimelist2
  %%char = ":"
  repeat
    %%pos = @pos(@cr()@chr(10),%%mime)
    %%mimeline = @substr(%%mime,1,@pred(%%pos))
    %%mime = @strdel(%%mime,1,@succ(%%pos))
    if @trim(%%mimeline)
      %%data = %%mimeline
      gosub split
      list add,%%mimelist1,|@trim(%%command)|
      list add,%%mimelist2,@trim(%%params)
    end
  until @not(@trim(%%mimeline))
  %%mimemessage = @trim(%%mime)
  exit
:mimesearch
  if @greater(@count(%%mimelist1),0)
    list seek,%%mimelist1,0
  end
  if @match(%%mimelist1,|%%mimefield|)
    %%mimedata = @item(%%mimelist2,@index(%%mimelist1))
  else
    %%mimedata =
  end
  exit


:error
  warn Error: @net(socket,error)
  goto evloop
:error2
  warn "Error (2): "@rundll(net2,socket,error)
  goto evloop
:close1
  rundll net2,socket,sendserver,BYE@cr()@chr(10)
  goto evloop
:close0
  if @equal(@net(socket,status),connected)
    net SOCKET,SENDSERVER,BYE@cr()@chr(10)
    %%close = 1
    goto evloop
  end
  list close,%%mimelist2
  list close,%%mimelist1
  list close,%%messagelist
  list close,%%errorlist
  net socket,close
  rundll net2,socket,close
  rundll unload,net2


Edited by moderator; use the [code:1:1310c7d8a5] in the future to increase readability(and to have that very cool download function)
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Zoltar
VDS Pirate
VDS Pirate


Joined: 26 Dec 2001
Posts: 91

PostPosted: Thu May 09, 2002 6:59 pm    Post subject: Reply with quote

Hi

where can I find this vdsinet2.dll Question Question

_________________
Zoltar


http://membres.lycos.fr/
Back to top
View user's profile Send private message Visit poster's website
marty
Professional Member
Professional Member


Joined: 10 May 2001
Posts: 789

PostPosted: Thu May 09, 2002 7:05 pm    Post subject: Reply with quote

It's the same as VDSINET.DLL, you need to have to copy of it:
VDSINET.DLL
VDSINET2.DLL

It comes with VDSDLL27.DLL

http://www.vdsworld.com/downloads/dll/vdsdll27.zip

And you need vdsmd5.dll which comes with the shareware extension VDSDLL3:

http://www.vdsworld.com/downloads/dll/vdsdll3.zip
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Zoltar
VDS Pirate
VDS Pirate


Joined: 26 Dec 2001
Posts: 91

PostPosted: Thu May 09, 2002 7:13 pm    Post subject: Reply with quote

Yes, it was I've done before I post, but i've got
an error at line 75
error 14

invalid parameter to command

_________________
Zoltar


http://membres.lycos.fr/
Back to top
View user's profile Send private message Visit poster's website
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1751
Location: Space and Time

PostPosted: Thu May 09, 2002 7:33 pm    Post subject: Reply with quote

Very sweet Cool !
_________________
Chris
Http://theblindhouse.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Tsunami1988
Contributor
Contributor


Joined: 15 Aug 2002
Posts: 70
Location: The Netherlands

PostPosted: Sun Dec 01, 2002 6:39 pm    Post subject: need vdsmd5.dll Reply with quote

Can someone send me vdsmd5.dll? I can't find it in vdsdll3.zip. Or do I need to register the vdsdll3.dll to get the vdsmd5.dll?
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Tommy
Admin Team


Joined: 16 Nov 2002
Posts: 746
Location: The Netherlands

PostPosted: Sun Dec 01, 2002 6:53 pm    Post subject: Reply with quote

Here's a 2 MB package containing all the small DLLs rather than the large all in one vdsdll.dll
file:

http://www.vdsworld.com/vdsdll/vdsdll3s.zip
Back to top
View user's profile Send private message Send e-mail Visit poster's website
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Mon May 24, 2004 12:13 pm    Post subject: Reply with quote

Wow, just came across this and it looks pretty cool Smile
I'll have to try it out. Very Happy

_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Mon May 24, 2004 4:05 pm    Post subject: Reply with quote

I believe Tommy's code isn't working anymore, since the MSN Messenger protocol now is at version MSNP9 or something, while Tommy's script is (I believe) made for MSNP6.
_________________
[ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial!
Back to top
View user's profile Send private message
Vic D'Elfant
Past Contributor
Past Contributor


Joined: 26 Jun 2002
Posts: 673
Location: The Netherlands

PostPosted: Mon May 24, 2004 4:11 pm    Post subject: Reply with quote

Well... if Tommy has used the correct initialization process the server
would automatically switch to the MSNP6 protocol. Unless that protocol
isn't used by the server anymore Confused

Regads,
Vic

_________________
phpBB Development Team
Back to top
View user's profile Send private message Visit poster's website
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Tue May 25, 2004 8:33 am    Post subject: Reply with quote

The server rejects (too) old versions. That's why a lot of old MSN-clones don't work anymore... Sad But it is possible to use the newest protocol, only it needs an SSL connection or something, and I don't know if that can be done with VDS...
_________________
[ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial!
Back to top
View user's profile Send private message
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Tue Jun 22, 2004 4:45 pm    Post subject: Reply with quote

Would be nice if anyone figures it out. I'm now only using MSN and would
love to use a VDS made MSN client.

_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript Open Source Projects All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group