adium.1-3: 2c3117ae: pidgin-facebookchat at r646

zacw at adiumx.com zacw at adiumx.com
Wed Aug 19 21:17:42 EDT 2009


-----------------------------------------------------------------
Revision: 2c3117aeed7d2eea968ea1f5d0b5db8eb0dd3bd9
Ancestor: 8b18fb3333bff7877236c43a6da78fa7a66362bc
Author: zacw at adiumx.com
Date: 2009-08-20T01:10:47
Branch: im.pidgin.adium.1-3
URL: http://d.pidgin.im/viewmtn/revision/info/2c3117aeed7d2eea968ea1f5d0b5db8eb0dd3bd9

Modified files:
        libpurple/protocols/facebook/fb_blist.c
        libpurple/protocols/facebook/fb_connection.c
        libpurple/protocols/facebook/fb_conversation.c
        libpurple/protocols/facebook/fb_managefriends.c
        libpurple/protocols/facebook/fb_messages.c
        libpurple/protocols/facebook/fb_notifications.c
        libpurple/protocols/facebook/fb_util.c
        libpurple/protocols/facebook/fb_util.h
        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 r646


-------------- next part --------------
============================================================
--- libpurple/protocols/facebook/fb_blist.c	4bba8ded502f2a2210836c692c63af63ba0abcd0
+++ libpurple/protocols/facebook/fb_blist.c	13096220516c9de76237d53a5a0b21d9663f6bd5
@@ -125,7 +125,7 @@ static gboolean process_buddy_status(Fac
 		const gchar *status_time_text;
 
 		status_time_text = json_node_get_string(
-			json_object_get_member(userInfo, "statusTimeRel"));
+				json_object_get_member(userInfo, "statusTimeRel"));
 		status_text = fb_strdup_withhtml(json_node_get_string(
 				json_object_get_member(userInfo, "status")));
 
@@ -177,8 +177,8 @@ static void process_buddy_icon(FacebookA
 	fbuddy = buddy->proto_data;
 	
 	/* Set the buddy icon (if it hasn't changed) */
-	buddy_icon_url = json_node_dup_string(json_object_get_member(
-			userInfo, "thumbSrc"));
+	buddy_icon_url = g_strdup(json_node_get_string(json_object_get_member(
+			userInfo, "thumbSrc")));
 	if (fbuddy->thumb_url == NULL ||
 	    !g_str_equal(fbuddy->thumb_url, buddy_icon_url))
 	{
@@ -350,33 +350,37 @@ static void got_buddy_list_cb(FacebookAc
 				fba->pc,
 				PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 				error);
-			g_object_unref(parser);
+			json_parser_free(parser);
 			return;
 	}
 	
 	/* look for "userInfos":{ ... }, */
 	if (!json_object_has_member(objnode, "payload"))
 	{
-		g_object_unref(parser);
+		json_parser_free(parser);
 		return;
 	}
 	objnode = json_node_get_object(json_object_get_member(
 			objnode, "payload"));
 	if (!json_object_has_member(objnode, "buddy_list"))
 	{
-		g_object_unref(parser);
+		json_parser_free(parser);
 		return;
 	}
 	JsonObject *buddy_list = json_node_get_object(json_object_get_member(
 			objnode, "buddy_list"));
 	if (!json_object_has_member(buddy_list, "userInfos"))
 	{
-		g_object_unref(parser);
+		json_parser_free(parser);
 		return;
 	}
-
-	fb_process_friend_lists(fba, buddy_list);
-
+	
+	if (purple_account_get_bool(fba->account, "facebook_use_groups", TRUE))
+	{
+		//Only process if we have the setting
+		fb_process_friend_lists(fba, buddy_list);
+	}
+	
 	// Iterate through the list of buddy infos sent to us.	
 	JsonObject *userInfos;
 	JsonObject *nowAvailableList;
@@ -422,7 +426,7 @@ static void got_buddy_list_cb(FacebookAc
 	process_notifications(fba, json_node_get_object(
 		json_object_get_member(objnode, "notifications")));
 
-	g_object_unref(parser);
+	json_parser_free(parser);
 }
 
 gboolean fb_get_buddy_list(gpointer data)
============================================================
--- libpurple/protocols/facebook/fb_connection.c	557b8518d7576ae548b710f016cbca9d3f76f606
+++ libpurple/protocols/facebook/fb_connection.c	df49a2d2b12155149fe59498282cc0a17adbe6f9
@@ -23,6 +23,7 @@ static void fb_attempt_connection(Facebo
 static void fb_attempt_connection(FacebookConnection *);
 
 #ifdef HAVE_ZLIB
+#include <zlib.h>
 
 static gchar *fb_gunzip(const guchar *gzip_data, ssize_t *len_ptr)
 {
============================================================
--- libpurple/protocols/facebook/fb_conversation.c	c7a209ce60af9d7660eeceecb1941275fe47bbe1
+++ libpurple/protocols/facebook/fb_conversation.c	8c4a8888a113ce29b70b943c33512e4f54983d97
@@ -21,9 +21,8 @@
 #include "fb_conversation.h"
 #include "fb_connection.h"
 #include "fb_util.h"
+#include "fb_json.h"
 
-#include <json-glib/json-glib.h>
-
 #include "conversation.h"
 #include "signals.h"
 
@@ -141,9 +140,9 @@ static void fb_history_fetch_cb(Facebook
 			gchar *to;
 			JsonObject *text_obj;
 
-			from = g_strdup_printf("%d", json_node_get_int(
+			from = g_strdup_printf("%" G_GINT64_FORMAT, json_node_get_int(
 				json_object_get_member(message_obj, "from")));
-			to = g_strdup_printf("%d", json_node_get_int(
+			to = g_strdup_printf("%" G_GINT64_FORMAT, json_node_get_int(
 				json_object_get_member(message_obj, "to")));
 
 			text_obj = json_node_get_object(
@@ -168,7 +167,7 @@ static void fb_history_fetch_cb(Facebook
 		}
 	}
 	
-	g_object_unref(parser);
+	json_parser_free(parser);
 }
 
 void fb_history_fetch(FacebookAccount *fba, const char *who,
============================================================
--- libpurple/protocols/facebook/fb_managefriends.c	1d9f2f9e32feef9aa049321c952ab8cb205f1162
+++ libpurple/protocols/facebook/fb_managefriends.c	372e3781799c1dbca5671830f39567e0b1283b6d
@@ -76,7 +76,7 @@ static void fb_check_friend_request_cb(F
 static void fb_check_friend_request_cb(FacebookAccount *fba, gchar *data,
 		gsize data_len, gpointer user_data)
 {
-	const char *uid_pre_text = "class=\"confirm\" id=\"friend_add_";
+	const char *uid_pre_text = "class=\"confirm\" id=\"friend_connect_";
 	const char *name_pre_text = "<td class=\"info\"><a ";
 	const char *msg_pre_text = "<div class=\"personal_msg\"><span>";
 	gchar *uid;
============================================================
--- libpurple/protocols/facebook/fb_messages.c	09b6b82775e77886d5aff74654063c9f70e7e7fb
+++ libpurple/protocols/facebook/fb_messages.c	5e169ad1f7317b6d6d259a02cae23575f5600247
@@ -102,8 +102,8 @@ static void parse_new_messages(PurpleCon
 		JsonObject *object = json_node_get_object(json_array_get_element(messages, i));
 		type = json_node_get_string(json_object_get_member(object, "type"));
 
-		from = g_strdup_printf("%d", json_node_get_int(json_object_get_member(object, "from")));
-		to = g_strdup_printf("%d", json_node_get_int(json_object_get_member(object, "to")));
+		from = g_strdup_printf("%" G_GINT64_FORMAT, json_node_get_int(json_object_get_member(object, "from")));
+		to = g_strdup_printf("%" G_GINT64_FORMAT, json_node_get_int(json_object_get_member(object, "to")));
 		
 		/* Use the in-line buddy name if the buddy list hasn't been downloaded yet */
 		buddy = purple_find_buddy(pc->account, from);
@@ -232,7 +232,7 @@ static void got_new_messages(FacebookAcc
 
 			/* refresh means that the channel is invalid */
 			fb_reconnect(fba);
-			g_object_unref(parser);
+			json_parser_free(parser);
 			return;
 		} else if (g_str_equal(command, "continue")) {
 			/* continue means that the server wants us to remake the connection.
@@ -243,7 +243,7 @@ static void got_new_messages(FacebookAcc
 		}
 	}
 
-	g_object_unref(parser);
+	json_parser_free(parser);
 
 	/* Continue looping, waiting for more messages */
 	fb_get_new_messages(fba);
@@ -329,7 +329,7 @@ static void fb_send_im_cb(FacebookAccoun
 		{
 			msg->resend_timer = purple_timeout_add_seconds(1, (GSourceFunc)fb_resend_im_fom, msg);
 			fba->resending_messages = g_slist_prepend(fba->resending_messages, msg);
-			g_object_unref(parser);
+			json_parser_free(parser);
 			return;
 		}
 		else
@@ -343,7 +343,7 @@ static void fb_send_im_cb(FacebookAccoun
 		g_hash_table_remove(fba->sent_messages_hash, msg->message);
 	}
 
-	g_object_unref(parser);
+	json_parser_free(parser);
 	fb_msg_destroy(msg);
 }
 
@@ -433,7 +433,7 @@ void got_reconnect_json(FacebookAccount 
 		purple_connection_error_reason(fba->pc,
 				PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 				_("Error fetching channel; did you log in elsewhere?"));
-		g_object_unref(parser);
+		json_parser_free(parser);
 		return;
 	}
 	
@@ -449,7 +449,7 @@ void got_reconnect_json(FacebookAccount 
 	 * waiting for messages
 	 */
 	fb_get_new_messages(fba);
-	g_object_unref(parser);
+	json_parser_free(parser);
 }
 
 gboolean fb_reconnect(FacebookAccount *fba)
============================================================
--- libpurple/protocols/facebook/fb_notifications.c	ca23fe8908d98aa815fb521ef82a9c2937652dae
+++ libpurple/protocols/facebook/fb_notifications.c	4dfffc8a8452bc56f856c94b2dec1e27d6287ca4
@@ -23,6 +23,7 @@ static void fb_got_notifications_cb(Face
 
 static void fb_got_notifications_cb(FacebookAccount *fba, gchar *url_text, gsize len, gpointer userdata)
 {
+	gchar *salvaged;
 	time_t last_fetch_time;
 	time_t time_of_message;
 	time_t newest_message = 0;
@@ -41,18 +42,26 @@ static void fb_got_notifications_cb(Face
 	last_fetch_time = purple_account_get_int(fba->account, "facebook_notifications_last_fetch", 0);
 	/* purple_debug_info("facebook", "last fetch time: %zu\n", last_fetch_time); */
 
-	xmlnode *rss_root = xmlnode_from_str(url_text, len);
+	salvaged = purple_utf8_salvage(url_text);
+	xmlnode *rss_root = xmlnode_from_str(salvaged, -1);
+	g_free(salvaged);
 	if (rss_root == NULL)
 	{
+		purple_debug_error("facebook", "Could not load RSS file\n");
 		return;
 	}
 	xmlnode *channel = xmlnode_get_child(rss_root, "channel");
 	if (channel == NULL)
 	{
+		purple_debug_warning("facebook", "Invalid RSS feed\n");
 		xmlnode_free(rss_root);
 		return;
 	}
 	xmlnode *item = xmlnode_get_child(channel, "item");
+	if (item == NULL)
+	{
+		purple_debug_info("facebook", "No new notifications\n");
+	}
 	for (; item != NULL; item = xmlnode_get_next_twin(item))
 	{
 		xmlnode *pubDate = xmlnode_get_child(item, "pubDate");
============================================================
--- libpurple/protocols/facebook/fb_util.c	094060765df4b0671d66097a7ad6bfc0e1e87650
+++ libpurple/protocols/facebook/fb_util.c	8ddff7af209527eb1c9a4c04c27ddccf0d3a01b0
@@ -142,7 +142,7 @@ JsonParser *fb_get_parser(const gchar *d
 
 	parser = json_parser_new();
 	if (!json_parser_load_from_data(parser, data, -1, NULL)) {
-		g_object_unref(parser);
+		json_parser_free(parser);
 		return NULL;
 	}
 
============================================================
--- libpurple/protocols/facebook/fb_util.h	53baf5d5d5678ff04dc221e8d629b56d3f3a67f5
+++ libpurple/protocols/facebook/fb_util.h	9020d025525bf359be4dd1dc66478bf14a9250c7
@@ -22,7 +22,7 @@
 #define FACEBOOK_UTIL_H
 
 #include "libfacebook.h"
-#include <json-glib/json-glib.h>
+#include "fb_json.h"
 
 JsonParser *fb_get_parser(const gchar *data, gsize data_len);
 JsonObject *fb_get_json_object(JsonParser *parser, char **error_message);
============================================================
--- libpurple/protocols/facebook/libfacebook.c	83c57c5d42dc61b5fafa9b38bd25fd3e2773b20c
+++ libpurple/protocols/facebook/libfacebook.c	447422b0f0485ea215b57f80293182de67dfcc2e
@@ -667,7 +667,14 @@ static void plugin_init(PurplePlugin *pl
 	prpl_info->protocol_options = g_list_append(
 		prpl_info->protocol_options, option);
 
+	
 	option = purple_account_option_bool_new(
+		_("Use Facebook friend-lists as Pidgin groups"),
+		"facebook_use_groups", TRUE);
+	prpl_info->protocol_options = g_list_append(
+		prpl_info->protocol_options, option);
+	
+	option = purple_account_option_bool_new(
 		_("Hide myself in the Buddy List"),
 		"facebook_hide_self", TRUE);
 	prpl_info->protocol_options = g_list_append(
@@ -684,6 +691,12 @@ static void plugin_init(PurplePlugin *pl
 		"facebook_get_notifications", TRUE);
 	prpl_info->protocol_options = g_list_append(
 		prpl_info->protocol_options, option);
+	
+	option = purple_account_option_string_new(
+		_("Notifications RSS Feed URL"),
+		"notifications_feed_url", "");
+	prpl_info->protocol_options = g_list_append(
+		prpl_info->protocol_options, option);
 
 	option = purple_account_option_bool_new(
 		_("Edit Facebook friends from Pidgin"),
============================================================
--- libpurple/protocols/facebook/libfacebook.h	dbc2bfd413ba1089196a55882771e37b6da1bc35
+++ libpurple/protocols/facebook/libfacebook.h	b7634eccfe4ac79928e153d73436504d5c15b020
@@ -67,10 +67,6 @@
 #include "sslconn.h"
 #include "version.h"
 
-#ifdef HAVE_ZLIB
-#	include <zlib.h>
-#endif
-
 #if GLIB_MAJOR_VERSION >= 2 && GLIB_MINOR_VERSION >= 12
 #	define atoll(a) g_ascii_strtoll(a, NULL, 0)
 #endif
============================================================
--- libpurple/protocols/facebook/pidgin-facebookchat.rc	1254a3c5068a1788a466179ff715a73c2a695c6b
+++ libpurple/protocols/facebook/pidgin-facebookchat.rc	78abadafda8864721a2d0249a7710578eaba4cc2
@@ -1,7 +1,7 @@ 1 VERSIONINFO
 
 1 VERSIONINFO
-FILEVERSION 1,53,0,0
-PRODUCTVERSION 1,53,0,0
+FILEVERSION 1,60,0,0
+PRODUCTVERSION 1,60,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.53\0"
-		VALUE "ProductVersion", "1.53\0"
+		VALUE "FileVersion", "1.60\0"
+		VALUE "ProductVersion", "1.60\0"
 		VALUE "InternalName", "pidgin-facebookchat\0"
 		VALUE "OriginalFilename", "libfacebook.dll\0"
 		VALUE "Comments", "http://pidgin-facebookchat.googlecode.com/\0"
============================================================
--- libpurple/protocols/facebook/rss.xml	29d247d04bd14b07d08d4df36a5456c2d89400bf
+++ libpurple/protocols/facebook/rss.xml	40100d174f1ed87fdc64698421454ee9d4991879
@@ -13,6 +13,18 @@
 			<width>48</width><height>48</height>
 		</image>
 		<item>
+			<title>Version 1.60</title>
+			<link>http://code.google.com/p/pidgin-facebookchat/issues/detail?id=24#c48</link>
+			<description><![CDATA[Hi all, sorry for the recent weirdness with the plugin.  v1.60 is out which addresses the major bit of these problems.<br/>
+			Changelog:<br/>
+			<a href="http://code.google.com/p/pidgin-facebookchat/wiki/Changelog">http://code.google.com/p/pidgin-facebookchat/wiki/Changelog</a><br/>
+			Download:<br/>
+			<a href="http://code.google.com/p/pidgin-facebookchat/downloads/list">http://code.google.com/p/pidgin-facebookchat/downloads/list</a><br/>
+			(apologies to you RSS readers out there who missed out on v1.54)]]></description>
+			<pubDate>Fri, 17 July 2009 22:05:20 +1200</pubDate>
+			<guid isPermaLink="true">http://code.google.com/p/pidgin-facebookchat/issues/detail?id=24#c48</guid>
+		</item>
+		<item>
 			<title>Version 1.53</title>
 			<link>http://code.google.com/p/pidgin-facebookchat/issues/detail?id=24#c46</link>
 			<description><![CDATA[<a href="http://www.pidgin.im">Pidgin 2.5.8</a> is available and so is 1.53 of pidgin-facebookchat.


More information about the Commits mailing list