/pidgin/main: 609d20c56162: facebook: added an account option fo...

James Geboski <[email protected]>
Newsgroups gmane.comp.gnome.gaim.cvs
Message-ID <[email protected]>
Changeset: 609d20c561629a67fc6094c87fa14fe8af998869
Author:	 James Geboski <[email protected]>
Date:	 2015-12-28 17:54 -0500
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/609d20c56162

Description:

facebook: added an account option for self messages

diffstat:

 libpurple/protocols/facebook/facebook.c |  19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)

diffs (64 lines):

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);
 		}
 
@@ -1406,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);

_______________________________________________
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.