/soc/2013/ankitkv/gobjectification: 03d62b1660fc: Refactor code ...

Ankit Vani a at nevitus.org
Sun Jun 23 07:51:58 EDT 2013


Changeset: 03d62b1660fc552171b1b5701ffa7dfaf255c52f
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-06-23 17:20 +0530
Branch:	 soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/03d62b1660fc

Description:

Refactor code to remove conversation type from some instances of purple_conversations_find_with_account()

diffstat:

 finch/gntblist.c                        |   2 +-
 finch/gntconv.c                         |   2 +-
 finch/gntpounce.c                       |   4 +-
 libpurple/blist.c                       |   6 ++--
 libpurple/buddyicon.c                   |   6 ++--
 libpurple/ft.c                          |   4 +-
 libpurple/plugins/autoaccept.c          |   2 +-
 libpurple/plugins/psychic.c             |   2 +-
 libpurple/pounce.c                      |   2 +-
 libpurple/protocols/bonjour/jabber.c    |  16 +++++++-------
 libpurple/protocols/gg/confer.c         |   2 +-
 libpurple/protocols/irc/cmds.c          |   8 +++---
 libpurple/protocols/irc/msgs.c          |  36 ++++++++++++++++----------------
 libpurple/protocols/jabber/jabber.c     |   2 +-
 libpurple/protocols/jabber/message.c    |   2 +-
 libpurple/protocols/mxit/formcmds.c     |   2 +-
 libpurple/protocols/mxit/multimx.c      |   4 +-
 libpurple/protocols/myspace/myspace.c   |   4 +-
 libpurple/protocols/oscar/oscar.c       |   2 +-
 libpurple/protocols/sametime/sametime.c |   4 +-
 libpurple/protocols/silc/silc.c         |   4 +-
 libpurple/protocols/yahoo/libymsg.c     |  10 ++++----
 libpurple/protocols/zephyr/zephyr.c     |   4 +-
 libpurple/prpl.c                        |   2 +-
 libpurple/server.c                      |  12 +++++-----
 pidgin/gtkblist.c                       |   6 ++--
 pidgin/gtkconv.c                        |  12 +++++-----
 pidgin/gtkdialogs.c                     |   2 +-
 pidgin/gtkpounce.c                      |   4 +-
 pidgin/plugins/crazychat/cc_network.c   |   8 +++---
 pidgin/plugins/gevolution/gevo-util.c   |   2 +-
 pidgin/plugins/notify.c                 |   2 +-
 32 files changed, 90 insertions(+), 90 deletions(-)

diffs (truncated from 906 to 300 lines):

diff --git a/finch/gntblist.c b/finch/gntblist.c
--- a/finch/gntblist.c
+++ b/finch/gntblist.c
@@ -2791,7 +2791,7 @@ join_chat_select_cb(gpointer data, Purpl
 	/* Create a new conversation now. This will give focus to the new window.
 	 * But it's necessary to pretend that we left the chat, because otherwise
 	 * a new conversation window will pop up when we finally join the chat. */
-	if (!(conv = purple_conversations_find_with_account(PURPLE_CONV_TYPE_CHAT, name, account))) {
+	if (!(conv = purple_conversations_find_chat_with_account(name, account))) {
 		conv = purple_conversation_new(PURPLE_CONV_TYPE_CHAT, account, name);
 		purple_chat_conversation_left(PURPLE_CONV_CHAT(conv));
 	} else {
diff --git a/finch/gntconv.c b/finch/gntconv.c
--- a/finch/gntconv.c
+++ b/finch/gntconv.c
@@ -277,7 +277,7 @@ update_buddy_typing(PurpleAccount *accou
 	PurpleIMConversation *im = NULL;
 	char *title, *str;
 
-	conv = purple_conversations_find_with_account(PURPLE_CONV_TYPE_IM, who, account);
+	conv = purple_conversations_find_im_with_account(who, account);
 
 	if (!conv)
 		return;
diff --git a/finch/gntpounce.c b/finch/gntpounce.c
--- a/finch/gntpounce.c
+++ b/finch/gntpounce.c
@@ -801,7 +801,7 @@ pounce_cb(PurplePounce *pounce, PurplePo
 
 	if (purple_pounce_action_is_enabled(pounce, "open-window"))
 	{
-		if (!purple_conversations_find_with_account(PURPLE_CONV_TYPE_IM, pouncee, account))
+		if (!purple_conversations_find_im_with_account(pouncee, account))
 			purple_conversation_new(PURPLE_CONV_TYPE_IM, account, pouncee);
 	}
 
@@ -874,7 +874,7 @@ pounce_cb(PurplePounce *pounce, PurplePo
 
 		if (message != NULL)
 		{
-			conv = purple_conversations_find_with_account(PURPLE_CONV_TYPE_IM, pouncee, account);
+			conv = purple_conversations_find_im_with_account(pouncee, account);
 
 			if (conv == NULL)
 				conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, pouncee);
diff --git a/libpurple/blist.c b/libpurple/blist.c
--- a/libpurple/blist.c
+++ b/libpurple/blist.c
@@ -1036,7 +1036,7 @@ void purple_blist_alias_contact(PurpleCo
 	{
 		PurpleBuddy *buddy = (PurpleBuddy *)bnode;
 
-		conv = purple_conversations_find_with_account(PURPLE_CONV_TYPE_IM, buddy->name,
+		conv = purple_conversations_find_im_with_account(buddy->name,
 												   buddy->account);
 		if (conv)
 			purple_conversation_autoset_title(conv);
@@ -1115,7 +1115,7 @@ void purple_blist_alias_buddy(PurpleBudd
 	if (ops && ops->update)
 		ops->update(purplebuddylist, (PurpleBlistNode *)buddy);
 
-	conv = purple_conversations_find_with_account(PURPLE_CONV_TYPE_IM, buddy->name,
+	conv = purple_conversations_find_im_with_account(buddy->name,
 											   buddy->account);
 	if (conv)
 		purple_conversation_autoset_title(conv);
@@ -1157,7 +1157,7 @@ void purple_blist_server_alias_buddy(Pur
 	if (ops && ops->update)
 		ops->update(purplebuddylist, (PurpleBlistNode *)buddy);
 
-	conv = purple_conversations_find_with_account(PURPLE_CONV_TYPE_IM, buddy->name,
+	conv = purple_conversations_find_im_with_account(buddy->name,
 											   buddy->account);
 	if (conv)
 		purple_conversation_autoset_title(conv);
diff --git a/libpurple/buddyicon.c b/libpurple/buddyicon.c
--- a/libpurple/buddyicon.c
+++ b/libpurple/buddyicon.c
@@ -432,7 +432,7 @@ purple_buddy_icon_update(PurpleBuddyIcon
 		buddies = g_slist_delete_link(buddies, buddies);
 	}
 
-	conv = purple_conversations_find_with_account(PURPLE_CONV_TYPE_IM, username, account);
+	conv = purple_conversations_find_im_with_account(username, account);
 
 	if (conv != NULL)
 		purple_im_conversation_set_icon(PURPLE_CONV_IM(conv), icon_to_set);
@@ -884,7 +884,7 @@ purple_buddy_icons_node_set_custom_icon(
 
 			buddy = (PurpleBuddy *)child;
 
-			conv = purple_conversations_find_with_account(PURPLE_CONV_TYPE_IM, purple_buddy_get_name(buddy), purple_buddy_get_account(buddy));
+			conv = purple_conversations_find_im_with_account(purple_buddy_get_name(buddy), purple_buddy_get_account(buddy));
 			if (conv)
 				purple_conversation_update(conv, PURPLE_CONVERSATION_UPDATE_ICON);
 
@@ -896,7 +896,7 @@ purple_buddy_icons_node_set_custom_icon(
 	} else if (PURPLE_BLIST_NODE_IS_CHAT(node)) {
 		PurpleConversation *conv = NULL;
 
-		conv = purple_conversations_find_with_account(PURPLE_CONV_TYPE_CHAT, purple_chat_get_name((PurpleChat*)node), purple_chat_get_account((PurpleChat*)node));
+		conv = purple_conversations_find_chat_with_account(purple_chat_get_name((PurpleChat*)node), purple_chat_get_account((PurpleChat*)node));
 		if (conv) {
 			purple_conversation_update(conv, PURPLE_CONVERSATION_UPDATE_ICON);
 		}
diff --git a/libpurple/ft.c b/libpurple/ft.c
--- a/libpurple/ft.c
+++ b/libpurple/ft.c
@@ -289,7 +289,7 @@ purple_xfer_conversation_write_internal(
 
 	thumbnail_data = purple_xfer_get_thumbnail(xfer, &size);
 
-	conv = purple_conversations_find_with_account(PURPLE_CONV_TYPE_IM, xfer->who,
+	conv = purple_conversations_find_im_with_account(xfer->who,
 											   purple_xfer_get_account(xfer));
 
 	if (conv == NULL)
@@ -924,7 +924,7 @@ purple_xfer_set_completed(PurpleXfer *xf
 		else
 			msg = g_strdup(_("File transfer complete"));
 
-		conv = purple_conversations_find_with_account(PURPLE_CONV_TYPE_IM, xfer->who,
+		conv = purple_conversations_find_im_with_account(xfer->who,
 		                                             purple_xfer_get_account(xfer));
 
 		if (conv != NULL)
diff --git a/libpurple/plugins/autoaccept.c b/libpurple/plugins/autoaccept.c
--- a/libpurple/plugins/autoaccept.c
+++ b/libpurple/plugins/autoaccept.c
@@ -73,7 +73,7 @@ static void
 auto_accept_complete_cb(PurpleXfer *xfer, PurpleXfer *my)
 {
 	if (xfer == my && purple_prefs_get_bool(PREF_NOTIFY) &&
-			!purple_conversations_find_with_account(PURPLE_CONV_TYPE_IM, purple_xfer_get_remote_user(xfer), purple_xfer_get_account(xfer)))
+			!purple_conversations_find_im_with_account(purple_xfer_get_remote_user(xfer), purple_xfer_get_account(xfer)))
 	{
 		char *message = g_strdup_printf(_("Autoaccepted file transfer of \"%s\" from \"%s\" completed."),
 					purple_xfer_get_filename(xfer), purple_xfer_get_remote_user(xfer));
diff --git a/libpurple/plugins/psychic.c b/libpurple/plugins/psychic.c
--- a/libpurple/plugins/psychic.c
+++ b/libpurple/plugins/psychic.c
@@ -52,7 +52,7 @@ buddy_typing_cb(PurpleAccount *acct, con
     return;
   }
 
-  gconv = purple_conversations_find_with_account(PURPLE_CONV_TYPE_IM, name, acct);
+  gconv = purple_conversations_find_im_with_account(name, acct);
   if(! gconv) {
     purple_debug_info("psychic", "no previous conversation exists\n");
     gconv = purple_conversation_new(PURPLE_CONV_TYPE_IM, acct, name);
diff --git a/libpurple/pounce.c b/libpurple/pounce.c
--- a/libpurple/pounce.c
+++ b/libpurple/pounce.c
@@ -1128,7 +1128,7 @@ buddy_typing_cb(PurpleAccount *account, 
 {
 	PurpleConversation *conv;
 
-	conv = purple_conversations_find_with_account(PURPLE_CONV_TYPE_IM, name, account);
+	conv = purple_conversations_find_im_with_account(name, account);
 	if (conv != NULL)
 	{
 		PurpleIMConversationTypingState state;
diff --git a/libpurple/protocols/bonjour/jabber.c b/libpurple/protocols/bonjour/jabber.c
--- a/libpurple/protocols/bonjour/jabber.c
+++ b/libpurple/protocols/bonjour/jabber.c
@@ -302,7 +302,7 @@ static void
 
 		account = purple_buddy_get_account(pb);
 
-		conv = purple_conversations_find_with_account(PURPLE_CONV_TYPE_IM, bb->name, account);
+		conv = purple_conversations_find_im_with_account(bb->name, account);
 		if (conv != NULL)
 			purple_conversation_write(conv, NULL,
 				  _("Unable to send message."),
@@ -348,7 +348,7 @@ static gint
 
 		account = purple_buddy_get_account(pb);
 
-		conv = purple_conversations_find_with_account(PURPLE_CONV_TYPE_IM, bb->name, account);
+		conv = purple_conversations_find_im_with_account(bb->name, account);
 		if (conv != NULL)
 			purple_conversation_write(conv, NULL,
 				  _("Unable to send message."),
@@ -396,7 +396,7 @@ static void bonjour_jabber_stream_ended(
 #if 0
 	if(bconv->pb != NULL) {
 		PurpleConversation *conv;
-		conv = purple_conversations_find_with_account(PURPLE_CONV_TYPE_IM, bconv->pb->name, bconv->pb->account);
+		conv = purple_conversations_find_im_with_account(bconv->pb->name, bconv->pb->account);
 		if (conv != NULL) {
 			char *tmp = g_strdup_printf(_("%s has closed the conversation."), bconv->pb->name);
 			purple_conversation_write(conv, NULL, tmp, PURPLE_MESSAGE_SYSTEM, time(NULL));
@@ -485,7 +485,7 @@ static void
 		purple_debug_error("bonjour", "Error starting stream with buddy %s at %s error: %s\n",
 				   bname ? bname : "(unknown)", bconv->ip, err ? err : "(null)");
 
-		conv = purple_conversations_find_with_account(PURPLE_CONV_TYPE_IM, bname, bconv->account);
+		conv = purple_conversations_find_im_with_account(bname, bconv->account);
 		if (conv != NULL)
 			purple_conversation_write(conv, NULL,
 				  _("Unable to send the message, the conversation couldn't be started."),
@@ -550,7 +550,7 @@ static gboolean bonjour_jabber_send_stre
 
 		if (bconv->pb) {
 			PurpleConversation *conv;
-			conv = purple_conversations_find_with_account(PURPLE_CONV_TYPE_IM, bname, bconv->account);
+			conv = purple_conversations_find_im_with_account(bname, bconv->account);
 			if (conv != NULL)
 				purple_conversation_write(conv, NULL,
 					  _("Unable to send the message, the conversation couldn't be started."),
@@ -595,7 +595,7 @@ void bonjour_jabber_stream_started(Bonjo
 
 		if (bconv->pb) {
 			PurpleConversation *conv;
-			conv = purple_conversations_find_with_account(PURPLE_CONV_TYPE_IM, bname, bconv->account);
+			conv = purple_conversations_find_im_with_account(bname, bconv->account);
 			if (conv != NULL)
 				purple_conversation_write(conv, NULL,
 					  _("Unable to send the message, the conversation couldn't be started."),
@@ -872,7 +872,7 @@ static void
 
 		purple_debug_error("bonjour", "No more addresses for buddy %s. Aborting", purple_buddy_get_name(pb));
 
-		conv = purple_conversations_find_with_account(PURPLE_CONV_TYPE_IM, bb->name, account);
+		conv = purple_conversations_find_im_with_account(bb->name, account);
 		if (conv != NULL)
 			purple_conversation_write(conv, NULL,
 				  _("Unable to send the message, the conversation couldn't be started."),
@@ -893,7 +893,7 @@ static void
 
 		account = purple_buddy_get_account(pb);
 
-		conv = purple_conversations_find_with_account(PURPLE_CONV_TYPE_IM, bb->name, account);
+		conv = purple_conversations_find_im_with_account(bb->name, account);
 		if (conv != NULL)
 			purple_conversation_write(conv, NULL,
 				  _("Unable to send the message, the conversation couldn't be started."),
diff --git a/libpurple/protocols/gg/confer.c b/libpurple/protocols/gg/confer.c
--- a/libpurple/protocols/gg/confer.c
+++ b/libpurple/protocols/gg/confer.c
@@ -32,7 +32,7 @@ PurpleConversation *ggp_confer_find_by_n
 	g_return_val_if_fail(gc   != NULL, NULL);
 	g_return_val_if_fail(name != NULL, NULL);
 
-	return purple_conversations_find_with_account(PURPLE_CONV_TYPE_CHAT, name,
+	return purple_conversations_find_chat_with_account(name,
 			purple_connection_get_account(gc));
 }
 /* }}} */
diff --git a/libpurple/protocols/irc/cmds.c b/libpurple/protocols/irc/cmds.c
--- a/libpurple/protocols/irc/cmds.c
+++ b/libpurple/protocols/irc/cmds.c
@@ -34,7 +34,7 @@ static void irc_do_mode(struct irc_conn 
 
 int irc_cmd_default(struct irc_conn *irc, const char *cmd, const char *target, const char **args)
 {
-	PurpleConversation *convo = purple_conversations_find_with_account(PURPLE_CONV_TYPE_ANY, target, irc->account);
+	PurpleConversation *convo = purple_conversations_find_with_account(target, irc->account);
 	char *buf;
 
 	if (!convo)
@@ -132,7 +132,7 @@ int irc_cmd_ctcp_action(struct irc_conn 
 	g_free(newargs[1]);
 	g_free(newargs);
 
-	convo = purple_conversations_find_with_account(PURPLE_CONV_TYPE_ANY, target, irc->account);
+	convo = purple_conversations_find_with_account(target, irc->account);
 	if (convo) {
 		escaped = g_markup_escape_text(args[0], -1);
 		action = g_strdup_printf("/me %s", escaped);
@@ -205,7 +205,7 @@ int irc_cmd_kick(struct irc_conn *irc, c
 	if (!args || !args[0])
 		return 0;
 
-	convo = purple_conversations_find_with_account(PURPLE_CONV_TYPE_CHAT, target, irc->account);
+	convo = purple_conversations_find_chat_with_account(target, irc->account);
 	if (!convo)
 		return 0;
 
@@ -522,7 +522,7 @@ int irc_cmd_topic(struct irc_conn *irc, 
 	if (!args)
 		return 0;
 
-	convo = purple_conversations_find_with_account(PURPLE_CONV_TYPE_CHAT, target, irc->account);
+	convo = purple_conversations_find_chat_with_account(target, irc->account);
 	if (!convo)
 		return 0;
 
diff --git a/libpurple/protocols/irc/msgs.c b/libpurple/protocols/irc/msgs.c
--- a/libpurple/protocols/irc/msgs.c
+++ b/libpurple/protocols/irc/msgs.c
@@ -331,7 +331,7 @@ void irc_msg_banfull(struct irc_conn *ir
 	if (!args || !args[0] || !args[1] || !args[2])
 		return;
 
-	convo = purple_conversations_find_with_account(PURPLE_CONV_TYPE_CHAT, args[1], irc->account);
+	convo = purple_conversations_find_chat_with_account(args[1], irc->account);
 	if (!convo)
 		return;
 



More information about the Commits mailing list