adium.1-4: e59c5abd: pidgin-facebookchat at r685.

zacw at adiumx.com zacw at adiumx.com
Wed Nov 4 22:11:24 EST 2009


-----------------------------------------------------------------
Revision: e59c5abd1116b6983de532c1472bdbe8200a4e57
Ancestor: c5e6cb2f70bd0c4be7d7c77156262183cf0272c7
Author: zacw at adiumx.com
Date: 2009-11-05T03:08:18
Branch: im.pidgin.adium.1-4
URL: http://d.pidgin.im/viewmtn/revision/info/e59c5abd1116b6983de532c1472bdbe8200a4e57

Modified files:
        libpurple/protocols/facebook/facebook.nsi
        libpurple/protocols/facebook/fb_blist.c
        libpurple/protocols/facebook/fb_messages.c
        libpurple/protocols/facebook/libfacebook.c
        libpurple/protocols/facebook/libfacebook.h
        libpurple/protocols/facebook/pidgin-facebookchat.rc
        libpurple/protocols/facebook/rss.xml

ChangeLog: 

pidgin-facebookchat at r685.

-------------- next part --------------
============================================================
--- libpurple/protocols/facebook/facebook.nsi	27b05643b15daeeac1bff1585817edcc4e63db91
+++ libpurple/protocols/facebook/facebook.nsi	0a2bccf4de2f00e5527eac5cbc0facb8be28bf11
@@ -6,7 +6,7 @@ SetCompress off
 ; todo: SetBrandingImage
 ; HM NIS Edit Wizard helper defines
 !define PRODUCT_NAME "pidgin-facebookchat"
-!define PRODUCT_VERSION "1.61"
+!define PRODUCT_VERSION "1.62"
 !define PRODUCT_PUBLISHER "Eion Robb"
 !define PRODUCT_WEB_SITE "http://pidgin-facebookchat.googlecode.com/"
 !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
============================================================
--- libpurple/protocols/facebook/fb_blist.c	55a589254403723cac7bc7e62531ef9a5241e2a4
+++ libpurple/protocols/facebook/fb_blist.c	a26776243a31152e02bde9a0405a45db552c5121
@@ -498,8 +498,8 @@ gboolean fb_get_buddy_list(gpointer data
 	fba = data;
 
 	postdata = g_strdup_printf(
-			"user=%" G_GINT64_FORMAT "&popped_out=true&force_render=true&buddy_list=1&notifications=1",
-			fba->uid);
+			"user=%" G_GINT64_FORMAT "&popped_out=true&force_render=true&buddy_list=1&__a=1&post_form_id_source=AsyncRequest&post_form_id=%s&fb_dtsg=%s",
+			fba->uid, fba->post_form_id?fba->post_form_id:"(null)", fba->dtsg?fba->dtsg:"(null)");
 	fb_post_or_get(fba, FB_METHOD_POST, NULL, "/ajax/chat/buddy_list.php",
 			postdata, got_buddy_list_cb, NULL, FALSE);
 	g_free(postdata);
============================================================
--- libpurple/protocols/facebook/fb_messages.c	1b4165576e00b956a05890547ccc44abf85528a7
+++ libpurple/protocols/facebook/fb_messages.c	db485285cc61b901a8cfb8f38564c8d805dd7004
@@ -291,7 +291,7 @@ static gboolean fb_get_new_messages(Face
 
 	purple_debug_info("facebook", "getting new messages\n");
 
-	fetch_server = g_strdup_printf("%d.channel%s.facebook.com", 0, channel_number);
+	fetch_server = g_strdup_printf("%d.%s.facebook.com", 0, channel_number);
 	/* use the current time in the url to get past any transparent proxy caches */
 	fetch_url = g_strdup_printf("/x/%lu/%s/p_%" G_GINT64_FORMAT "=%d", (gulong)time(NULL), (fba->is_idle?"false":"true"), fba->uid, fba->message_fetch_sequence);
 
@@ -407,8 +407,6 @@ void got_reconnect_json(FacebookAccount 
 
 void got_reconnect_json(FacebookAccount *fba, gchar *data, gsize data_len, gpointer userdata)
 {
-	gchar *new_channel_number;
-	
 	JsonParser *parser;
 	JsonObject *objnode;
 
@@ -441,9 +439,8 @@ void got_reconnect_json(FacebookAccount 
 		return;
 	}
 	
-	new_channel_number = g_strdup(&new_channel_host[7]);
 	g_free(fba->channel_number);
-	fba->channel_number = new_channel_number;
+	fba->channel_number = g_strdup(new_channel_host);
 	
 	gint new_seq = json_node_get_int(json_object_get_member(payload, "seq"));
 	fba->message_fetch_sequence = new_seq;
@@ -458,7 +455,7 @@ gboolean fb_reconnect(FacebookAccount *f
 
 gboolean fb_reconnect(FacebookAccount *fba)
 {
-	gchar *url = g_strdup_printf("/ajax/presence/reconnect.php?reason=3&post_form_id=%s", fba->post_form_id);
+	gchar *url = g_strdup_printf("/ajax/presence/reconnect.php?reason=7&post_form_id=%s", fba->post_form_id);
 	fb_post_or_get(fba, FB_METHOD_GET, NULL, url, NULL, got_reconnect_json, NULL, FALSE);
 	g_free(url);
 	
@@ -468,7 +465,11 @@ static void got_form_id_page(FacebookAcc
 static void got_form_id_page(FacebookAccount *fba, gchar *data, gsize data_len, gpointer userdata)
 {
 	const gchar *start_text = "id=\"post_form_id\" name=\"post_form_id\" value=\"";
+	const gchar *dtsg_start = "fb_dtsg:\"";
+	const gchar *channel_start = "js\", \"channel";
+	const gchar *channel_start2 = "js\",\"channel";
 	gchar *post_form_id;
+	gchar *channel = NULL;
 	gchar *tmp = NULL;
 	
 	/* NULL data crashes on Windows */
@@ -488,17 +489,45 @@ static void got_form_id_page(FacebookAcc
 	}
 	tmp += strlen(start_text);
 	post_form_id = g_strndup(tmp, strchr(tmp, '"') - tmp);
-
+	
 	g_free(fba->post_form_id);
 	fba->post_form_id = post_form_id;
+	
+	tmp = g_strstr_len(data, data_len, dtsg_start);
+	if (tmp != NULL)
+	{
+		tmp += strlen(dtsg_start);
+		g_free(fba->dtsg);
+		fba->dtsg = g_strndup(tmp, strchr(tmp, '"') - tmp);
+	}
 
+	tmp = g_strstr_len(data, data_len, channel_start);
+	if (tmp != NULL)
+	{
+		tmp += 6;
+	} else {
+		tmp = g_strstr_len(data, data_len, channel_start2);
+		if (tmp != NULL)
+			tmp += 5;
+	}
+	if (tmp != NULL)
+	{
+		channel = g_strndup(tmp, strchr(tmp, '"') - tmp);
+		g_free(fba->channel_number);
+		fba->channel_number = channel;
+	}
 
 	tmp = g_strdup_printf("visibility=true&post_form_id=%s", post_form_id);
 	fb_post_or_get(fba, FB_METHOD_POST, "apps.facebook.com", "/ajax/chat/settings.php", tmp, NULL, NULL, FALSE);
 	g_free(tmp);
 	
-	/* Grab new channel number */
-	fb_reconnect(fba);
+	if (channel == NULL)
+	{
+		/* Grab new channel number */
+		fb_reconnect(fba);
+	} else {
+		fb_get_new_messages(fba);
+	}
 }
 
 gboolean fb_get_post_form_id(FacebookAccount *fba)
============================================================
--- libpurple/protocols/facebook/libfacebook.c	c79f5931a33700bcd827cbf76b222bef530e0a31
+++ libpurple/protocols/facebook/libfacebook.c	2d32ec731cd3af31e053880370477b39222df7fa
@@ -227,6 +227,8 @@ static void fb_login_cb(FacebookAccount 
 	
 	if (len && g_strstr_len(response, len, "captcha"))
 	{
+		purple_debug_info("facebook", "captcha page: %s\n", response);
+
 		purple_connection_update_progress(fba->pc, _("Handling Captcha"), 2, 4);
 		
 		const gchar *persist_data_start = "<input type=\"hidden\" id=\"captcha_persist_data\" name=\"captcha_persist_data\" value=\"";
@@ -259,6 +261,7 @@ static void fb_login_cb(FacebookAccount 
 		
 		if (!fba->extra_challenge || !fba->persist_data || !fba->captcha_session)
 		{
+			purple_debug_info("facebook", "captcha response: %s\n", response);
 			g_free(fba->extra_challenge);
 			g_free(fba->persist_data);
 			g_free(fba->captcha_session);
@@ -382,8 +385,10 @@ static void fb_login(PurpleAccount *acco
 	if (locale == NULL || g_str_equal(locale, "C"))
 		locale = "en_US";
 
+	g_hash_table_replace(fba->cookie_table, g_strdup("lsd"), g_strdup("abcde"));
+
 	postdata = g_strdup_printf(
-			"charset_test=%s&locale=%s&email=%s&pass=%s&pass_placeHolder=Password&persistent=1&login=Login&charset_test=%s",
+			"charset_test=%s&locale=%s&email=%s&pass=%s&pass_placeHolder=Password&persistent=1&login=Login&charset_test=%s&lsd=abcde",
 			encoded_charset_test, locale, encoded_username, encoded_password, encoded_charset_test);
 	g_free(encoded_username);
 	g_free(encoded_password);
@@ -488,6 +493,7 @@ static void fb_close(PurpleConnection *p
 	g_hash_table_destroy(fba->hostname_ip_cache);
 	g_hash_table_destroy(fba->auth_buddies);
 	g_free(fba->post_form_id);
+	g_free(fba->dtsg);
 	g_free(fba->channel_number);
 	g_free(fba->last_status_message);
 	g_free(fba->extra_challenge);
============================================================
--- libpurple/protocols/facebook/libfacebook.h	320fb4a16727ec862f67f3087ace1a23f7ea1ef2
+++ libpurple/protocols/facebook/libfacebook.h	b56c2baea512f6680c01f5ea2c85cbbab5f1f51d
@@ -21,7 +21,7 @@
 #ifndef LIBFACEBOOK_H
 #define LIBFACEBOOK_H
 
-#define FACEBOOK_PLUGIN_VERSION "1.61"
+#define FACEBOOK_PLUGIN_VERSION "1.62"
 #define FACEBOOK_PLUGIN_ID "prpl-bigbrownchunx-facebookim"
 #define FACEBOOK_CAPTCHA_SITE "6LezHAAAAAAAADqVjseQ3ctG3ocfQs2Elo1FTa_a"
 
@@ -110,6 +110,7 @@ struct _FacebookAccount {
 	gchar *captcha_session;
 	gint last_status_timestamp;
 	guint bad_buddy_list_count;
+	gchar *dtsg;
 };
 
 struct _FacebookBuddy {
============================================================
--- libpurple/protocols/facebook/pidgin-facebookchat.rc	df1d296b5f3e4af608710ac1adbc8bbe5d0bae04
+++ libpurple/protocols/facebook/pidgin-facebookchat.rc	9d0c53b057522ae3de5007d9121259ce641eb8f6
@@ -1,7 +1,7 @@ 1 VERSIONINFO
 
 1 VERSIONINFO
-FILEVERSION 1,61,0,0
-PRODUCTVERSION 1,61,0,0
+FILEVERSION 1,62,0,0
+PRODUCTVERSION 1,62,0,0
 FILEOS 0x40004 // VOS_NT_WINDOWS32
 FILETYPE 0x2 // VFT_DLL
 {
@@ -12,8 +12,8 @@ BLOCK "StringFileInfo"
 		VALUE "CompanyName", "Eion Robb\0"
 		VALUE "FileDescription",  "Facebook Chat plugin for Pidgin\0"
 		VALUE "ProductName", "pidgin-facebookchat\0"
-		VALUE "FileVersion", "1.61\0"
-		VALUE "ProductVersion", "1.61\0"
+		VALUE "FileVersion", "1.62\0"
+		VALUE "ProductVersion", "1.62\0"
 		VALUE "InternalName", "pidgin-facebookchat\0"
 		VALUE "OriginalFilename", "libfacebook.dll\0"
 		VALUE "Comments", "http://pidgin-facebookchat.googlecode.com/\0"
============================================================
--- libpurple/protocols/facebook/rss.xml	5307d58e8af5e6e4481d89e241d46b35b5baefde
+++ libpurple/protocols/facebook/rss.xml	baa5c5a1ad452cb3c2f2b341993062adf99d7f29
@@ -13,6 +13,18 @@
 			<width>48</width><height>48</height>
 		</image>
 		<item>
+			<title>Version 1.62</title>
+			<link>http://code.google.com/p/pidgin-facebookchat/issues/detail?id=24#c50</link>
+			<description><![CDATA[Some of you fancy people might have noticed that the plugin hasn't been doing too well over the last few hours.<br/>
+			Fortunately, I've been hard at work to quickly push out a new version.<br/>
+			<br/>
+			Grab it from<br/>
+			<a href="http://code.google.com/p/pidgin-facebookchat/wiki/Downloads">http://code.google.com/p/pidgin-facebookchat/wiki/Downloads</a><br/>
+			while it's still hot]]></description>
+			<pubDate>Wed, 4 November 2009 18:49:10 +1300</pubDate>
+			<guid isPermaLink="true">http://code.google.com/p/pidgin-facebookchat/issues/detail?id=24#c50</guid>
+		</item>
+		<item>
 			<title>Version 1.61</title>
 			<link>http://code.google.com/p/pidgin-facebookchat/issues/detail?id=24#c49</link>
 			<description><![CDATA[Against all odds, I've just put out a new version 1.61 of the plugin.  It should fix up the problems with messages arriving from weird numbers, but it also now requires version 0.7.6 of json-glib to work.  It might or might not also have the option to disable friends lists, depending on who you ask :)<br/><br/>


More information about the Commits mailing list