{"id":12,"date":"2009-04-23T14:08:48","date_gmt":"2009-04-23T02:08:48","guid":{"rendered":"http:\/\/eion.robbmob.com\/blog\/?p=12"},"modified":"2009-04-23T14:08:48","modified_gmt":"2009-04-23T02:08:48","slug":"reversing-skype","status":"publish","type":"post","link":"https:\/\/eion.robbmob.com\/blog\/2009\/04\/23\/reversing-skype\/","title":{"rendered":"Reversing Skype"},"content":{"rendered":"<p>So there&#8217;s a few things that the Skype API&#8217;s don&#8217;t provide which I needed in the Pidgin\/Adium\/libpurple plugins.  Thought I&#8217;d document them here in case other people want to do the same.<\/p>\n<p>One of the first hurdles I ran into was that on OSX, you need to link with the Skype.Framework bundle to access the Skype API commands.  Unfortunately, linking with non-GPL libraries is forbidden in the GPL so I set out to work out how and what it does to &#8216;talk&#8217; to Skype.  Turns out that OSX has a few different ways of &#8220;inter-process communication&#8221;, but there was only one way that used Carbon as well as Cocoa&#8230;  Long story short, I managed to work out that it was a CFNotificationCenter which was used to send\/receive messages.  So I created a debug function to see what the key\/value pairs that Skype.Framework sent to Skype and managed to work it all out.  It turned out that this reverse-engineering proved helpful for the Skype4Py team, who used it to get <a href=\"https:\/\/developer.skype.com\/wiki\/Skype4Py\" target=\"_blank\">Skype4Py<\/a> <a href=\"http:\/\/skype4py.svn.sourceforge.net\/viewvc\/skype4py\/Skype4Py\/API\/darwin.py?view=log\" target=\"_blank\">working on OSX<\/a>.  You too can use my GPL&#8217;d version of the framework at <a href=\"http:\/\/code.google.com\/p\/skype4pidgin\/source\/browse\/trunk\/skype_messaging_carbon2.c\" target=\"_blank\">http:\/\/code.google.com\/p\/skype4pidgin\/source\/browse\/trunk\/skype_messaging_carbon2.c<\/a><\/p>\n<p>The next problem was that I wanted to send\/receive typing notifications, but the Skype API didn&#8217;t provide any way of doing this.  In the end, I created an API app2app stream, called &#8220;libpurple_typing&#8221; which sends datagrams of &#8220;PURPLE_TYPING&#8221;, &#8220;PURPLE_NOT_TYPING&#8221; and &#8220;PURPLE_TYPED&#8221;, which directly relate to the libpurple typing notifications. \u00a0I haven&#8217;t seen any other Skype API wrappers (Trillian\/Miranda\/Fring) doing anything like this, but if I&#8217;m wrong let me know and I&#8217;ll get the plugin working with them. \u00a0Maybe all us 3rd parties can get together some day and agree on a common way of sending typing states. \ud83d\ude42<\/p>\n<p>Last thing I&#8217;ve managed to do was get avatars on platforms (Linux and until recently, OSX) that didn&#8217;t support the &#8220;GET AVATAR&#8221; api command. \u00a0Originally it was to get avatars for the SkypeNet (no-skype-needed) version of the plugin. \u00a0Turns out they were all stored in user{number}.dbb files, which are apparently Kazaa storage blobs. \u00a0Some kind of database that noone&#8217;s been able to work out. \u00a0From the looks of things now, Skype for Windows uses a SQLlite db for storage so this method won&#8217;t work there, but the way to find the avatar, is to loop through all the user*.dbb files and find the Skype username of the avatar in the file. \u00a0Then just skip ahead to a 0xFF,0xD8 block (header for a JPEG) and grab all the data up until 0xFF,0xD9. \u00a0If you hit 0x6C,0x33,0x33,0x6C (db entry boundary), you&#8217;ve gone too far.<\/p>\n<p>I guess the rest of the features that Skype don&#8217;t provide that I&#8217;m working on would be:<\/p>\n<ul>\n<li>Sending a file without using the Skype-provided file picker<\/li>\n<li>Accepting\/rejecting a file without opening Skype<\/li>\n<li>Automatic authorization of the plugin with Skype<\/li>\n<\/ul>\n<p>All the above features should allow the plugin to work without a Skype GUI using something like Finch, since these days not everyone has flash graphics stuff \ud83d\ude42<\/p>\n<p>Anyways. \u00a0 I hope that&#8217;s useful to other developers out there. \u00a0I had fun doing it \ud83d\ude42<\/p>\n<ul>\n<li><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>So there&#8217;s a few things that the Skype API&#8217;s don&#8217;t provide which I needed in the Pidgin\/Adium\/libpurple plugins. Thought I&#8217;d document them here in case other people want to do the same. One of the first hurdles I ran into was that on OSX, you need to link with the Skype.Framework bundle to access the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true},"categories":[3],"tags":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p3CEsE-c","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/eion.robbmob.com\/blog\/wp-json\/wp\/v2\/posts\/12"}],"collection":[{"href":"https:\/\/eion.robbmob.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/eion.robbmob.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/eion.robbmob.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/eion.robbmob.com\/blog\/wp-json\/wp\/v2\/comments?post=12"}],"version-history":[{"count":0,"href":"https:\/\/eion.robbmob.com\/blog\/wp-json\/wp\/v2\/posts\/12\/revisions"}],"wp:attachment":[{"href":"https:\/\/eion.robbmob.com\/blog\/wp-json\/wp\/v2\/media?parent=12"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/eion.robbmob.com\/blog\/wp-json\/wp\/v2\/categories?post=12"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/eion.robbmob.com\/blog\/wp-json\/wp\/v2\/tags?post=12"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}