/soc/2013/ankitkv/gobjectification: 89e6c5346d63: Begun refactor...

Ankit Vani a at nevitus.org
Sat Jun 22 05:25:36 EDT 2013


Changeset: 89e6c5346d63526512cf70614b1962148f82f409
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-06-22 14:55 +0530
Branch:	 soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/89e6c5346d63

Description:

Begun refactoring for PurpleConversation

diffstat:

 libpurple/conversation.h               |   8 +++-----
 libpurple/conversations.h              |   6 ++++--
 libpurple/log.h                        |   4 ++--
 libpurple/plugins/perl/common/module.h |  20 +++++++++-----------
 libpurple/plugins/perl/common/typemap  |  19 +++++++++----------
 libpurple/prpl.h                       |  10 +++++-----
 libpurple/purple.h.in                  |   4 ++--
 libpurple/server.h                     |  16 ++++++++--------
 8 files changed, 42 insertions(+), 45 deletions(-)

diffs (300 lines):

diff --git a/libpurple/conversation.h b/libpurple/conversation.h
--- a/libpurple/conversation.h
+++ b/libpurple/conversation.h
@@ -118,7 +118,6 @@ typedef enum /*< flags >*/
 #include "account.h"
 #include "buddyicon.h"
 #include "log.h"
-#include "server.h"
 
 /**************************************************************************/
 /** PurpleConversation                                                    */
@@ -233,7 +232,7 @@ struct _PurpleConversationUiOps
 
 	/* Custom Smileys */
 	gboolean (*custom_smiley_add)(PurpleConversation *conv, const char *smile,
-	                            boolean remote);
+	                            gboolean remote);
 	void (*custom_smiley_write)(PurpleConversation *conv, const char *smile,
 	                            const guchar *data, gsize size);
 	void (*custom_smiley_close)(PurpleConversation *conv, const char *smile);
@@ -269,8 +268,7 @@ G_BEGIN_DECLS
  *
  * @return The new conversation.
  */
-PurpleConversation *purple_conversation_new(PurpleConversationType type,
-										PurpleAccount *account,
+PurpleConversation *purple_conversation_new(PurpleAccount *account,
 										const char *name);
 
 /** TODO dispose/fnalize
@@ -300,7 +298,7 @@ void purple_conversation_present(PurpleC
  *
  * @return The conversation's type.
  */
-PurpleConversationType purple_conversation_get_type(const PurpleConversation *conv);
+/*PurpleConversationType purple_conversation_get_type(const PurpleConversation *conv);*/
 
 /**
  * Sets the specified conversation's UI operations structure.
diff --git a/libpurple/conversations.h b/libpurple/conversations.h
--- a/libpurple/conversations.h
+++ b/libpurple/conversations.h
@@ -28,6 +28,8 @@
 #define _PURPLE_CONVERSATIONS_H_
 
 #include "conversation.h"
+#include "conversationtypes.h"
+#include "server.h"
 
 G_BEGIN_DECLS
 
@@ -59,7 +61,7 @@ GList *purple_conversations_get_ims(void
  */
 GList *purple_conversations_get_chats(void);
 
-/**
+/** TODO type
  * Finds a conversation with the specified type, name, and Purple account.
  *
  * @param type The type of the conversation.
@@ -69,7 +71,7 @@ GList *purple_conversations_get_chats(vo
  * @return The conversation if found, or @c NULL otherwise.
  */
 PurpleConversation *purple_conversations_find_with_account(
-		PurpleConversationType type, const char *name,
+		GType type, const char *name,
 		const PurpleAccount *account);
 
 /**
diff --git a/libpurple/log.h b/libpurple/log.h
--- a/libpurple/log.h
+++ b/libpurple/log.h
@@ -70,7 +70,7 @@ struct _PurpleLogLogger {
 
 	/** This is used to write to the log file */
 	gsize (*write)(PurpleLog *log,
-		     PurpleMessageFlags type,
+		     PurpleConversationMessageFlags type,
 		     const char *from,
 		     time_t time,
 		     const char *message);
@@ -222,7 +222,7 @@ void purple_log_free(PurpleLog *log);
  * @param message      The message to log
  */
 void purple_log_write(PurpleLog *log,
-		    PurpleMessageFlags type,
+		    PurpleConversationMessageFlags type,
 		    const char *from,
 		    time_t time,
 		    const char *message);
diff --git a/libpurple/plugins/perl/common/module.h b/libpurple/plugins/perl/common/module.h
--- a/libpurple/plugins/perl/common/module.h
+++ b/libpurple/plugins/perl/common/module.h
@@ -19,7 +19,6 @@ typedef struct group *Purple__Group;
 
 #include "../perl-common.h"
 
-#include "account.h"
 #include "accounts.h"
 #include "accountopt.h"
 #include "blist.h"
@@ -29,7 +28,7 @@ typedef struct group *Purple__Group;
 #include "hash.h"
 #include "cmds.h"
 #include "connection.h"
-#include "conversation.h"
+#include "conversations.h"
 #include "core.h"
 #include "debug.h"
 #include "desktopitem.h"
@@ -110,16 +109,15 @@ typedef PurpleConnection *		Purple__Conn
 typedef PurpleConnectionFlags		Purple__ConnectionFlags;
 typedef PurpleConnectionState		Purple__ConnectionState;
 
-/* conversation.h */
-typedef PurpleConversationType		Purple__ConversationType;
-typedef PurpleConvUpdateType		Purple__ConvUpdateType;
-typedef PurpleTypingState			Purple__TypingState;
-typedef PurpleMessageFlags		Purple__MessageFlags;
-typedef PurpleConvChatBuddyFlags		Purple__ConvChatBuddyFlags;
+/* conversations.h */
+typedef PurpleConversationUpdateType		Purple__Conversation__UpdateType;
+typedef PurpleIMConversationTypingState		Purple__IMConversation__TypingState;
+typedef PurpleConversationMessageFlags		Purple__Conversation__MessageFlags;
+typedef PurpleChatConversationBuddyFlags	Purple__ChatConversation__Buddy__Flags;
 typedef PurpleConversation *		Purple__Conversation;
-typedef PurpleConvIm *			Purple__Conversation__IM;
-typedef PurpleConvChat *			Purple__Conversation__Chat;
-typedef PurpleConvChatBuddy *		Purple__Conversation__ChatBuddy;
+typedef PurpleIMConversation *			Purple__IMConversation;
+typedef PurpleChatConversation *		Purple__ChatConversation;
+typedef PurpleChatConversationBuddy *	Purple__ChatConversation__Buddy;
 
 /* core.h */
 
diff --git a/libpurple/plugins/perl/common/typemap b/libpurple/plugins/perl/common/typemap
--- a/libpurple/plugins/perl/common/typemap
+++ b/libpurple/plugins/perl/common/typemap
@@ -61,10 +61,6 @@ Purple::Cmd::Id				T_IV
 Purple::Cmd::Priority			T_IV
 Purple::Cmd::Ret				T_IV
 Purple::Connection			T_PurpleObj
-Purple::Conversation			T_PurpleObj
-Purple::Conversation::Chat		T_PurpleObj
-Purple::Conversation::ChatBuddy		T_PurpleObj
-Purple::Conversation::IM			T_PurpleObj
 Purple::Core				T_PurpleObj
 
 Purple::Desktop::Item			T_PurpleObj
@@ -178,12 +174,15 @@ Purple::Cipher::BatchMode	T_IV
 /* debug.h */
 Purple::DebugLevel			T_IV
 
-/* conversation.h */
-Purple::ConvChatBuddyFlags		T_IV
-Purple::ConvUpdateType			T_IV
-Purple::ConversationType		T_IV
-Purple::MessageFlags			T_IV
-Purple::TypingState			T_IV
+/* conversations.h */
+Purple::Conversation			T_PurpleObj
+Purple::ChatConversation		T_PurpleObj
+Purple::ChatConversation::Buddy		T_PurpleObj
+Purple::IMConversation			T_PurpleObj
+Purple::ChatConversation::Buddy::Flags	T_IV
+Purple::Conversation::UpdateType	T_IV
+Purple::Conversation::MessageFlags	T_IV
+Purple::IMConversation::TypingState	T_IV
 Purple::UnseenState			T_IV
 
 /* connection.h */
diff --git a/libpurple/prpl.h b/libpurple/prpl.h
--- a/libpurple/prpl.h
+++ b/libpurple/prpl.h
@@ -72,7 +72,7 @@ typedef struct _PurpleThumbnailSpec Purp
 #endif
 
 #include "blist.h"
-#include "conversation.h"
+#include "conversations.h"
 #include "ft.h"
 #include "imgstore.h"
 #include "media.h"
@@ -327,7 +327,7 @@ struct _PurplePluginProtocolInfo
 	 */
 	int  (*send_im)(PurpleConnection *, const char *who,
 					const char *message,
-					PurpleMessageFlags flags);
+					PurpleConversationMessageFlags flags);
 
 	void (*set_info)(PurpleConnection *, const char *info);
 
@@ -338,7 +338,7 @@ struct _PurplePluginProtocolInfo
 	 *         seconds to wait before sending a subsequent notification.
 	 *         Otherwise the PRPL should return 0.
 	 */
-	unsigned int (*send_typing)(PurpleConnection *, const char *name, PurpleTypingState state);
+	unsigned int (*send_typing)(PurpleConnection *, const char *name, PurpleIMConversationTypingState state);
 
 	/**
 	 * Should arrange for purple_notify_userinfo() to be called with
@@ -438,12 +438,12 @@ struct _PurplePluginProtocolInfo
 	 *
 	 * @param id      The id of the chat to send the message to.
 	 * @param message The message to send to the chat.
-	 * @param flags   A bitwise OR of #PurpleMessageFlags representing
+	 * @param flags   A bitwise OR of #PurpleConversationMessageFlags representing
 	 *                message flags.
 	 * @return 	  A positive number or 0 in case of success,
 	 *                a negative error number in case of failure.
 	 */
-	int  (*chat_send)(PurpleConnection *, int id, const char *message, PurpleMessageFlags flags);
+	int  (*chat_send)(PurpleConnection *, int id, const char *message, PurpleConversationMessageFlags flags);
 
 	/** If implemented, this will be called regularly for this prpl's
 	 *  active connections.  You'd want to do this if you need to repeatedly
diff --git a/libpurple/purple.h.in b/libpurple/purple.h.in
--- a/libpurple/purple.h.in
+++ b/libpurple/purple.h.in
@@ -44,7 +44,7 @@
 
 @PLUGINS_DEFINE@
 
-#include <account.h>
+#include <accounts.h>
 #include <accountopt.h>
 #include <blist.h>
 #include <buddyicon.h>
@@ -53,7 +53,7 @@
 #include <circularbuffer.h>
 #include <cmds.h>
 #include <connection.h>
-#include <conversation.h>
+#include <conversations.h>
 #include <core.h>
 #include <debug.h>
 #include <desktopitem.h>
diff --git a/libpurple/server.h b/libpurple/server.h
--- a/libpurple/server.h
+++ b/libpurple/server.h
@@ -26,8 +26,8 @@
 #ifndef _PURPLE_SERVER_H_
 #define _PURPLE_SERVER_H_
 
-#include "account.h"
-#include "conversation.h"
+#include "accounts.h"
+#include "conversations.h"
 #include "prpl.h"
 
 G_BEGIN_DECLS
@@ -48,10 +48,10 @@ G_BEGIN_DECLS
  *         user is still typing then Purple will send another PURPLE_TYPING
  *         message.
  */
-unsigned int serv_send_typing(PurpleConnection *gc, const char *name, PurpleTypingState state);
+unsigned int serv_send_typing(PurpleConnection *gc, const char *name, PurpleIMConversationTypingState state);
 
 void serv_move_buddy(PurpleBuddy *, PurpleGroup *, PurpleGroup *);
-int  serv_send_im(PurpleConnection *, const char *, const char *, PurpleMessageFlags flags);
+int  serv_send_im(PurpleConnection *, const char *, const char *, PurpleConversationMessageFlags flags);
 
 /** Get information about an account's attention commands, from the prpl.
  *
@@ -70,7 +70,7 @@ void serv_set_permit_deny(PurpleConnecti
 void serv_chat_invite(PurpleConnection *, int, const char *, const char *);
 void serv_chat_leave(PurpleConnection *, int);
 void serv_chat_whisper(PurpleConnection *, int, const char *, const char *);
-int  serv_chat_send(PurpleConnection *, int, const char *, PurpleMessageFlags flags);
+int  serv_chat_send(PurpleConnection *, int, const char *, PurpleConversationMessageFlags flags);
 void serv_alias_buddy(PurpleBuddy *);
 void serv_got_alias(PurpleConnection *gc, const char *who, const char *alias);
 
@@ -103,7 +103,7 @@ void purple_serv_got_private_alias(Purpl
  * @param state   The typing state received
  */
 void serv_got_typing(PurpleConnection *gc, const char *name, int timeout,
-					 PurpleTypingState state);
+					 PurpleIMConversationTypingState state);
 
 /**
  * TODO: Could probably move this into the conversation API.
@@ -111,7 +111,7 @@ void serv_got_typing(PurpleConnection *g
 void serv_got_typing_stopped(PurpleConnection *gc, const char *name);
 
 void serv_got_im(PurpleConnection *gc, const char *who, const char *msg,
-				 PurpleMessageFlags flags, time_t mtime);
+				 PurpleConversationMessageFlags flags, time_t mtime);
 
 /**
  * @param data The hash function should be g_str_hash() and the equal
@@ -180,7 +180,7 @@ void serv_got_chat_left(PurpleConnection
  * @param mtime   The time when the message was received.
  */
 void serv_got_chat_in(PurpleConnection *g, int id, const char *who,
-					  PurpleMessageFlags flags, const char *message, time_t mtime);
+					  PurpleConversationMessageFlags flags, const char *message, time_t mtime);
 void serv_send_file(PurpleConnection *gc, const char *who, const char *file);
 
 G_END_DECLS



More information about the Commits mailing list