/soc/2013/ankitkv/gobjectification: e49aa67344e1: Renamed Purple...

Ankit Vani a at nevitus.org
Sun Jun 23 05:03:40 EDT 2013


Changeset: e49aa67344e16949d016e924d38e4db890ac69b2
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-06-23 14:24 +0530
Branch:	 soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/e49aa67344e1

Description:

Renamed PurpleConversationMessageFlags back to PurpleMessageFlags.
The name was too long and it can be used more generically than for PurpleConversationMessage.

diffstat:

 libpurple/conversation.c                      |  26 +++++-----
 libpurple/conversation.h                      |  63 ++++++++++++++------------
 libpurple/conversationtypes.c                 |  24 +++++-----
 libpurple/conversationtypes.h                 |  14 +++---
 libpurple/log.h                               |   4 +-
 libpurple/plugins/perl/common/Conversation.xs |  16 +++---
 libpurple/plugins/perl/common/Server.xs       |   8 +-
 libpurple/plugins/perl/common/module.h        |   8 +-
 libpurple/plugins/perl/common/typemap         |   2 +-
 libpurple/plugins/tcl/tcl_cmds.c              |   6 +-
 libpurple/prpl.h                              |   6 +-
 libpurple/server.h                            |   8 +-
 12 files changed, 94 insertions(+), 91 deletions(-)

diffs (truncated from 659 to 300 lines):

diff --git a/libpurple/conversation.c b/libpurple/conversation.c
--- a/libpurple/conversation.c
+++ b/libpurple/conversation.c
@@ -71,7 +71,7 @@ struct _PurpleConversationMessage
 {
 	char *who;
 	char *what;
-	PurpleConversationMessageFlags flags;
+	PurpleMessageFlags flags;
 	time_t when;
 	PurpleConversation *conv;
 	char *alias;
@@ -165,7 +165,7 @@ send_typed_cb(gpointer data)
 }
 
 static void
-common_send(PurpleConversation *conv, const char *message, PurpleConversationMessageFlags msgflags)
+common_send(PurpleConversation *conv, const char *message, PurpleMessageFlags msgflags)
 {
 	PurpleConversationType type;
 	PurpleAccount *account;
@@ -186,20 +186,20 @@ common_send(PurpleConversation *conv, co
 
 	/* Always linkfy the text for display, unless we're
 	 * explicitly asked to do otheriwse*/
-	if (!(msgflags & PURPLE_CONVERSATION_MESSAGE_INVISIBLE)) {
-		if(msgflags & PURPLE_CONVERSATION_MESSAGE_NO_LINKIFY)
+	if (!(msgflags & PURPLE_MESSAGE_INVISIBLE)) {
+		if(msgflags & PURPLE_MESSAGE_NO_LINKIFY)
 			displayed = g_strdup(message);
 		else
 			displayed = purple_markup_linkify(message);
 	}
 
 	if (displayed && (conv->features & PURPLE_CONNECTION_HTML) &&
-		!(msgflags & PURPLE_CONVERSATION_MESSAGE_RAW)) {
+		!(msgflags & PURPLE_MESSAGE_RAW)) {
 		sent = g_strdup(displayed);
 	} else
 		sent = g_strdup(message);
 
-	msgflags |= PURPLE_CONVERSATION_MESSAGE_SEND;
+	msgflags |= PURPLE_MESSAGE_SEND;
 
 	if (type == PURPLE_CONVERSATION_TYPE_IM) {
 		PurpleIMConversationPrivate *priv = PURPLE_IM_CONVERSATION_GET_PRIVATE(conv);
@@ -281,14 +281,14 @@ open_log(PurpleConversation *conv)
 
 static void
 add_message_to_history(PurpleConversation *conv, const char *who, const char *alias,
-		const char *message, PurpleConversationMessageFlags flags, time_t when)
+		const char *message, PurpleMessageFlags flags, time_t when)
 {
 	PurpleConversationMessage *msg;
 	PurpleConnection *gc;
 
 	gc = purple_account_get_connection(conv->account);
 
-	if (flags & PURPLE_CONVERSATION_MESSAGE_SEND) {
+	if (flags & PURPLE_MESSAGE_SEND) {
 		const char *me = NULL;
 		if (gc)
 			me = purple_connection_get_display_name(gc);
@@ -867,7 +867,7 @@ purple_conversation_get_data(PurpleConve
 
 void
 purple_conversation_write(PurpleConversation *conv, const char *who,
-						const char *message, PurpleConversationMessageFlags flags,
+						const char *message, PurpleMessageFlags flags,
 						time_t mtime)
 {
 	PurplePluginProtocolInfo *prpl_info = NULL;
@@ -926,7 +926,7 @@ purple_conversation_write(PurpleConversa
 		if (purple_conversation_get_type(conv) == PURPLE_CONVERSATION_TYPE_IM ||
 			!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) {
 
-			if (flags & PURPLE_CONVERSATION_MESSAGE_SEND) {
+			if (flags & PURPLE_MESSAGE_SEND) {
 				b = purple_find_buddy(account,
 							purple_account_get_username(account));
 
@@ -949,7 +949,7 @@ purple_conversation_write(PurpleConversa
 		}
 	}
 
-	if (!(flags & PURPLE_CONVERSATION_MESSAGE_NO_LOG) && purple_conversation_is_logging(conv)) {
+	if (!(flags & PURPLE_MESSAGE_NO_LOG) && purple_conversation_is_logging(conv)) {
 		GList *log;
 
 		if (conv->logs == NULL)
@@ -1015,7 +1015,7 @@ gboolean purple_conversation_helper_pres
 
 	conv = purple_conversations_find_with_account(PURPLE_CONVERSATION_TYPE_ANY, who, account);
 	if (conv != NULL)
-		purple_conversation_write(conv, NULL, what, PURPLE_CONVERSATION_MESSAGE_ERROR, time(NULL));
+		purple_conversation_write(conv, NULL, what, PURPLE_MESSAGE_ERROR, time(NULL));
 	else
 		return FALSE;
 
@@ -1244,7 +1244,7 @@ const char *purple_conversation_message_
 	return msg->what;
 }
 
-PurpleConversationMessageFlags purple_conversation_message_get_flags(const PurpleConversationMessage *msg)
+PurpleMessageFlags purple_conversation_message_get_flags(const PurpleConversationMessage *msg)
 {
 	g_return_val_if_fail(msg, 0);
 	return msg->flags;
diff --git a/libpurple/conversation.h b/libpurple/conversation.h
--- a/libpurple/conversation.h
+++ b/libpurple/conversation.h
@@ -82,34 +82,33 @@ typedef enum
  */
 typedef enum /*< flags >*/
 {
-	PURPLE_CONVERSATION_MESSAGE_SEND        = 0x0001, /**< Outgoing message.        */
-	PURPLE_CONVERSATION_MESSAGE_RECV        = 0x0002, /**< Incoming message.        */
-	PURPLE_CONVERSATION_MESSAGE_SYSTEM      = 0x0004, /**< System message.          */
-	PURPLE_CONVERSATION_MESSAGE_AUTO_RESP   = 0x0008, /**< Auto response.           */
-	PURPLE_CONVERSATION_MESSAGE_ACTIVE_ONLY = 0x0010,  /**< Hint to the UI that this
+	PURPLE_MESSAGE_SEND        = 0x0001, /**< Outgoing message.        */
+	PURPLE_MESSAGE_RECV        = 0x0002, /**< Incoming message.        */
+	PURPLE_MESSAGE_SYSTEM      = 0x0004, /**< System message.          */
+	PURPLE_MESSAGE_AUTO_RESP   = 0x0008, /**< Auto response.           */
+	PURPLE_MESSAGE_ACTIVE_ONLY = 0x0010,  /**< Hint to the UI that this
 	                                                        message should not be
 	                                                        shown in conversations
 	                                                        which are only open for
 	                                                        internal UI purposes
 	                                                        (e.g. for contact-aware
 	                                                        conversations).         */
-	PURPLE_CONVERSATION_MESSAGE_NICK        = 0x0020, /**< Contains your nick.      */
-	PURPLE_CONVERSATION_MESSAGE_NO_LOG      = 0x0040, /**< Do not log.              */
-	PURPLE_CONVERSATION_MESSAGE_WHISPER     = 0x0080, /**< Whispered message.       */
-	PURPLE_CONVERSATION_MESSAGE_ERROR       = 0x0200, /**< Error message.           */
-	PURPLE_CONVERSATION_MESSAGE_DELAYED     = 0x0400, /**< Delayed message.         */
-	PURPLE_CONVERSATION_MESSAGE_RAW         = 0x0800, /**< "Raw" message - don't
+	PURPLE_MESSAGE_NICK        = 0x0020, /**< Contains your nick.      */
+	PURPLE_MESSAGE_NO_LOG      = 0x0040, /**< Do not log.              */
+	PURPLE_MESSAGE_WHISPER     = 0x0080, /**< Whispered message.       */
+	PURPLE_MESSAGE_ERROR       = 0x0200, /**< Error message.           */
+	PURPLE_MESSAGE_DELAYED     = 0x0400, /**< Delayed message.         */
+	PURPLE_MESSAGE_RAW         = 0x0800, /**< "Raw" message - don't
 	                                                        apply formatting        */
-	PURPLE_CONVERSATION_MESSAGE_IMAGES      = 0x1000, /**< Message contains images  */
-	PURPLE_CONVERSATION_MESSAGE_NOTIFY      = 0x2000, /**< Message is a notification */
-	PURPLE_CONVERSATION_MESSAGE_NO_LINKIFY  = 0x4000, /**< Message should not be auto-
+	PURPLE_MESSAGE_IMAGES      = 0x1000, /**< Message contains images  */
+	PURPLE_MESSAGE_NOTIFY      = 0x2000, /**< Message is a notification */
+	PURPLE_MESSAGE_NO_LINKIFY  = 0x4000, /**< Message should not be auto-
 										                   linkified */
-	PURPLE_CONVERSATION_MESSAGE_INVISIBLE   = 0x8000  /**< Message should not be displayed */
-} PurpleConversationMessageFlags;
+	PURPLE_MESSAGE_INVISIBLE   = 0x8000  /**< Message should not be displayed */
+} PurpleMessageFlags;
 
-#include "account.h"
-#include "buddyicon.h"
-#include "log.h"
+#include <glib.h>
+#include <glib-object.h>
 
 /**************************************************************************/
 /** PurpleConversation                                                    */
@@ -135,14 +134,14 @@ struct _PurpleConversationClass {
 	 *  @see purple_conversation_write_message()
 	 */
 	void (*write_message)(PurpleConversation *conv, const char *who,
-			const char *message, PurpleConversationMessageFlags flags,
+			const char *message, PurpleMessageFlags flags,
 			time_t mtime);
 
 	/** Sends a message to a chat or IM conversation. TODO
 	 *  @see purple_conversation_send_message()
 	 */
 	void (*send_message)(PurpleConversation *conv,
-			const char *message, PurpleConversationMessageFlags flags);
+			const char *message, PurpleMessageFlags flags);
 
 	void (*_purple_reserved1)(void);
 	void (*_purple_reserved2)(void);
@@ -150,6 +149,10 @@ struct _PurpleConversationClass {
 	void (*_purple_reserved4)(void);
 };
 
+#include "account.h"
+#include "buddyicon.h"
+#include "log.h"
+
 /**************************************************************************/
 /** PurpleConversationUiOps                                               */
 /**************************************************************************/
@@ -173,14 +176,14 @@ struct _PurpleConversationUiOps
 	 *  @see purple_chat_conversation_write()
 	 */
 	void (*write_chat)(PurpleConversation *conv, const char *who,
-	                  const char *message, PurpleConversationMessageFlags flags,
+	                  const char *message, PurpleMessageFlags flags,
 	                  time_t mtime);
 	/** Write a message to an IM conversation.  If this field is @c NULL,
 	 *  libpurple will fall back to using #write_conv.
 	 *  @see purple_im_conversation_write()
 	 */
 	void (*write_im)(PurpleConversation *conv, const char *who,
-	                 const char *message, PurpleConversationMessageFlags flags,
+	                 const char *message, PurpleMessageFlags flags,
 	                 time_t mtime);
 	/** Write a message to a conversation.  This is used rather than the
 	 *  chat- or im-specific ops for errors, system messages (such as "x is
@@ -194,7 +197,7 @@ struct _PurpleConversationUiOps
 	                   const char *name,
 	                   const char *alias,
 	                   const char *message,
-	                   PurpleConversationMessageFlags flags,
+	                   PurpleMessageFlags flags,
 	                   time_t mtime);
 
 	/** Add @a cbuddies to a chat.
@@ -450,7 +453,7 @@ gpointer purple_conversation_get_data(Pu
  * @see purple_conversation_write_message()
  */
 void purple_conversation_write(PurpleConversation *conv, const char *who,
-		const char *message, PurpleConversationMessageFlags flags,
+		const char *message, PurpleMessageFlags flags,
 		time_t mtime);
 
 /** TODO pure virtual
@@ -464,7 +467,7 @@ void purple_conversation_write(PurpleCon
  */
 void purple_conversation_write_message(PurpleConversation *conv,
 		const char *who, const char *message,
-		PurpleConversationMessageFlags flags, time_t mtime);
+		PurpleMessageFlags flags, time_t mtime);
 
 /** TODO forward to send_message
  * Sends a message to this conversation. This function calls
@@ -480,11 +483,11 @@ void purple_conversation_send(PurpleConv
  *
  * @param conv    The conversation.
  * @param message The message to send.
- * @param flags   The PurpleConversationMessageFlags flags to use in addition to
- *                PURPLE_CONVERSATION_MESSAGE_SEND.
+ * @param flags   The PurpleMessageFlags flags to use in addition to
+ *                PURPLE_MESSAGE_SEND.
  */
 void purple_conversation_send_message(PurpleConversation *conv, const char *message,
-		PurpleConversationMessageFlags flags);
+		PurpleMessageFlags flags);
 
 /**
 	Set the features as supported for the given conversation.
@@ -697,7 +700,7 @@ const char *purple_conversation_message_
  *
  * @return   The message flags
  */
-PurpleConversationMessageFlags purple_conversation_message_get_flags(const PurpleConversationMessage *msg);
+PurpleMessageFlags purple_conversation_message_get_flags(const PurpleConversationMessage *msg);
 
 /**
  * Get the timestamp of a PurpleConversationMessage
diff --git a/libpurple/conversationtypes.c b/libpurple/conversationtypes.c
--- a/libpurple/conversationtypes.c
+++ b/libpurple/conversationtypes.c
@@ -260,7 +260,7 @@ purple_im_conversation_update_typing(Pur
 
 void
 purple_im_conversation_write(PurpleIMConversation *im, const char *who, const char *message,
-			  PurpleConversationMessageFlags flags, time_t mtime)
+			  PurpleMessageFlags flags, time_t mtime)
 {
 	PurpleConversation *c;
 
@@ -269,7 +269,7 @@ purple_im_conversation_write(PurpleIMCon
 
 	c = purple_im_conversation_get_conversation(im);
 
-	if ((flags & PURPLE_CONVERSATION_MESSAGE_RECV) == PURPLE_CONVERSATION_MESSAGE_RECV) {
+	if ((flags & PURPLE_MESSAGE_RECV) == PURPLE_MESSAGE_RECV) {
 		purple_im_conversation_set_typing_state(im, PURPLE_IM_CONVERSATION_NOT_TYPING);
 	}
 
@@ -287,7 +287,7 @@ purple_im_conversation_send(PurpleIMConv
 }
 
 void
-purple_im_conversation_send_with_flags(PurpleIMConversation *im, const char *message, PurpleConversationMessageFlags flags)
+purple_im_conversation_send_with_flags(PurpleIMConversation *im, const char *message, PurpleMessageFlags flags)
 {
 	g_return_if_fail(im != NULL);
 	g_return_if_fail(message != NULL);
@@ -451,7 +451,7 @@ purple_chat_conversation_get_id(const Pu
 
 void
 purple_chat_conversation_write(PurpleChatConversation *chat, const char *who, const char *message,
-				PurpleConversationMessageFlags flags, time_t mtime)
+				PurpleMessageFlags flags, time_t mtime)
 {
 	PurpleAccount *account;
 	PurpleConversation *conv;
@@ -469,18 +469,18 @@ purple_chat_conversation_write(PurpleCha



More information about the Commits mailing list