/soc/2013/ankitkv/gobjectification: b8b3186aff95: Refactored som...

Ankit Vani a at nevitus.org
Sun Jun 23 08:04:18 EDT 2013


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

Description:

Refactored some libpurple plugins for GObject-based PurpleConversation

diffstat:

 libpurple/plugins/joinpart.c    |  2 +-
 libpurple/plugins/newline.c     |  4 ++--
 libpurple/plugins/offlinemsg.c  |  5 ++---
 libpurple/plugins/psychic.c     |  2 +-
 libpurple/plugins/statenotify.c |  5 ++---
 5 files changed, 8 insertions(+), 10 deletions(-)

diffs (79 lines):

diff --git a/libpurple/plugins/joinpart.c b/libpurple/plugins/joinpart.c
--- a/libpurple/plugins/joinpart.c
+++ b/libpurple/plugins/joinpart.c
@@ -85,7 +85,7 @@ static gboolean should_hide_notice(Purpl
 	time_t *last_said;
 
 	g_return_val_if_fail(conv != NULL, FALSE);
-	g_return_val_if_fail(purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT, FALSE);
+	g_return_val_if_fail(PURPLE_IS_CHAT_CONVERSATION(conv), FALSE);
 
 	/* If the room is small, don't bother. */
 	chat = PURPLE_CONV_CHAT(conv);
diff --git a/libpurple/plugins/newline.c b/libpurple/plugins/newline.c
--- a/libpurple/plugins/newline.c
+++ b/libpurple/plugins/newline.c
@@ -31,9 +31,9 @@ static gboolean
 addnewline_msg_cb(PurpleAccount *account, char *sender, char **message,
 					 PurpleConversation *conv, int *flags, void *data)
 {
-	if (((purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) &&
+	if ((PURPLE_IS_IM_CONVERSATION(conv) &&
 		 !purple_prefs_get_bool("/plugins/core/newline/im")) ||
-		((purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) &&
+		(PURPLE_IS_CHAT_CONVERSATION(conv) &&
 		 !purple_prefs_get_bool("/plugins/core/newline/chat")))
 		return FALSE;
 
diff --git a/libpurple/plugins/offlinemsg.c b/libpurple/plugins/offlinemsg.c
--- a/libpurple/plugins/offlinemsg.c
+++ b/libpurple/plugins/offlinemsg.c
@@ -69,7 +69,7 @@ cancel_poune(OfflineMsg *offline)
 {
 	purple_conversation_set_data(offline->conv, "plugin_pack:offlinemsg",
 				GINT_TO_POINTER(OFFLINE_MSG_NO));
-	purple_im_conversation_send_message(PURPLE_CONV_IM(offline->conv), offline->message, 0);
+	purple_conversation_send_message(offline->conv, offline->message, 0);
 	discard_data(offline);
 }
 
@@ -137,8 +137,7 @@ sending_msg_cb(PurpleAccount *account, c
 		return;
 	}
 
-	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/libpurple/plugins/psychic.c b/libpurple/plugins/psychic.c
--- a/libpurple/plugins/psychic.c
+++ b/libpurple/plugins/psychic.c
@@ -55,7 +55,7 @@ buddy_typing_cb(PurpleAccount *acct, con
   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);
+    gconv = purple_im_conversation_new(acct, name);
 
     if(purple_prefs_get_bool(PREF_RAISE)) {
       purple_conversation_present(gconv);
diff --git a/libpurple/plugins/statenotify.c b/libpurple/plugins/statenotify.c
--- a/libpurple/plugins/statenotify.c
+++ b/libpurple/plugins/statenotify.c
@@ -25,12 +25,11 @@ write_status(PurpleBuddy *buddy, const c
 	account = purple_buddy_get_account(buddy);
 	buddy_name = purple_buddy_get_name(buddy);
 
-	conv = purple_conversations_find_with_account(PURPLE_CONV_TYPE_IM,
-												 buddy_name, account);
+	conv = purple_conversations_find_im_with_account(buddy_name, account);
 
 	if (conv == NULL)
 		return;
-	g_return_if_fail(purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM);
+	g_return_if_fail(PURPLE_IS_IM_CONVERSATION(conv));
 
 	/* Prevent duplicate notifications for buddies in multiple groups */
 	if (buddy != purple_find_buddy(account, buddy_name))



More information about the Commits mailing list