/soc/2013/ankitkv/gobjectification: 1ce884985d2d: Refactored yah...
Ankit Vani
a at nevitus.org
Sun Sep 15 15:19:25 EDT 2013
Changeset: 1ce884985d2d7d6678dd2bb4886cb068506fff88
Author: Ankit Vani <a at nevitus.org>
Date: 2013-09-16 00:49 +0530
Branch: soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/1ce884985d2d
Description:
Refactored yahoo, zephyr to use the new protocol interfaces
diffstat:
libpurple/protocols/yahoo/yahoo.c | 145 +++++++++++++++++++++++++----------
libpurple/protocols/yahoo/yahoojp.c | 3 +-
libpurple/protocols/zephyr/zephyr.c | 73 ++++++++++++-----
3 files changed, 154 insertions(+), 67 deletions(-)
diffs (272 lines):
diff --git a/libpurple/protocols/yahoo/yahoo.c b/libpurple/protocols/yahoo/yahoo.c
--- a/libpurple/protocols/yahoo/yahoo.c
+++ b/libpurple/protocols/yahoo/yahoo.c
@@ -251,60 +251,117 @@ yahoo_protocol_init(PurpleProtocol *prot
static void
yahoo_protocol_class_init(PurpleProtocolClass *klass)
{
+ klass->login = yahoo_login;
+ klass->close = yahoo_close;
+ klass->status_types = yahoo_status_types;
+ klass->list_icon = yahoo_list_icon;
}
static void
yahoo_protocol_client_iface_init(PurpleProtocolClientIface *client_iface)
{
- client_iface->get_actions = yahoo_get_actions;
- client_iface->list_icon = yahoo_list_icon;
- client_iface->list_emblem = yahoo_list_emblem;
- client_iface->status_text = yahoo_status_text;
- client_iface->tooltip_text = yahoo_tooltip_text;
- client_iface->status_types = yahoo_status_types;
- client_iface->blist_node_menu = yahoo_blist_node_menu;
- client_iface->chat_info = yahoo_c_info;
- client_iface->chat_info_defaults = yahoo_c_info_defaults;
- client_iface->login = yahoo_login;
- client_iface->close = yahoo_close;
- client_iface->send_im = yahoo_send_im;
- client_iface->send_typing = yahoo_send_typing;
- client_iface->get_info = yahoo_get_info;
- client_iface->set_status = yahoo_set_status;
- client_iface->set_idle = yahoo_set_idle;
- client_iface->add_buddy = yahoo_add_buddy;
- client_iface->remove_buddy = yahoo_remove_buddy;
- client_iface->add_deny = yahoo_add_deny;
- client_iface->rem_deny = yahoo_rem_deny;
- client_iface->set_permit_deny = yahoo_set_permit_deny;
- client_iface->join_chat = yahoo_c_join;
- client_iface->get_chat_name = yahoo_get_chat_name;
- client_iface->chat_invite = yahoo_c_invite;
- client_iface->chat_leave = yahoo_c_leave;
- client_iface->chat_send = yahoo_c_send;
- client_iface->keepalive = yahoo_keepalive;
- client_iface->alias_buddy = yahoo_update_alias;
- client_iface->group_buddy = yahoo_change_buddys_group;
- client_iface->rename_group = yahoo_rename_group;
- client_iface->normalize = purple_normalize_nocase;
- client_iface->set_buddy_icon = yahoo_set_buddy_icon;
- client_iface->roomlist_get_list = yahoo_roomlist_get_list;
- client_iface->roomlist_cancel = yahoo_roomlist_cancel;
- client_iface->roomlist_expand_category = yahoo_roomlist_expand_category;
- client_iface->can_receive_file = yahoo_can_receive_file;
- client_iface->send_file = yahoo_send_file;
- client_iface->new_xfer = yahoo_new_xfer;
- client_iface->offline_message = yahoo_offline_message;
- client_iface->send_attention = yahoo_send_attention;
- client_iface->get_attention_types = yahoo_attention_types;
- client_iface->get_account_text_table = yahoo_get_account_text_table;
- client_iface->get_max_message_size = yahoo_get_max_message_size;
+ client_iface->get_actions = yahoo_get_actions;
+ client_iface->list_emblem = yahoo_list_emblem;
+ client_iface->status_text = yahoo_status_text;
+ client_iface->tooltip_text = yahoo_tooltip_text;
+ client_iface->blist_node_menu = yahoo_blist_node_menu;
+ client_iface->normalize = purple_normalize_nocase;
+ client_iface->offline_message = yahoo_offline_message;
+ client_iface->get_account_text_table = yahoo_get_account_text_table;
+ client_iface->get_max_message_size = yahoo_get_max_message_size;
+}
+
+static void
+yahoo_protocol_server_iface_init(PurpleProtocolServerIface *server_iface)
+{
+ server_iface->get_info = yahoo_get_info;
+ server_iface->set_status = yahoo_set_status;
+ server_iface->set_idle = yahoo_set_idle;
+ server_iface->add_buddy = yahoo_add_buddy;
+ server_iface->remove_buddy = yahoo_remove_buddy;
+ server_iface->keepalive = yahoo_keepalive;
+ server_iface->alias_buddy = yahoo_update_alias;
+ server_iface->group_buddy = yahoo_change_buddys_group;
+ server_iface->rename_group = yahoo_rename_group;
+ server_iface->set_buddy_icon = yahoo_set_buddy_icon;
+}
+
+static void
+yahoo_protocol_im_iface_init(PurpleProtocolIMIface *im_iface)
+{
+ im_iface->send = yahoo_send_im;
+ im_iface->send_typing = yahoo_send_typing;
+}
+
+static void
+yahoo_protocol_chat_iface_init(PurpleProtocolChatIface *chat_iface)
+{
+ chat_iface->info = yahoo_c_info;
+ chat_iface->info_defaults = yahoo_c_info_defaults;
+ chat_iface->join = yahoo_c_join;
+ chat_iface->get_name = yahoo_get_chat_name;
+ chat_iface->invite = yahoo_c_invite;
+ chat_iface->leave = yahoo_c_leave;
+ chat_iface->send = yahoo_c_send;
+}
+
+static void
+yahoo_protocol_privacy_iface_init(PurpleProtocolPrivacyIface *privacy_iface)
+{
+ privacy_iface->add_deny = yahoo_add_deny;
+ privacy_iface->rem_deny = yahoo_rem_deny;
+ privacy_iface->set_permit_deny = yahoo_set_permit_deny;
+}
+
+static void
+yahoo_protocol_roomlist_iface_init(PurpleProtocolRoomlistIface *roomlist_iface)
+{
+ roomlist_iface->get_list = yahoo_roomlist_get_list;
+ roomlist_iface->cancel = yahoo_roomlist_cancel;
+ roomlist_iface->expand_category = yahoo_roomlist_expand_category;
+}
+
+static void
+yahoo_protocol_attention_iface_init(PurpleProtocolAttentionIface *attention_iface)
+{
+ attention_iface->send = yahoo_send_attention;
+ attention_iface->get_types = yahoo_attention_types;
+}
+
+static void
+yahoo_protocol_xfer_iface_init(PurpleProtocolXferIface *xfer_iface)
+{
+ xfer_iface->can_receive = yahoo_can_receive_file;
+ xfer_iface->send = yahoo_send_file;
+ xfer_iface->new_xfer = yahoo_new_xfer;
}
PURPLE_DEFINE_TYPE_EXTENDED(
YahooProtocol, yahoo_protocol, PURPLE_TYPE_PROTOCOL, 0,
+
PURPLE_IMPLEMENT_INTERFACE_STATIC(PURPLE_TYPE_PROTOCOL_CLIENT_IFACE,
- yahoo_protocol_client_iface_init)
+ yahoo_protocol_client_iface_init)
+
+ PURPLE_IMPLEMENT_INTERFACE_STATIC(PURPLE_TYPE_PROTOCOL_SERVER_IFACE,
+ yahoo_protocol_server_iface_init)
+
+ PURPLE_IMPLEMENT_INTERFACE_STATIC(PURPLE_TYPE_PROTOCOL_IM_IFACE,
+ yahoo_protocol_im_iface_init)
+
+ PURPLE_IMPLEMENT_INTERFACE_STATIC(PURPLE_TYPE_PROTOCOL_CHAT_IFACE,
+ yahoo_protocol_chat_iface_init)
+
+ PURPLE_IMPLEMENT_INTERFACE_STATIC(PURPLE_TYPE_PROTOCOL_PRIVACY_IFACE,
+ yahoo_protocol_privacy_iface_init)
+
+ PURPLE_IMPLEMENT_INTERFACE_STATIC(PURPLE_TYPE_PROTOCOL_ROOMLIST_IFACE,
+ yahoo_protocol_roomlist_iface_init)
+
+ PURPLE_IMPLEMENT_INTERFACE_STATIC(PURPLE_TYPE_PROTOCOL_ATTENTION_IFACE,
+ yahoo_protocol_attention_iface_init)
+
+ PURPLE_IMPLEMENT_INTERFACE_STATIC(PURPLE_TYPE_PROTOCOL_XFER_IFACE,
+ yahoo_protocol_xfer_iface_init)
);
static PurplePluginInfo *
diff --git a/libpurple/protocols/yahoo/yahoojp.c b/libpurple/protocols/yahoo/yahoojp.c
--- a/libpurple/protocols/yahoo/yahoojp.c
+++ b/libpurple/protocols/yahoo/yahoojp.c
@@ -125,6 +125,7 @@ yahoojp_protocol_client_iface_init(Purpl
PURPLE_DEFINE_TYPE_EXTENDED(
YahooJPProtocol, yahoojp_protocol, YAHOO_TYPE_PROTOCOL, 0,
+
PURPLE_IMPLEMENT_INTERFACE_STATIC(PURPLE_TYPE_PROTOCOL_CLIENT_IFACE,
- yahoojp_protocol_client_iface_init)
+ yahoojp_protocol_client_iface_init)
);
diff --git a/libpurple/protocols/zephyr/zephyr.c b/libpurple/protocols/zephyr/zephyr.c
--- a/libpurple/protocols/zephyr/zephyr.c
+++ b/libpurple/protocols/zephyr/zephyr.c
@@ -2931,40 +2931,69 @@ zephyr_protocol_init(PurpleProtocol *pro
static void
zephyr_protocol_class_init(PurpleProtocolClass *klass)
{
+ klass->login = zephyr_login;
+ klass->close = zephyr_close;
+ klass->status_types = zephyr_status_types;
+ klass->list_icon = zephyr_list_icon;
}
static void
zephyr_protocol_client_iface_init(PurpleProtocolClientIface *client_iface)
{
- client_iface->get_actions = zephyr_get_actions;
- client_iface->list_icon = zephyr_list_icon;
- client_iface->status_types = zephyr_status_types;
- client_iface->chat_info = zephyr_chat_info;
- client_iface->login = zephyr_login;
- client_iface->close = zephyr_close;
- client_iface->send_im = zephyr_send_im;
- client_iface->send_typing = zephyr_send_typing;
- client_iface->get_info = zephyr_zloc;
- client_iface->set_status = zephyr_set_status;
- client_iface->join_chat = zephyr_join_chat;
- client_iface->get_chat_name = zephyr_get_chat_name;
- client_iface->chat_leave = zephyr_chat_leave;
- client_iface->chat_send = zephyr_chat_send;
- client_iface->normalize = zephyr_normalize;
- client_iface->set_chat_topic = zephyr_chat_set_topic;
- client_iface->find_blist_chat = zephyr_find_blist_chat;
-
- client_iface->set_info = NULL; /* XXX Location? */
- client_iface->set_buddy_icon = NULL; /* XXX */
- client_iface->get_cuser_real_name = NULL; /* XXX */
+ client_iface->get_actions = zephyr_get_actions;
+ client_iface->normalize = zephyr_normalize;
+ client_iface->find_blist_chat = zephyr_find_blist_chat;
+}
+
+
+static void
+zephyr_protocol_server_iface_init(PurpleProtocolServerIface *server_iface)
+{
+ server_iface->get_info = zephyr_zloc;
+ server_iface->set_status = zephyr_set_status;
+
+ server_iface->set_info = NULL; /* XXX Location? */
+ server_iface->set_buddy_icon = NULL; /* XXX */
+}
+
+
+static void
+zephyr_protocol_im_iface_init(PurpleProtocolIMIface *im_iface)
+{
+ im_iface->send = zephyr_send_im;
+ im_iface->send_typing = zephyr_send_typing;
+}
+
+
+static void
+zephyr_protocol_chat_iface_init(PurpleProtocolChatIface *chat_iface)
+{
+ chat_iface->info = zephyr_chat_info;
+ chat_iface->join = zephyr_join_chat;
+ chat_iface->get_name = zephyr_get_chat_name;
+ chat_iface->leave = zephyr_chat_leave;
+ chat_iface->send = zephyr_chat_send;
+ chat_iface->set_topic = zephyr_chat_set_topic;
+
+ chat_iface->get_user_real_name = NULL; /* XXX */
}
PURPLE_DEFINE_TYPE_EXTENDED(
ZephyrProtocol, zephyr_protocol, PURPLE_TYPE_PROTOCOL, 0,
+
PURPLE_IMPLEMENT_INTERFACE_STATIC(PURPLE_TYPE_PROTOCOL_CLIENT_IFACE,
- zephyr_protocol_client_iface_init)
+ zephyr_protocol_client_iface_init)
+
+ PURPLE_IMPLEMENT_INTERFACE_STATIC(PURPLE_TYPE_PROTOCOL_SERVER_IFACE,
+ zephyr_protocol_server_iface_init)
+
+ PURPLE_IMPLEMENT_INTERFACE_STATIC(PURPLE_TYPE_PROTOCOL_IM_IFACE,
+ zephyr_protocol_im_iface_init)
+
+ PURPLE_IMPLEMENT_INTERFACE_STATIC(PURPLE_TYPE_PROTOCOL_CHAT_IFACE,
+ zephyr_protocol_chat_iface_init)
);
More information about the Commits
mailing list