/soc/2013/ankitkv/gobjectification: 7d18eaa14d62: Added Presence.xs

Ankit Vani a at nevitus.org
Fri Jul 19 16:32:25 EDT 2013


Changeset: 7d18eaa14d624a823146bbe18cc4a3f417e9df9d
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-07-20 02:02 +0530
Branch:	 soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/7d18eaa14d62

Description:

Added Presence.xs

diffstat:

 libpurple/plugins/perl/common/MANIFEST       |    1 +
 libpurple/plugins/perl/common/Makefile.mingw |    1 +
 libpurple/plugins/perl/common/Presence.xs    |  104 +++++++++++++++++++++
 libpurple/plugins/perl/common/Status.xs      |  130 +--------------------------
 libpurple/plugins/perl/common/module.h       |    9 +-
 libpurple/plugins/perl/common/typemap        |    5 +-
 6 files changed, 118 insertions(+), 132 deletions(-)

diffs (truncated from 343 to 300 lines):

diff --git a/libpurple/plugins/perl/common/MANIFEST b/libpurple/plugins/perl/common/MANIFEST
--- a/libpurple/plugins/perl/common/MANIFEST
+++ b/libpurple/plugins/perl/common/MANIFEST
@@ -18,6 +18,7 @@ Plugin.xs
 PluginPref.xs
 Pounce.xs
 Prefs.xs
+Presence.xs
 Proxy.xs
 Prpl.xs
 Purple.pm
diff --git a/libpurple/plugins/perl/common/Makefile.mingw b/libpurple/plugins/perl/common/Makefile.mingw
--- a/libpurple/plugins/perl/common/Makefile.mingw
+++ b/libpurple/plugins/perl/common/Makefile.mingw
@@ -59,6 +59,7 @@ XS_FILES =		Account.xs \
 				PluginPref.xs \
 				Pounce.xs \
 				Prefs.xs \
+				Presence.xs \
 				Proxy.xs \
 				Prpl.xs \
 				Request.xs \
diff --git a/libpurple/plugins/perl/common/Presence.xs b/libpurple/plugins/perl/common/Presence.xs
new file mode 100644
--- /dev/null
+++ b/libpurple/plugins/perl/common/Presence.xs
@@ -0,0 +1,104 @@
+#include "module.h"
+
+MODULE = Purple::Presence  PACKAGE = Purple::Presence  PREFIX = purple_presence_
+PROTOTYPES: ENABLE
+
+gint
+purple_presence_compare(presence1, presence2)
+	Purple::Presence presence1
+	Purple::Presence presence2
+
+Purple::Account
+purple_account_presence_get_account(presence)
+	Purple::AccountPresence presence
+
+Purple::Conversation
+purple_conversation_presence_get_conversation(presence)
+	Purple::ConversationPresence presence
+
+Purple::BuddyList::Buddy
+purple_buddy_presence_get_buddy(presence)
+	Purple::BuddyPresence presence
+
+Purple::Status
+purple_presence_get_active_status(presence)
+	Purple::Presence presence
+
+time_t
+purple_presence_get_idle_time(presence)
+	Purple::Presence presence
+
+time_t
+purple_presence_get_login_time(presence)
+	Purple::Presence presence
+
+Purple::Status
+purple_presence_get_status(presence, status_id)
+	Purple::Presence presence
+	const char *status_id
+
+void
+purple_presence_get_statuses(presence)
+	Purple::Presence presence
+PREINIT:
+	GList *l;
+PPCODE:
+	for (l = purple_presence_get_statuses(presence); l != NULL; l = l->next) {
+		XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Status")));
+	}
+
+gboolean
+purple_presence_is_available(presence)
+	Purple::Presence presence
+
+gboolean
+purple_presence_is_idle(presence)
+	Purple::Presence presence
+
+gboolean
+purple_presence_is_online(presence)
+	Purple::Presence presence
+
+gboolean
+purple_presence_is_status_active(presence, status_id)
+	Purple::Presence presence
+	const char *status_id
+
+gboolean
+purple_presence_is_status_primitive_active(presence, primitive)
+	Purple::Presence presence
+	Purple::StatusPrimitive primitive
+
+Purple::AccountPresence
+purple_account_presence_new(account)
+	Purple::Account account
+
+Purple::ConversationPresence
+purple_conversation_presence_new(conv)
+	Purple::Conversation conv
+
+Purple::BuddyPresence
+purple_buddy_presence_new(buddy)
+	Purple::BuddyList::Buddy buddy
+
+void
+purple_presence_set_idle(presence, idle, idle_time)
+	Purple::Presence presence
+	gboolean idle
+	time_t idle_time
+
+void
+purple_presence_set_login_time(presence, login_time)
+	Purple::Presence presence
+	time_t login_time
+
+void
+purple_presence_set_status_active(presence, status_id, active)
+	Purple::Presence presence
+	const char *status_id
+	gboolean active
+
+void
+purple_presence_switch_status(presence, status_id)
+	Purple::Presence presence
+	const char *status_id
diff --git a/libpurple/plugins/perl/common/Status.xs b/libpurple/plugins/perl/common/Status.xs
--- a/libpurple/plugins/perl/common/Status.xs
+++ b/libpurple/plugins/perl/common/Status.xs
@@ -39,22 +39,14 @@ purple_status_set_active_with_attrs(stat
 
 	*/
 
-MODULE = Purple::Status  PACKAGE = Purple::Presence  PREFIX = purple_presence_
+MODULE = Purple::Status  PACKAGE = Purple::Primitive  PREFIX = purple_primitive_
 PROTOTYPES: ENABLE
 
 BOOT:
 {
-	HV *context_stash = gv_stashpv("Purple::Presence::Context", 1);
 	HV *primitive_stash = gv_stashpv("Purple::Status::Primitive", 1);
 
-	static const constiv *civ, context_const_iv[] = {
-#define const_iv(name) {#name, (IV)PURPLE_PRESENCE_CONTEXT_##name}
-		const_iv(UNSET),
-		const_iv(ACCOUNT),
-		const_iv(CONV),
-		const_iv(BUDDY),
-	};
-	static const constiv primitive_const_iv[] = {
+	static const constiv *civ, primitive_const_iv[] = {
 #undef const_iv
 #define const_iv(name) {#name, (IV)PURPLE_STATUS_##name}
 		const_iv(UNSET),
@@ -67,128 +59,10 @@ BOOT:
 		const_iv(MOBILE),
 	};
 
-	for (civ = context_const_iv + sizeof(context_const_iv) / sizeof(context_const_iv[0]); civ-- > context_const_iv; )
-		newCONSTSUB(context_stash, (char *)civ->name, newSViv(civ->iv));
-
 	for (civ = primitive_const_iv + sizeof(primitive_const_iv) / sizeof(primitive_const_iv[0]); civ-- > primitive_const_iv; )
 		newCONSTSUB(primitive_stash, (char *)civ->name, newSViv(civ->iv));
 }
 
-gint
-purple_presence_compare(presence1, presence2)
-	Purple::Presence presence1
-	Purple::Presence presence2
-
-void
-purple_presence_destroy(presence)
-	Purple::Presence presence
-
-Purple::Account
-purple_presence_get_account(presence)
-	Purple::Presence presence
-
-Purple::Status
-purple_presence_get_active_status(presence)
-	Purple::Presence presence
-
-const char *
-purple_presence_get_chat_user(presence)
-	Purple::Presence presence
-
-Purple::PresenceContext
-purple_presence_get_context(presence)
-	Purple::Presence presence
-
-Purple::Conversation
-purple_presence_get_conversation(presence)
-	Purple::Presence presence
-
-time_t
-purple_presence_get_idle_time(presence)
-	Purple::Presence presence
-
-time_t
-purple_presence_get_login_time(presence)
-	Purple::Presence presence
-
-Purple::Status
-purple_presence_get_status(presence, status_id)
-	Purple::Presence presence
-	const char *status_id
-
-void
-purple_presence_get_statuses(presence)
-	Purple::Presence presence
-PREINIT:
-	GList *l;
-PPCODE:
-	for (l = purple_presence_get_statuses(presence); l != NULL; l = l->next) {
-		XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Status")));
-	}
-
-gboolean
-purple_presence_is_available(presence)
-	Purple::Presence presence
-
-gboolean
-purple_presence_is_idle(presence)
-	Purple::Presence presence
-
-gboolean
-purple_presence_is_online(presence)
-	Purple::Presence presence
-
-gboolean
-purple_presence_is_status_active(presence, status_id)
-	Purple::Presence presence
-	const char *status_id
-
-gboolean
-purple_presence_is_status_primitive_active(presence, primitive)
-	Purple::Presence presence
-	Purple::StatusPrimitive primitive
-
-Purple::Presence
-purple_presence_new(context)
-	Purple::PresenceContext context
-
-Purple::Presence
-purple_presence_new_for_account(account)
-	Purple::Account account
-
-Purple::Presence
-purple_presence_new_for_buddy(buddy)
-	Purple::BuddyList::Buddy buddy
-
-Purple::Presence
-purple_presence_new_for_conv(conv)
-	Purple::Conversation conv
-
-void
-purple_presence_set_idle(presence, idle, idle_time)
-	Purple::Presence presence
-	gboolean idle
-	time_t idle_time
-
-void
-purple_presence_set_login_time(presence, login_time)
-	Purple::Presence presence
-	time_t login_time
-
-void
-purple_presence_set_status_active(presence, status_id, active)
-	Purple::Presence presence
-	const char *status_id
-	gboolean active
-
-void
-purple_presence_switch_status(presence, status_id)
-	Purple::Presence presence
-	const char *status_id
-
-MODULE = Purple::Status  PACKAGE = Purple::Primitive  PREFIX = purple_primitive_
-PROTOTYPES: ENABLE
-
 const char *
 purple_primitive_get_id_from_type(type)
 	Purple::StatusPrimitive type
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
@@ -59,6 +59,7 @@ typedef struct group *Purple__Group;
 #include "pluginpref.h"
 #include "pounce.h"
 #include "prefs.h"
+#include "presence.h"
 #include "prpl.h"
 #include "proxy.h"
 #include "request.h"
@@ -223,6 +224,12 @@ typedef PurplePounceEvent			Purple__Poun



More information about the Commits mailing list