/soc/2013/ankitkv/gobjectification: ca9b45be7a63: Renamed chat b...

Ankit Vani a at nevitus.org
Fri Jun 28 19:22:22 EDT 2013


Changeset: ca9b45be7a633b5710d71bfefb0fea1a5a7d6b19
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-06-29 04:52 +0530
Branch:	 soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/ca9b45be7a63

Description:

Renamed chat buddy to chat user in a few more places
* Renamed purple_chat_conversation_find_buddy() to purple_chat_conversation_find_user()
* Replaced CHAT_CONVERSATION_BUDDY in macros with CHAT_USER

diffstat:

 finch/gntconv.c                               |   2 +-
 libpurple/conversationtypes.c                 |  20 ++++----
 libpurple/conversationtypes.h                 |  63 +++++++++-----------------
 libpurple/plugins/perl/common/Conversation.xs |   2 +-
 libpurple/protocols/irc/msgs.c                |   6 +-
 libpurple/protocols/jabber/presence.c         |   2 +-
 libpurple/protocols/null/nullprpl.c           |   2 +-
 libpurple/protocols/yahoo/yahoochat.c         |   2 +-
 pidgin/gtkconv.c                              |   6 +-
 9 files changed, 43 insertions(+), 62 deletions(-)

diffs (truncated from 319 to 300 lines):

diff --git a/finch/gntconv.c b/finch/gntconv.c
--- a/finch/gntconv.c
+++ b/finch/gntconv.c
@@ -1124,7 +1124,7 @@ finch_chat_rename_user(PurpleChatConvers
 	FinchConv *ggc = FINCH_CONV(PURPLE_CONVERSATION(chat));
 	GntEntry *entry = GNT_ENTRY(ggc->entry);
 	GntTree *tree = GNT_TREE(ggc->u.chat->userlist);
-	PurpleChatUser *cb = purple_chat_conversation_find_buddy(chat, new_n);
+	PurpleChatUser *cb = purple_chat_conversation_find_user(chat, new_n);
 
 	gnt_entry_remove_suggest(entry, old);
 	gnt_tree_remove(tree, (gpointer)old);
diff --git a/libpurple/conversationtypes.c b/libpurple/conversationtypes.c
--- a/libpurple/conversationtypes.c
+++ b/libpurple/conversationtypes.c
@@ -40,7 +40,7 @@ typedef struct _PurpleChatConversationPr
 typedef struct _PurpleIMConversationPrivate       PurpleIMConversationPrivate;
 
 #define PURPLE_CHAT_USER_GET_PRIVATE(obj) \
-	(G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_CHAT_CONVERSATION_BUDDY, PurpleChatUserPrivate))
+	(G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_CHAT_USER, PurpleChatUserPrivate))
 
 /** @copydoc _PurpleChatUserPrivate */
 typedef struct _PurpleChatUserPrivate  PurpleChatUserPrivate;
@@ -1013,7 +1013,7 @@ purple_chat_conversation_rename_user(Pur
 			new_alias = purple_buddy_get_contact_alias(buddy);
 	}
 
-	flags = purple_chat_user_get_flags(purple_chat_conversation_find_buddy(chat, old_user));
+	flags = purple_chat_user_get_flags(purple_chat_conversation_find_user(chat, old_user));
 	cb = purple_chat_user_new(chat, new_user, new_alias, flags);
 	purple_chat_user_set_buddy(cb, purple_find_buddy(account, new_user) != NULL);
 
@@ -1024,7 +1024,7 @@ purple_chat_conversation_rename_user(Pur
 	if (ops != NULL && ops->chat_rename_user != NULL)
 		ops->chat_rename_user(chat, old_user, new_user, new_alias);
 
-	cb = purple_chat_conversation_find_buddy(chat, old_user);
+	cb = purple_chat_conversation_find_user(chat, old_user);
 
 	if (cb) {
 		priv->in_room = g_list_remove(priv->in_room, cb);
@@ -1121,7 +1121,7 @@ purple_chat_conversation_remove_users(Pu
 					"chat-user-leaving", chat, user, reason)) |
 				purple_chat_conversation_is_ignored_user(chat, user);
 
-		cb = purple_chat_conversation_find_buddy(chat, user);
+		cb = purple_chat_conversation_find_user(chat, user);
 
 		if (cb) {
 			priv->in_room = g_list_remove(priv->in_room, cb);
@@ -1294,7 +1294,7 @@ purple_chat_conversation_has_user(Purple
 	g_return_val_if_fail(chat != NULL, FALSE);
 	g_return_val_if_fail(user != NULL, FALSE);
 
-	return (purple_chat_conversation_find_buddy(chat, user) != NULL);
+	return (purple_chat_conversation_find_user(chat, user) != NULL);
 }
 
 void
@@ -1350,7 +1350,7 @@ chat_conversation_cleanup_for_rejoin(Pur
 }
 
 PurpleChatUser *
-purple_chat_conversation_find_buddy(PurpleChatConversation *chat, const char *name)
+purple_chat_conversation_find_user(PurpleChatConversation *chat, const char *name)
 {
 	PurpleChatConversationPrivate *priv = PURPLE_CHAT_CONVERSATION_GET_PRIVATE(chat);
 
@@ -1934,7 +1934,7 @@ static void
 purple_chat_user_set_property(GObject *obj, guint param_id, const GValue *value,
 		GParamSpec *pspec)
 {
-	PurpleChatUser *cb = PURPLE_CHAT_CONVERSATION_BUDDY(obj);
+	PurpleChatUser *cb = PURPLE_CHAT_USER(obj);
 	PurpleChatUserPrivate *priv = PURPLE_CHAT_USER_GET_PRIVATE(cb);
 
 	switch (param_id) {
@@ -1966,7 +1966,7 @@ static void
 purple_chat_user_get_property(GObject *obj, guint param_id, GValue *value,
 		GParamSpec *pspec)
 {
-	PurpleChatUser *cb = PURPLE_CHAT_CONVERSATION_BUDDY(obj);
+	PurpleChatUser *cb = PURPLE_CHAT_USER(obj);
 
 	switch (param_id) {
 		case CB_PROP_CHAT:
@@ -2004,7 +2004,7 @@ static void purple_chat_user_init(GTypeI
 static void
 purple_chat_user_dispose(GObject *object)
 {
-	PurpleChatUser *cb = PURPLE_CHAT_CONVERSATION_BUDDY(object);
+	PurpleChatUser *cb = PURPLE_CHAT_USER(object);
 
 	purple_signal_emit(purple_conversations_get_handle(),
 			"deleting-chat-user", cb);
@@ -2112,7 +2112,7 @@ purple_chat_user_new(PurpleChatConversat
 	g_return_val_if_fail(chat != NULL, NULL);
 	g_return_val_if_fail(name != NULL, NULL);
 
-	cb = g_object_new(PURPLE_TYPE_CHAT_CONVERSATION_BUDDY,
+	cb = g_object_new(PURPLE_TYPE_CHAT_USER,
 			"chat", chat,
 			"name",  name,
 			"alias", alias,
diff --git a/libpurple/conversationtypes.h b/libpurple/conversationtypes.h
--- a/libpurple/conversationtypes.h
+++ b/libpurple/conversationtypes.h
@@ -30,54 +30,36 @@
 /** Data Structures                                                       */
 /**************************************************************************/
 
-#define PURPLE_TYPE_IM_CONVERSATION \
-	(purple_im_conversation_get_type())
-#define PURPLE_IM_CONVERSATION(obj) \
-	(G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_IM_CONVERSATION, PurpleIMConversation))
-#define PURPLE_IM_CONVERSATION_CLASS(klass) \
-	(G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_IM_CONVERSATION, PurpleIMConversationClass))
-#define PURPLE_IS_IM_CONVERSATION(obj) \
-	(G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_IM_CONVERSATION))
-#define PURPLE_IS_IM_CONVERSATION_CLASS(klass) \
-	(G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_IM_CONVERSATION))
-#define PURPLE_IM_CONVERSATION_GET_CLASS(obj) \
-	(G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_IM_CONVERSATION, PurpleIMConversationClass))
+#define PURPLE_TYPE_IM_CONVERSATION              (purple_im_conversation_get_type())
+#define PURPLE_IM_CONVERSATION(obj)              (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_IM_CONVERSATION, PurpleIMConversation))
+#define PURPLE_IM_CONVERSATION_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_IM_CONVERSATION, PurpleIMConversationClass))
+#define PURPLE_IS_IM_CONVERSATION(obj)           (G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_IM_CONVERSATION))
+#define PURPLE_IS_IM_CONVERSATION_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_IM_CONVERSATION))
+#define PURPLE_IM_CONVERSATION_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_IM_CONVERSATION, PurpleIMConversationClass))
 
 /** @copydoc _PurpleIMConversation */
 typedef struct _PurpleIMConversation         PurpleIMConversation;
 /** @copydoc _PurpleIMConversationClass */
 typedef struct _PurpleIMConversationClass    PurpleIMConversationClass;
 
-#define PURPLE_TYPE_CHAT_CONVERSATION \
-	(purple_chat_conversation_get_type())
-#define PURPLE_CHAT_CONVERSATION(obj) \
-	(G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_CHAT_CONVERSATION, PurpleChatConversation))
-#define PURPLE_CHAT_CONVERSATION_CLASS(klass) \
-	(G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_CHAT_CONVERSATION, PurpleChatConversationClass))
-#define PURPLE_IS_CHAT_CONVERSATION(obj) \
-	(G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_CHAT_CONVERSATION))
-#define PURPLE_IS_CHAT_CONVERSATION_CLASS(klass) \
-	(G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_CHAT_CONVERSATION))
-#define PURPLE_CHAT_CONVERSATION_GET_CLASS(obj) \
-	(G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_CHAT_CONVERSATION, PurpleChatConversationClass))
+#define PURPLE_TYPE_CHAT_CONVERSATION            (purple_chat_conversation_get_type())
+#define PURPLE_CHAT_CONVERSATION(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_CHAT_CONVERSATION, PurpleChatConversation))
+#define PURPLE_CHAT_CONVERSATION_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_CHAT_CONVERSATION, PurpleChatConversationClass))
+#define PURPLE_IS_CHAT_CONVERSATION(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_CHAT_CONVERSATION))
+#define PURPLE_IS_CHAT_CONVERSATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_CHAT_CONVERSATION))
+#define PURPLE_CHAT_CONVERSATION_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_CHAT_CONVERSATION, PurpleChatConversationClass))
 
 /** @copydoc _PurpleChatConversation */
 typedef struct _PurpleChatConversation       PurpleChatConversation;
 /** @copydoc _PurpleChatConversationClass */
 typedef struct _PurpleChatConversationClass  PurpleChatConversationClass;
 
-#define PURPLE_TYPE_CHAT_CONVERSATION_BUDDY \
-	(purple_chat_user_get_type())
-#define PURPLE_CHAT_CONVERSATION_BUDDY(obj) \
-	(G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_CHAT_CONVERSATION_BUDDY, PurpleChatUser))
-#define PURPLE_CHAT_USER_CLASS(klass) \
-	(G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_CHAT_CONVERSATION_BUDDY, PurpleChatUserClass))
-#define PURPLE_IS_CHAT_CONVERSATION_BUDDY(obj) \
-	(G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_CHAT_CONVERSATION_BUDDY))
-#define PURPLE_IS_CHAT_CONVERSATION_BUDDY_CLASS(klass) \
-	(G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_CHAT_CONVERSATION_BUDDY))
-#define PURPLE_CHAT_USER_GET_CLASS(obj) \
-	(G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_CHAT_CONVERSATION_BUDDY, PurpleChatUserClass))
+#define PURPLE_TYPE_CHAT_USER                    (purple_chat_user_get_type())
+#define PURPLE_CHAT_USER(obj)                    (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_CHAT_USER, PurpleChatUser))
+#define PURPLE_CHAT_USER_CLASS(klass)            (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_CHAT_USER, PurpleChatUserClass))
+#define PURPLE_IS_CHAT_USER(obj)                 (G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_CHAT_USER))
+#define PURPLE_IS_CHAT_USER_CLASS(klass)         (G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_CHAT_USER))
+#define PURPLE_CHAT_USER_GET_CLASS(obj)          (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_CHAT_USER, PurpleChatUserClass))
 
 /** @copydoc _PurpleChatUser */
 typedef struct _PurpleChatUser       PurpleChatUser;
@@ -586,7 +568,8 @@ void purple_chat_conversation_leave(Purp
  * @param chat The chat.
  * @param name The name of the chat user to find.
  */
-PurpleChatUser *purple_chat_conversation_find_buddy(PurpleChatConversation *chat, const char *name);
+PurpleChatUser *purple_chat_conversation_find_user(PurpleChatConversation *chat,
+		const char *name);
 
 /**
  * Invite a user to a chat.
@@ -740,8 +723,7 @@ const char *purple_chat_user_get_name(co
  * @param cb     The chat user.
  * @param flags  The new flags.
  */
-void purple_chat_user_set_flags(PurpleChatUser *cb,
-		PurpleChatUserFlags flags);
+void purple_chat_user_set_flags(PurpleChatUser *cb, PurpleChatUserFlags flags);
 
 /**
  * Get the flags of a chat user.
@@ -758,8 +740,7 @@ PurpleChatUserFlags purple_chat_user_get
  * @param cb	The chat user.
  * @param buddy TRUE if the chat user is on the buddy list.
  */
-void purple_chat_user_set_buddy(const PurpleChatUser *cb,
-		gboolean buddy);
+void purple_chat_user_set_buddy(const PurpleChatUser *cb, gboolean buddy);
 
 /**
  * Indicates if this chat user is on the buddy list.
diff --git a/libpurple/plugins/perl/common/Conversation.xs b/libpurple/plugins/perl/common/Conversation.xs
--- a/libpurple/plugins/perl/common/Conversation.xs
+++ b/libpurple/plugins/perl/common/Conversation.xs
@@ -457,7 +457,7 @@ gboolean purple_chat_conversation_has_le
 	Purple::ChatConversation chat
 
 Purple::ChatUser
-purple_chat_conversation_find_buddy(chat, name)
+purple_chat_conversation_find_user(chat, name)
 	Purple::ChatConversation chat
 	const char *name
 
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
@@ -494,7 +494,7 @@ void irc_msg_who(struct irc_conn *irc, c
 			return;
 		}
 
-		cb = purple_chat_conversation_find_buddy(chat, args[5]);
+		cb = purple_chat_conversation_find_user(chat, args[5]);
 		if (!cb) {
 			purple_debug(PURPLE_DEBUG_ERROR, "irc", "Got a WHO response for %s who isn't a buddy.\n", args[5]);
 			return;
@@ -1016,7 +1016,7 @@ void irc_msg_join(struct irc_conn *irc, 
 	
 	purple_chat_conversation_add_user(chat, nick, userhost, PURPLE_CHAT_USER_NONE, TRUE);
 	
-	cb = purple_chat_conversation_find_buddy(chat, nick);
+	cb = purple_chat_conversation_find_user(chat, nick);
 	
 	if (cb) {
 		purple_chat_user_set_attribute(cb, chat, "userhost", userhost);		
@@ -1098,7 +1098,7 @@ void irc_msg_mode(struct irc_conn *irc, 
 				if (!end)
 					end = cur + strlen(cur);
 				user = g_strndup(cur, end - cur);
-				cb = purple_chat_conversation_find_buddy(chat, user);
+				cb = purple_chat_conversation_find_user(chat, user);
 				flags = purple_chat_user_get_flags(cb);
 				newflag = PURPLE_CHAT_USER_NONE;
 				if (*mcur == 'o')
diff --git a/libpurple/protocols/jabber/presence.c b/libpurple/protocols/jabber/presence.c
--- a/libpurple/protocols/jabber/presence.c
+++ b/libpurple/protocols/jabber/presence.c
@@ -640,7 +640,7 @@ handle_presence_chat(JabberStream *js, J
 			purple_chat_conversation_add_user(chat->conv, presence->jid_from->resource,
 					jid, flags, chat->joined > 0 && ((!presence->delayed) || (presence->sent > chat->joined)));
 		else
-			purple_chat_user_set_flags(purple_chat_conversation_find_buddy(chat->conv, presence->jid_from->resource),
+			purple_chat_user_set_flags(purple_chat_conversation_find_user(chat->conv, presence->jid_from->resource),
 					flags);
 
 		if (is_our_resource && chat->joined == 0)
diff --git a/libpurple/protocols/null/nullprpl.c b/libpurple/protocols/null/nullprpl.c
--- a/libpurple/protocols/null/nullprpl.c
+++ b/libpurple/protocols/null/nullprpl.c
@@ -794,7 +794,7 @@ static PurpleCmdRet send_whisper(PurpleC
                     from_username, to_username, purple_conversation_get_name(conv), message);
 
   chat = purple_conversation_get_chat_data(conv);
-  chat_user = purple_chat_conversation_find_buddy(chat, to_username);
+  chat_user = purple_chat_conversation_find_user(chat, to_username);
   to = get_nullprpl_gc(to_username);
 
   if (!chat_user) {
diff --git a/libpurple/protocols/yahoo/yahoochat.c b/libpurple/protocols/yahoo/yahoochat.c
--- a/libpurple/protocols/yahoo/yahoochat.c
+++ b/libpurple/protocols/yahoo/yahoochat.c
@@ -597,7 +597,7 @@ void yahoo_process_chat_join(PurpleConne
 				if (!purple_utf8_strcasecmp((char *)l->data, roomies->data)) {
 					purple_debug_info("yahoo", "Ignoring room member %s in room %s\n" , (char *)roomies->data, room ? room : "");
 					purple_chat_conversation_ignore(c,roomies->data);
-					ops->chat_update_user(purple_chat_conversation_find_buddy(c, roomies->data));
+					ops->chat_update_user(purple_chat_conversation_find_user(c, roomies->data));
 				}
 			}
 		}
diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c
--- a/pidgin/gtkconv.c
+++ b/pidgin/gtkconv.c
@@ -1516,7 +1516,7 @@ ignore_cb(GtkWidget *w, PidginConversati
 	else
 		purple_chat_conversation_ignore(chat, name);
 
-	pidgin_conv_chat_update_user(purple_chat_conversation_find_buddy(chat, name));
+	pidgin_conv_chat_update_user(purple_chat_conversation_find_user(chat, name));
 }
 



More information about the Commits mailing list