Jump to content

YMSG protocol support


Recommended Posts

hi, i'm try it on VB6, but it not working :)

i'm connect to filetransfer.msg.yahoo.com

and send packet: (with http request port 80)

Private Sub filetranfer_Connect()
    Dim data$, f$, size&, bin$
    Dim id As Integer, i&
    Dim bytArray() As Byte

    id = FreeFile
    f = "C:\Documents and Settings\HUY VAN\Desktop\YMSG16\YMSG16\avatar.png"
    Open f For Binary As id
        size = LOF(id)
        ReDim bytArray(1 To size)
        Get id, 1, bytArray
    Close id
    For i = 1 To size
        bin = bin & Chr(bytArray(i))
    Next

    data = ChrH("59 4D 53 47 10 00 00 00 00 4B 00 C2 00 00 00 00 00 00 00 00")
    data = data & addElement("1", Text1(0).Text)
    data = data & addElement("38", "604800")
    data = data & addElement("0", Text1(0).Text)
    data = data & addElement("28", CStr(size))
    data = data & addElement("27", "avatar.png")
    data = data & addElement("14", "")
    data = data & addElement("29", bin)
      
    Dim cn$
    cn = "POST /notifyft HTTP/1.1" & vbCrLf
    cn = cn & "Cookie: " & cid$ & ";" & strCookie & vbCrLf
    cn = cn & "User-Agent: Mozilla/4.0 (compatible; MSIE 5.5)" & vbCrLf
    cn = cn & "Host: filetransfer.msg.yahoo.com" & vbCrLf
    cn = cn & "Content-Length: " & Len(data) & vbCrLf
    cn = cn & "cache-Control: no-cache" & vbCrLf
    cn = cn & vbCrLf
    cn = cn & data
    Debug.Print "Data: " + cn
    filetranfer.SendData cn
End Sub

cid$ get on:

Response = Inet.OpenURL("https://login.yahoo.com/config/pwtoken_get?src=ymsgr&ts=&login=" + Username + "&passwd=" + Password + "&chal=" + FormatChallengeOperands(Challenge))
    cid$ = "ymsgr=" + ParseString(Response, "ymsgr=", Chr(&HA))

and cookie then i send it to filetransfer.msg.yahoo.com

but it show

HTTP/1.1 200 OK
Date: Sat, 30 May 2009 14:50:34 GMT
P3P: policyref="http://p3p.yahoo.com/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE GOV"
Cache-Control: private
Content-Type: text/plain; charset=utf-8
Transfer-Encoding: chunked
Via: 1.1 ironport2.vdc3.com.vn:80 (IronPort-WSA/5.6.2-102)
Connection: keep-alive
X-Junk: xxxxxxxxxx

7d0
   YMSG   ÿÿÿÿ  16ÀBad RequestÀ
Link to comment
Share on other sites

  • Replies 132
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

I'm using Windows 7 and doesn't seem to start the adodb.stream. I know I shouldn't complain as long as I'm using a rc version but if there's a workaround I'd be happy to find it. I tried manually installing mdac but it doesn't seem to work anyway. I'll just switch to xp to test the library for now(hope it works).

Link to comment
Share on other sites

hi, i'm try it on VB6, but it not working :)

i'm connect to filetransfer.msg.yahoo.com

and send packet: (with http request port 80)

I translated some code I found online for pidgin/etc and felt pretty confident I did it correctly.

But it failed.

By the way @ your code - the PwToken is not usually accepted as a cookie, try getting the Y and T cookies and using them instead.

EDIT: Even when I'm using Pidgin, when it sets the avatar itself on yahoo it doesn't seem to change the avatar for anyone but myself. (still the default Gray-Face avatar)

This seems like a lost cause for the moment.

EDIT 2: Got a packet log of what Pidgin was sending/receiving and it uses the Y and T cookies, and all of the other right details, it still gets a Bad Request response.

POST http://filetransfer.msg.yahoo.com:80/notifyft HTTP/1.0
Content-length: 1166
Host: filetransfer.msg.yahoo.com:80
Cookie: Y=v=1&n=[CENSORED]; T=z=[CENSORED]

YMSG       Xÿ=1À€crash_demons_of_darknessÀ€38À€604800À€0À€crash_demons_of_darknessÀ€28À€1006À€27À€94f9004227e41d436dd5e602e62edd8cf79e1315.pngÀ€14À€À€29À€‰PNG ... À€

HTTP/1.1 200 OK
Date: Mon, 01 Jun 2009 06:09:29 GMT
P3P: policyref="http://p3p.yahoo.com/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE GOV"
Cache-Control: private
Connection: close
Content-Type: text/plain; charset=utf-8

   YMSG   ÿÿÿÿ  16À€Bad RequestÀ€

Edit 3: since when did attaching the port to the Host field when the port was 80 become acceptable? @ pidgin's sent data.

@ Kreatorul - Did you get the examples working okay on Windows XP?

If not, what errors do you receive?

Edited by crashdemons

My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.)

Link to comment
Share on other sites

Yep, I got them working on XP. It's a great library. Planning on adding the friend list for the pm example anytime soon? It's needed for a working y!m client and I'm not familiar with the protocol to get it myself.

The chat client example does not currently correctly process or copy the correct hierarchy but rather takes shortcuts - the easiest way I can see to hold all of the information otherwise is to make an array of arrays...

Really, except for the chat client example, I want to keep the other examples as simple as possible so as to not over-complicate their function.

* Furthermore - If I added processing for the buddylist in the PM example, I think it would distract from the real buddylist format.

I have only one example that outputs the true buddylist format

Here's an updated version of what I posted earlier - please study the output in the SciTE console of this script:

-Attachment Removed, see Examples in first post-

It displays information for each packet received

-but in the matter of the packet containing the buddylist, it displays the interpretation for each field and (as before) the correct hierarchy.

As field information is printed, the left shows the field and it's value; while the right shows its hierarchy (by indentation) and information about the field/value if any

If you have any further questions about the buddylist format or anything else, I will try to answer them as well.

Note: in the example, if you have YMSGLib.ini, packet/field/list names are displayed when possible.

Edited by crashdemons

My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.)

Link to comment
Share on other sites

any ideea why sending data to a msn id dosen't work but getting data works?

presumably, and depending on the packet -

- you probably need the 241 (service) field set to the correct value to send messages to a user on that specific service

(eg: MSN/Windows Messenger is supposedly "2")

Please see the $_YMSG_PgrServices array in YMSGLib.au3 for some other service values (not verified, but on good account.)

Citations: 1 2 3

;  [index] [option]
;          [0     ] = int  SvcNum (value for field 241)
;          [1     ] = str  SvcName
;          ...
Global Const $_YMSG_PgrServices[4][6]=[  _
[ 0,"Yahoo!"             , ...        ], _
[ 1,"Live Communications", ...        ], _
[ 2,"Windows MSN Live"   , ...        ], _
[ 9,"IBM Lotus Sametime" , ...        ]  ]

Hopefully that will work, although you may find that you can only get this working with the newest Windows Messenger and not third-party MSN clients.

PS:

_YMSG_Client_PM already supports this via the $iService parameter, other packets could support it too - but not all pager packets (and virtually no chat packets) accept it and I haven't had time to map it all out yet for cross-service support.

Edited by crashdemons

My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.)

Link to comment
Share on other sites

ok so that's fixed... but another problem... the add buddy sequence can't be finished from this client :D

you get stuck at add request pending

Only two things are infinite, the universe and human stupidity, and i'm not sure about the former -Alber EinsteinPractice makes perfect! but nobody's perfect so why practice at all?http://forum.ambrozie.ro

Link to comment
Share on other sites

ok so that's fixed... but another problem... the add buddy sequence can't be finished from this client :D

you get stuck at add request pending

Yeah I know, I'll look into adding a request window and the correct accept/deny message to the Chat Client example when I get time to test with other clients.

Edit: one thing that Pidgin and YahELite don't seem to allow is accepting a buddy-request without adding to your own buddylist. However, it seems to work fine.

Testing (finished)

Buddyrequest received:

Type: VerifyContact (D6)
Status: Unknown (3)
----------------------------
pmfromusername(4)="crash_demons_of_darkness"
pmtousername(5)="crash_daemonicus"

Working Accept Response:

_YMSG_Client_VerifyContact($sAlias,$sBuddyAlias,1,'*** buddylist request accepted')

Working Deny Response:

_YMSG_Client_VerifyContact($sAlias,$sBuddyAlias,2,'*** buddylist request denied')

Working Add Response (accept+buddyadd):

_YMSG_Client_VerifyContact($sAlias,$sBuddyAlias,1,'I have added you to my buddy list.')
_YMSG_Client_BuddyAdded($sAlias,$sBuddyAlias,$sGroup,'I have added you to my buddy list.')

Notifications:

Add Buddy Request: (similar rejections for remove buddy/ignore/unignore)

(sender; no server rejection)

0x0083 (Status 1)
1«»crash_demons_of_darkness«»
7«»crash_daemonicus«»
65«»GroupName«»
66«»0«»
223«»1«»
241«»0«»

(Receiver, Do you want to accept or deny? :D notice the missing 13 field and status)

0x00D6 (Status 3)
4«»crash_demons_of_darkness«»
5«»crash_daemonicus«»
14«»I have added you to my buddy list.«»

Your Buddy Request was:

Accepted:

0x00D6 (Status 1)
4«»crash_daemonicus«»
5«»crash_demons_of_darkness«»
13«»2«»
14«»*** buddylist request accepted«»

Denied:

0x00D6 (Status 1)
4«»crash_daemonicus«»
5«»crash_demons_of_darkness«»
13«»1«»
14«»*** buddylist request denied«»

+So we can assume with 0x00D6 notifications that:

If field 13 has a value of 1, it is a notification of an accepted buddy request.

If field 13 has a value of 2, it is a notification of an denied buddy request.

If field 13 is missing or the packet status is 3, it is a notification of an incoming buddy request.

+We can assume for 0x0083 notifications that:

If field 66 is present and non-zero, your buddy request failed. (not denied)

Edited by crashdemons

My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.)

Link to comment
Share on other sites

Update: YMSGLib v2.5

_YMSG_Client_VerifyContact packet status changed to 0 to allow it to work correctly.

Additional pager packet functions now support the $iService cross-network parameter:

_YMSG_Client_VerifyContact
_YMSG_Client_BuddyAdded
_YMSG_Client_BuddyDeleted
_YMSG_Client_IgnoreUser
_YMSG_Client_PictureRequest
Documentation for the above change was added.

Update: Chat Client Example

In-Chat Notifications added for:

- Server Rejections:

- - - Ignore/Unignore

- - - Add/Remove Buddy

- Pending Add-Buddy Request accepted/denied

- Requests for you to be added as a buddy

Added a confirmation window to accept/decline the buddy requests sent to you.

Fixed Offline buddy state notification. (Packet 0x0002)

Edit: Quick Fix for blank usernames on Ignore/UnIgnore notifications.

The chat client example nor none of the current examples support cross-network sending as of yet.

Edited by crashdemons

My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.)

Link to comment
Share on other sites

Hi,

It's not support Unicode.

When i chat with Unicode:

Jak Joh: Hà ng very good giá má»m. Anh em nà o cần pm ngay nhé . Khuyến mại Äặc biá»t cho khách mua nhiá»u;)

Can you fix?

Link to comment
Share on other sites

Hi,

It's not support Unicode.

When i chat with Unicode:

Jak Joh: Hà ng very good giá má»m. Anh em nà o cần pm ngay nhé . Khuyến mại đặc biệt cho khách mua nhiá»u;)

Can you fix?

I'm not sure how to do that at the moment but I will look into it.

If I recall correctly, unicode character sets are actually transferred over yahoo via UTF-8.

(eg: U+FB50 sent over yahoo is actually transferred as EFAD90)

That being said, there should probably be a quick way to convert UTF-8 to whatever needs to be used, i'll play with the BinaryToString/StringToBinary second parameter to see if that'll work.

The problem I see is that I can get specific characters to change from Unicode to UTF-8 and back via ChrW and AscW, but I can't find a way to get '78 20 EFAD90 20 79' to change from UTF-8 to a unicode string (I would want '78 20 FB50 20 79' as the output) but BinaryToString only has parameters for UTF-8/16 and ANSI. :D I'm confused.

Testing this is made all the harder by the fact that SciTE won't let me paste unicode characters in. (just shows a "?") :D

The question after that is: will it even display in the editbox being used as a chatscreen?

Edited by crashdemons

My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.)

Link to comment
Share on other sites

imho you should really change that winhttp.au3... so it can work even if no errorhandler exists

why? because i used your client in a script... and i had an error handler (a pretty complex one) and i had a lot of trouble mixing yours with mine

p.s.: great job so far :D

Edited by Xand3r

Only two things are infinite, the universe and human stupidity, and i'm not sure about the former -Alber EinsteinPractice makes perfect! but nobody's perfect so why practice at all?http://forum.ambrozie.ro

Link to comment
Share on other sites

imho you should really change that winhttp.au3... so it can work even if no errorhandler exists

Done.

Set $_WinHTTP_UseDefaultErrorHandler=False before any _WinHTTP_Startup's are called.

(I don't mean multiple times - you need only set this option once before WinHttp has a chance to set the error handler in _Startup)

Remember, without the default error-handler, it is your responsibility to prevent or catch all object errors.

Also, I changed the names of a few global variables in WinHTTP.au3 to be more unique so that conflicting names can be avoided.

I need sleep.

Edited by crashdemons

My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.)

Link to comment
Share on other sites

Small change:

I renamed WinHTTP.au3 to WinHTTP_COM.au3 to reduce confusion with a different project using the same filename.

This will be a minor breaking change as you will may have to edit or remove your Includes for WinHTTP in your scripts that use YMSGLib.

(YMSGLib.au3 now includes WinHTTP_COM.au3 by default as parts of it require it - don't worry, both files are include-once)

Hopefully, I will eventually make the transition to a more standard HTTP library; but it's not exactly a pressing concern at the moment.

Edited by crashdemons

My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.)

Link to comment
Share on other sites

  • 2 weeks later...

how do you configure HTTP Proxy, SOCKS Proxy... is it possible.

Do Not Steal The Government Hates CompetitionO2JAM AutoPlayBot [|||||.............] 10%Friendster Commenter [..................] 0%Auto Message Download Percentage [|||||||||||||||||] 100%
Link to comment
Share on other sites

how do you configure HTTP Proxy, SOCKS Proxy... is it possible.

[Assuming you're using WinHTTP_COM.au3]

you can change HTTP Proxy settings by calling $_WinHTTP_oRequest.SetProxy($state[, $server]) after calling _WinHTTP_Startup(...) for a specific connection.

However, if you want to keep all HTTP connections proxied (including the ones used in YMSGLib) you'll have to set $_WinHTTP_StayEnabled=True, call _WinHTTP_Startup and THEN set the proxy settings.

Note: StayEnabled just overrides _WinHTTP_Shutdown so that it can't delete/close the objects. (this was added so that you can override external functions from deleting/closing the object if you're not finished with it. Ex: the login and CAPTCHA functions in YMSGLib both close the objects they use by default.)

(Remember to turn off StayEnabled and then do a _WinHTTP_Shutdown when you're done)

Here's a simplistic outline of the SetProxy method of the WinHTTP object:

$_WinHTTP_oRequest.SetProxy($state)
$state:
    0 - Use Environmental Settings
    1 - Use a Direct Connection

$_WinHTTP_oRequest.SetProxy($state,$server)
$state:
    2 - Use a Specific Proxy Server
$server: "domainname:port"  (ex:  "proxy.example.com:8080")

I'm not sure about setting up a SOCKS proxy for the Pager/Chat connection, I'll have to research it - but I'm sure it won't be related to this YMSG "library" directly.

(I mean, nothing inside YMSGLib will have to be modified for a proxy for your connection to Yahoo Pager/Chat - just how connections are handled in the examples.)

I know it's possible - it's just a matter if figuring it out.

Edited by crashdemons

My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.)

Link to comment
Share on other sites

I have a quick question regarding this line on Y_PM_Example.au3 : 92

Global $socket=TCPConnect(TCPNameToIP($server),$port)

Should I modify this line in order for it to work for an HTTP Proxy. I am using an HTTP Proxy at Port 8080. Do I have to do everything what you have just said. I just want to implement it in your PM Example. Internet connection at work requires an HTTP Proxy.

Thanks,

geocine

Edited by geocine
Do Not Steal The Government Hates CompetitionO2JAM AutoPlayBot [|||||.............] 10%Friendster Commenter [..................] 0%Auto Message Download Percentage [|||||||||||||||||] 100%
Link to comment
Share on other sites

I have a quick question regarding this line on Y_PM_Example.au3 : 92

Global $socket=TCPConnect(TCPNameToIP($server),$port)

Should I modify this line in order for it to work for an HTTP Proxy. I am using an HTTP Proxy at Port 8080. Do I have to do everything what you have just said. I just want to implement it in your PM Example. Internet connection at work requires an HTTP Proxy.

Thanks,

geocine

The socket in question is only used by the YMSG/TCP protocol (For Yahoo Pager and Chat) - not HTTP. This will most likely require a SOCKS or other type of proxy.

The WinHTTP object handles all of the HTTP connections made in the examples (Login/Authentication and CAPTCHA requests/responses)

- Please use the above post I made to configure the WinHTTP object to use a proxy server.

If you wait long enough I may make a version of the Chat Client with full proxy support - but don't let me stop you from researching/trying it yourself.

My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...