/pidgin/main: 849d12200039: merging

Gary Kramlich <[email protected]>
Newsgroups gmane.comp.gnome.gaim.cvs
Message-ID <[email protected]>
Changeset: 849d1220003907e755a53972f5c3a82e9c82349e
Author:	 Gary Kramlich <[email protected]>
Date:	 2015-12-28 21:56 -0600
Branch:	 replace-nm-with-gio
URL: https://hg.pidgin.im/pidgin/main/rev/849d12200039

Description:

merging

diffstat:

 libpurple/data/purple-3.pc.in           |   1 -
 libpurple/protocols/facebook/api.c      |  21 +++++++++++++--------
 libpurple/protocols/facebook/facebook.c |  27 ++++++++++++++++++++-------
 libpurple/protocols/facebook/http.c     |   4 ++--
 libpurple/protocols/facebook/mqtt.c     |   1 +
 5 files changed, 36 insertions(+), 18 deletions(-)

diffs (194 lines):

diff --git a/libpurple/data/purple-3.pc.in b/libpurple/data/purple-3.pc.in
--- a/libpurple/data/purple-3.pc.in
+++ b/libpurple/data/purple-3.pc.in
@@ -5,7 +5,6 @@ includedir=@includedir@/libpurple
 datarootdir=@datarootdir@
 datadir=@datadir@
 sysconfdir=@sysconfdir@
-gstreamer=@GSTREAMER_VER@
 
 plugindir=${libdir}/purple-@PURPLE_MAJOR_VERSION@
 
diff --git a/libpurple/protocols/facebook/api.c b/libpurple/protocols/facebook/api.c
--- a/libpurple/protocols/facebook/api.c
+++ b/libpurple/protocols/facebook/api.c
@@ -1941,8 +1941,10 @@ fb_api_cb_contacts(PurpleHttpConnection 
 {
 	const gchar *str;
 	FbApi *api = data;
+	FbApiPrivate *priv = api->priv;
 	FbApiUser *user;
 	FbHttpParams *prms;
+	FbId uid;
 	FbJsonValues *values;
 	gboolean complete;
 	gchar *writeid = NULL;
@@ -1959,10 +1961,10 @@ fb_api_cb_contacts(PurpleHttpConnection 
 	fb_json_values_add(values, FB_JSON_TYPE_STR, TRUE,
 	                   "$.graph_api_write_id");
 	fb_json_values_add(values, FB_JSON_TYPE_STR, TRUE,
+	                   "$.represented_profile.id");
+	fb_json_values_add(values, FB_JSON_TYPE_STR, TRUE,
 	                   "$.represented_profile.friendship_status");
 	fb_json_values_add(values, FB_JSON_TYPE_STR, TRUE,
-	                   "$.represented_profile.id");
-	fb_json_values_add(values, FB_JSON_TYPE_STR, TRUE,
 	                   "$.structured_name.text");
 	fb_json_values_add(values, FB_JSON_TYPE_STR, TRUE,
 	                   "$.hugePictureUrl.uri");
@@ -1972,17 +1974,20 @@ fb_api_cb_contacts(PurpleHttpConnection 
 	while (fb_json_values_update(values, &err)) {
 		g_free(writeid);
 		writeid = fb_json_values_next_str_dup(values, NULL);
+		count++;
+
+		str = fb_json_values_next_str(values, "0");
+		uid = FB_ID_FROM_STR(str);
 		str = fb_json_values_next_str(values, NULL);
-		count++;
-
-		if (!purple_strequal(str, "ARE_FRIENDS")) {
+
+		if (!purple_strequal(str, "ARE_FRIENDS") &&
+		    (uid != priv->uid))
+		{
 			continue;
 		}
 
 		user = fb_api_user_dup(NULL, FALSE);
-		str = fb_json_values_next_str(values, "0");
-
-		user->uid = FB_ID_FROM_STR(str);
+		user->uid = uid;
 		user->name = fb_json_values_next_str_dup(values, NULL);
 		user->icon = fb_json_values_next_str_dup(values, NULL);
 
diff --git a/libpurple/protocols/facebook/facebook.c b/libpurple/protocols/facebook/facebook.c
--- a/libpurple/protocols/facebook/facebook.c
+++ b/libpurple/protocols/facebook/facebook.c
@@ -462,6 +462,7 @@ fb_cb_api_messages(FbApi *api, GSList *m
 	const gchar *text;
 	FbApiMessage *msg;
 	FbData *fata = data;
+	gboolean isself;
 	gboolean mark;
 	gboolean open;
 	gboolean self;
@@ -480,6 +481,7 @@ fb_cb_api_messages(FbApi *api, GSList *m
 	acct = purple_connection_get_account(gc);
 	mark = purple_account_get_bool(acct, "mark-read", TRUE);
 	open = purple_account_get_bool(acct, "group-chat-open", TRUE);
+	self = purple_account_get_bool(acct, "show-self", TRUE);
 
 	for (l = msgs; l != NULL; l = l->next) {
 		msg = l->data;
@@ -492,8 +494,13 @@ fb_cb_api_messages(FbApi *api, GSList *m
 			continue;
 		}
 
-		self = (msg->flags & FB_API_MESSAGE_FLAG_SELF) != 0;
-		flags = self ? PURPLE_MESSAGE_SEND : PURPLE_MESSAGE_RECV;
+		isself = (msg->flags & FB_API_MESSAGE_FLAG_SELF) != 0;
+
+		if (isself && !self) {
+			continue;
+		}
+
+		flags = isself ? PURPLE_MESSAGE_SEND : PURPLE_MESSAGE_RECV;
 		tstamp = msg->tstamp / 1000;
 
 		if (msg->flags & FB_API_MESSAGE_FLAG_IMAGE) {
@@ -515,7 +522,7 @@ fb_cb_api_messages(FbApi *api, GSList *m
 		}
 
 		if (msg->tid == 0) {
-			if (mark && !self) {
+			if (mark && !isself) {
 				fb_data_set_unread(fata, msg->uid, TRUE);
 			}
 
@@ -540,7 +547,7 @@ fb_cb_api_messages(FbApi *api, GSList *m
 			id = purple_chat_conversation_get_id(chat);
 		}
 
-		if (mark && !self) {
+		if (mark && !isself) {
 			fb_data_set_unread(fata, msg->tid, TRUE);
 		}
 
@@ -584,6 +591,7 @@ fb_cb_api_thread(FbApi *api, FbApiThread
 {
 	FbApiUser *user;
 	FbData *fata = data;
+	gboolean active;
 	gchar tid[FB_ID_STRMAX];
 	gchar uid[FB_ID_STRMAX];
 	gint id;
@@ -598,8 +606,9 @@ fb_cb_api_thread(FbApi *api, FbApiThread
 	FB_ID_TO_STR(thrd->tid, tid);
 
 	chat = purple_conversations_find_chat_with_account(tid, acct);
+	active = (chat != NULL) && !purple_chat_conversation_has_left(chat);
 
-	if (chat == NULL) {
+	if (!active) {
 		chat = purple_serv_got_joined_chat(gc, id, tid);
 	}
 
@@ -617,7 +626,7 @@ fb_cb_api_thread(FbApi *api, FbApiThread
 			fb_buddy_add_nonfriend(acct, user);
 		}
 
-		purple_chat_conversation_add_user(chat, uid, NULL, 0, TRUE);
+		purple_chat_conversation_add_user(chat, uid, NULL, 0, active);
 	}
 }
 
@@ -1153,7 +1162,7 @@ fb_chat_join(PurpleConnection *gc, GHash
 	id = fb_id_hash(&tid);
 	chat = purple_conversations_find_chat(gc, id);
 
-	if (chat != NULL) {
+	if ((chat != NULL) && !purple_chat_conversation_has_left(chat)) {
 		purple_conversation_present(PURPLE_CONVERSATION(chat));
 		return;
 	}
@@ -1404,6 +1413,10 @@ facebook_protocol_init(PurpleProtocol *p
 	                                     "mark-read", TRUE);
 	opts = g_list_prepend(opts, opt);
 
+	opt = purple_account_option_bool_new(_("Show self messages"),
+	                                     "show-self", TRUE);
+	opts = g_list_prepend(opts, opt);
+
 	opt = purple_account_option_bool_new(_("Show unread messages"),
 	                                     "show-unread", TRUE);
 	opts = g_list_prepend(opts, opt);
diff --git a/libpurple/protocols/facebook/http.c b/libpurple/protocols/facebook/http.c
--- a/libpurple/protocols/facebook/http.c
+++ b/libpurple/protocols/facebook/http.c
@@ -152,11 +152,11 @@ fb_http_params_new_parse(const gchar *da
 	if (isurl) {
 		data = strchr(data, '?');
 
-		if (data++ == NULL) {
+		if (data == NULL) {
 			return params;
 		}
 
-		tail = strchr(data, '#');
+		tail = strchr(++data, '#');
 
 		if (tail != NULL) {
 			data = g_strndup(data, tail - data);
diff --git a/libpurple/protocols/facebook/mqtt.c b/libpurple/protocols/facebook/mqtt.c
--- a/libpurple/protocols/facebook/mqtt.c
+++ b/libpurple/protocols/facebook/mqtt.c
@@ -469,6 +469,7 @@ fb_mqtt_read(FbMqtt *mqtt, FbMqttMessage
 			}
 
 			if (!fb_mqtt_message_read_mid(msg, &mid)) {
+				g_free(str);
 				break;
 			}
 

_______________________________________________
Commits mailing list
[email protected]
https://pidgin.im/cgi-bin/mailman/listinfo/commits
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.