pidgin/pidgin

609d20c56162
facebook: added an account option for self messages
--- a/libpurple/protocols/facebook/facebook.c Mon Dec 28 16:51:11 2015 -0500
+++ b/libpurple/protocols/facebook/facebook.c Mon Dec 28 17:54:37 2015 -0500
@@ -462,6 +462,7 @@
const gchar *text;
FbApiMessage *msg;
FbData *fata = data;
+ gboolean isself;
gboolean mark;
gboolean open;
gboolean self;
@@ -480,6 +481,7 @@
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 @@
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 @@
}
if (msg->tid == 0) {
- if (mark && !self) {
+ if (mark && !isself) {
fb_data_set_unread(fata, msg->uid, TRUE);
}
@@ -540,7 +547,7 @@
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 @@
"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);