/soc/2013/ankitkv/gobjectification: 465f02116328: Refactored acc...
Ankit Vani
a at nevitus.org
Sat Sep 14 06:26:05 EDT 2013
Changeset: 465f0211632815d0881427d04a2be9329ce3e12a
Author: Ankit Vani <a at nevitus.org>
Date: 2013-09-14 15:55 +0530
Branch: soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/465f02116328
Description:
Refactored account, blistnodetypes, buddylist, connection to use the new protocol interfaces
diffstat:
libpurple/account.c | 15 +++++++--------
libpurple/blistnodetypes.c | 4 ++--
libpurple/buddylist.c | 2 +-
libpurple/connection.c | 4 ++--
libpurple/protocol.h | 6 +++---
5 files changed, 15 insertions(+), 16 deletions(-)
diffs (124 lines):
diff --git a/libpurple/account.c b/libpurple/account.c
--- a/libpurple/account.c
+++ b/libpurple/account.c
@@ -1012,7 +1012,7 @@ purple_account_set_public_alias(PurpleAc
gc = purple_account_get_connection(account);
protocol = purple_connection_get_protocol(gc);
- if (PURPLE_PROTOCOL_IMPLEMENTS(protocol, set_public_alias))
+ if (PURPLE_PROTOCOL_IMPLEMENTS(protocol, SERVER_IFACE, set_public_alias))
purple_protocol_server_iface_set_public_alias(protocol, gc, alias, success_cb, failure_cb);
else if (failure_cb) {
struct public_alias_closure *closure =
@@ -1050,7 +1050,7 @@ purple_account_get_public_alias(PurpleAc
gc = purple_account_get_connection(account);
protocol = purple_connection_get_protocol(gc);
- if (PURPLE_PROTOCOL_IMPLEMENTS(protocol, get_public_alias))
+ if (PURPLE_PROTOCOL_IMPLEMENTS(protocol, SERVER_IFACE, get_public_alias))
purple_protocol_server_iface_get_public_alias(protocol, gc, success_cb, failure_cb);
else if (failure_cb) {
struct public_alias_closure *closure =
@@ -2232,9 +2232,9 @@ purple_account_add_buddies(PurpleAccount
groups = g_list_append(groups, purple_buddy_get_group(buddy));
}
- if (PURPLE_PROTOCOL_IMPLEMENTS(protocol, add_buddies))
+ if (PURPLE_PROTOCOL_IMPLEMENTS(protocol, SERVER_IFACE, add_buddies))
purple_protocol_server_iface_add_buddies(protocol, gc, buddies, groups, message);
- else if (PURPLE_PROTOCOL_IMPLEMENTS(protocol, add_buddy)) {
+ else if (PURPLE_PROTOCOL_IMPLEMENTS(protocol, SERVER_IFACE, add_buddy)) {
GList *curb = buddies, *curg = groups;
while ((curb != NULL) && (curg != NULL)) {
@@ -2272,7 +2272,7 @@ purple_account_remove_buddies(PurpleAcco
protocol = purple_connection_get_protocol(gc);
if (protocol) {
- if (PURPLE_PROTOCOL_IMPLEMENTS(protocol, remove_buddies))
+ if (PURPLE_PROTOCOL_IMPLEMENTS(protocol, SERVER_IFACE, remove_buddies))
purple_protocol_server_iface_remove_buddies(protocol, gc, buddies, groups);
else {
GList *curb = buddies;
@@ -2878,9 +2878,8 @@ purple_account_constructed(GObject *obje
return;
}
- if (PURPLE_PROTOCOL_IMPLEMENTS(protocol, status_types))
- purple_account_set_status_types(account,
- purple_protocol_class_status_types(protocol, account));
+ purple_account_set_status_types(account,
+ purple_protocol_class_status_types(protocol, account));
priv->presence = PURPLE_PRESENCE(purple_account_presence_new(account));
diff --git a/libpurple/blistnodetypes.c b/libpurple/blistnodetypes.c
--- a/libpurple/blistnodetypes.c
+++ b/libpurple/blistnodetypes.c
@@ -1119,7 +1119,7 @@ const char *purple_chat_get_name_only(Pu
protocol = purple_protocols_find(purple_account_get_protocol_id(priv->account));
- if (PURPLE_PROTOCOL_IMPLEMENTS(protocol, chat_info)) {
+ if (PURPLE_PROTOCOL_IMPLEMENTS(protocol, CHAT_IFACE, info)) {
PurpleProtocolChatEntry *pce;
GList *parts = purple_protocol_chat_iface_info(protocol, purple_account_get_connection(priv->account));
pce = parts->data;
@@ -1531,7 +1531,7 @@ void purple_group_set_name(PurpleGroup *
buddies = g_list_append(buddies, (PurpleBlistNode *)buddy);
}
- if(PURPLE_PROTOCOL_IMPLEMENTS(protocol, rename_group)) {
+ if(PURPLE_PROTOCOL_IMPLEMENTS(protocol, SERVER_IFACE, rename_group)) {
purple_protocol_server_iface_rename_group(protocol, gc, old_name, source, buddies);
} else {
GList *cur, *groups = NULL;
diff --git a/libpurple/buddylist.c b/libpurple/buddylist.c
--- a/libpurple/buddylist.c
+++ b/libpurple/buddylist.c
@@ -1636,7 +1636,7 @@ purple_blist_find_chat(PurpleAccount *ac
protocol = purple_protocols_find(purple_account_get_protocol_id(account));
- if (PURPLE_PROTOCOL_IMPLEMENTS(protocol, find_blist_chat))
+ if (PURPLE_PROTOCOL_IMPLEMENTS(protocol, CLIENT_IFACE, find_blist_chat))
return purple_protocol_client_iface_find_blist_chat(protocol, account, name);
normname = g_strdup(purple_normalize(account, name));
diff --git a/libpurple/connection.c b/libpurple/connection.c
--- a/libpurple/connection.c
+++ b/libpurple/connection.c
@@ -132,7 +132,7 @@ update_keepalive(PurpleConnection *gc, g
g_return_if_fail(priv != NULL);
- if (!PURPLE_PROTOCOL_IMPLEMENTS(priv->protocol, keepalive))
+ if (!PURPLE_PROTOCOL_IMPLEMENTS(priv->protocol, SERVER_IFACE, keepalive))
return;
if (on && !priv->keepalive)
@@ -888,7 +888,7 @@ void
if (regist)
{
- if (!PURPLE_PROTOCOL_IMPLEMENTS(protocol, register_user))
+ if (!PURPLE_PROTOCOL_IMPLEMENTS(protocol, SERVER_IFACE, register_user))
return;
}
else
diff --git a/libpurple/protocol.h b/libpurple/protocol.h
--- a/libpurple/protocol.h
+++ b/libpurple/protocol.h
@@ -744,9 +744,9 @@ struct _PurpleProtocolFactoryIface
* Returns TRUE if a protocol implements a function in an interface,
* FALSE otherwise.
*/
-#define PURPLE_PROTOCOL_IMPLEMENTS(protocol, IFACENAME, func) \
- (PURPLE_PROTOCOL_HAS_##IFACENAME##_IFACE(protocol) && \
- PURPLE_PROTOCOL_GET_##IFACENAME##_IFACE(protocol)->func != NULL)
+#define PURPLE_PROTOCOL_IMPLEMENTS(protocol, IFACE, func) \
+ (PURPLE_PROTOCOL_HAS_##IFACE(protocol) && \
+ PURPLE_PROTOCOL_GET_##IFACE(protocol)->func != NULL)
G_BEGIN_DECLS
More information about the Commits
mailing list