/soc/2015/jgeboski/facebook: 914c79d327a9: facebook: only handle...
James Geboski
jgeboski at gmail.com
Sat Aug 15 21:21:22 EDT 2015
Changeset: 914c79d327a91bf84eb7e3721a71f8a9549e961b
Author: James Geboski <jgeboski at gmail.com>
Date: 2015-08-15 21:11 -0400
Branch: facebook
URL: https://hg.pidgin.im/soc/2015/jgeboski/facebook/rev/914c79d327a9
Description:
facebook: only handle signals for the Facebook protocol
diffstat:
libpurple/protocols/facebook/facebook.c | 16 ++++++++++++++--
libpurple/protocols/facebook/facebook.h | 7 +++++++
2 files changed, 21 insertions(+), 2 deletions(-)
diffs (73 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
@@ -674,13 +674,16 @@ fb_cb_conv_updated(PurpleConversation *c
gpointer data)
{
const gchar *name;
+ const gchar *pid;
FbData *fata = data;
gchar *tname;
PurpleAccount *acct;
acct = purple_conversation_get_account(conv);
+ pid = purple_account_get_protocol_id(acct);
if ((type == PURPLE_CONVERSATION_UPDATE_UNSEEN) &&
+ purple_strequal(pid, FB_PROTOCOL_ID) &&
purple_account_get_bool(acct, "mark-read", TRUE))
{
/* Use event loop for purple_conversation_has_focus() */
@@ -695,8 +698,17 @@ static void
fb_cb_conv_deleting(PurpleConversation *conv, gpointer data)
{
const gchar *name;
+ const gchar *pid;
FbData *fata = data;
gchar *tname;
+ PurpleAccount *acct;
+
+ acct = purple_conversation_get_account(conv);
+ pid = purple_account_get_protocol_id(acct);
+
+ if (!purple_strequal(pid, FB_PROTOCOL_ID)) {
+ return;
+ }
name = purple_conversation_get_name(conv);
tname = g_strconcat("conv-read-", name, NULL);
@@ -1327,7 +1339,7 @@ facebook_protocol_init(PurpleProtocol *p
GList *opts = NULL;
PurpleAccountOption *opt;
- protocol->id = "prpl-facebook";
+ protocol->id = FB_PROTOCOL_ID;
protocol->name = "Facebook";
protocol->options = OPT_PROTO_CHAT_TOPIC;
@@ -1463,7 +1475,7 @@ static PurplePluginInfo *
plugin_query(GError **error)
{
return purple_plugin_info_new(
- "id", "prpl-facebook",
+ "id", FB_PROTOCOL_ID,
"name", "Facebook Protocol",
"version", DISPLAY_VERSION,
"category", N_("Protocol"),
diff --git a/libpurple/protocols/facebook/facebook.h b/libpurple/protocols/facebook/facebook.h
--- a/libpurple/protocols/facebook/facebook.h
+++ b/libpurple/protocols/facebook/facebook.h
@@ -40,6 +40,13 @@
#define FACEBOOK_IS_PROTOCOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), FACEBOOK_TYPE_PROTOCOL))
#define FACEBOOK_PROTOCOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), FACEBOOK_TYPE_PROTOCOL, FacebookProtocolClass))
+/**
+ * FB_PROTOCOL_ID:
+ *
+ * The Facebook protocol identifier.
+ */
+#define FB_PROTOCOL_ID "prpl-facebook"
+
typedef struct _FacebookProtocol FacebookProtocol;
typedef struct _FacebookProtocolClass FacebookProtocolClass;
More information about the Commits
mailing list