changeset 6591:d25ae4b5a204

[gaim-migrate @ 7115] Added the perl API for the conversation framework. Untested.. Should work. We'll see. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Sun, 24 Aug 2003 02:43:27 +0000
parents edda487ef5df
children b1ea29d1293e
files plugins/perl/common/ConvWindow.xs plugins/perl/common/Conversation.xs plugins/perl/common/Conversation_Chat.xs plugins/perl/common/Conversation_IM.xs plugins/perl/common/Gaim.xs plugins/perl/common/module.h plugins/perl/common/typemap
diffstat 7 files changed, 393 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/perl/common/ConvWindow.xs	Sun Aug 24 02:43:27 2003 +0000
@@ -0,0 +1,88 @@
+#include "module.h"
+
+MODULE = Gaim::ConvWindow  PACKAGE = Gaim::ConvWindow  PREFIX = gaim_window_
+PROTOTYPES: ENABLE
+
+Gaim::ConvWindow
+gaim_window_new()
+
+void
+DESTROY(win)
+	Gaim::ConvWindow win
+CODE:
+	gaim_window_destroy(win);
+
+
+void
+gaim_window_show(win)
+	Gaim::ConvWindow win
+
+void
+gaim_window_hide(win)
+	Gaim::ConvWindow win
+
+void
+gaim_window_raise(win)
+	Gaim::ConvWindow win
+
+void
+gaim_window_flash(win)
+	Gaim::ConvWindow flash
+
+int
+gaim_window_add_conversation(win, conv)
+	Gaim::ConvWindow win
+	Gaim::Conversation conv
+
+Gaim::Conversation
+gaim_window_remove_conversation(win, index)
+	Gaim::ConvWindow win
+	unsigned int index
+
+void
+gaim_window_move_conversation(win, index, new_index)
+	Gaim::ConvWindow win
+	unsigned int index
+	unsigned int new_index
+
+Gaim::Conversation
+gaim_window_get_conversation_at(win, index)
+	Gaim::ConvWindow win
+	unsigned int index
+
+size_t
+gaim_window_get_conversation_count(win)
+	Gaim::ConvWindow win
+
+void
+gaim_window_switch_conversation(win, index)
+	Gaim::ConvWindow win
+	unsigned int index
+
+Gaim::Conversation
+gaim_window_get_active_conversation(win)
+	Gaim::ConvWindow win
+
+void
+conversations(win)
+	Gaim::ConvWindow win
+PREINIT:
+	GList *l;
+CODE:
+	for (l = gaim_window_get_conversations(win); l != NULL; l = l->next)
+	{
+		XPUSHs(sv_2mortal(gaim_perl_bless_object(l->data,
+			"Gaim::Conversation")));
+	}
+
+
+MODULE = Gaim::ConvWindow  PACKAGE = Gaim  PREFIX = gaim_
+PROTOTYPES: ENABLE
+
+void
+conv_windows()
+PREINIT:
+	GList *l;
+CODE:
+	for (l = gaim_get_windows(); l != NULL; l = l->next)
+		XPUSHs(sv_2mortal(gaim_perl_bless_object(l->data, "Gaim::ConvWindow")));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/perl/common/Conversation.xs	Sun Aug 24 02:43:27 2003 +0000
@@ -0,0 +1,134 @@
+#include "module.h"
+
+MODULE = Gaim::Conversation  PACKAGE = Gaim::Conversation  PREFIX = gaim_conversation_
+PROTOTYPES: ENABLE
+
+void
+gaim_conversation_set_account(conv, account)
+	Gaim::Conversation conv
+	Gaim::Account account
+
+Gaim::Account
+gaim_conversation_get_account(conv)
+	Gaim::Conversation conv
+
+Gaim::Connection
+gaim_conversation_get_gc(conv)
+	Gaim::Conversation conv
+
+void
+gaim_conversation_set_title(conv, title)
+	Gaim::Conversation conv
+	const char *title
+
+void
+gaim_conversation_autoset_title(conv)
+	Gaim::Conversation conv
+
+int
+gaim_conversation_get_index(conv)
+	Gaim::Conversation conv
+
+const char *
+gaim_conversation_get_name(conv)
+	Gaim::Conversation conv
+
+void
+gaim_conversation_set_logging(conv, log)
+	Gaim::Conversation conv
+	gboolean log
+
+gboolean
+gaim_conversation_is_logging(conv)
+	Gaim::Conversation conv
+
+Gaim::ConvWindow
+gaim_conversation_get_window(conv)
+	Gaim::Conversation conv
+
+gboolean
+is_chat(conv)
+	Gaim::Conversation conv
+CODE:
+	RETVAL = (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT);
+OUTPUT:
+	RETVAL
+
+gboolean
+is_im(conv)
+	Gaim::Conversation conv
+CODE:
+	RETVAL = (gaim_conversation_get_type(conv) == GAIM_CONV_IM);
+OUTPUT:
+	RETVAL
+
+void
+gaim_conversation_set_data(conv, key, data)
+	Gaim::Conversation conv
+	const char *key
+	void *data
+
+void *
+gaim_conversation_get_data(conv, key)
+	Gaim::Conversation conv
+	const char *key
+
+void
+gaim_conversation_write(conv, who, message, flags)
+	Gaim::Conversation conv
+	const char *who
+	const char *message
+	int flags
+CODE:
+	gaim_conversation_write(conv, who, message, -1, flags, time(NULL));
+
+Gaim::Conversation::IM
+gaim_conversation_get_im_data(conv)
+	Gaim::Conversation conv
+
+Gaim::Conversation::Chat
+gaim_conversation_get_chat_data(conv)
+	Gaim::Conversation conv
+
+
+MODULE = Gaim::Conversation  PACKAGE = Gaim::Conversations  PREFIX = gaim_conversations_
+PROTOTYPES: ENABLE
+
+Gaim::Conversation
+find(name)
+	const char *name
+CODE:
+	RETVAL = gaim_find_conversation(name);
+OUTPUT:
+	RETVAL
+
+Gaim::Conversation
+find_with_account(name, account)
+	const char *name
+	Gaim::Account account
+CODE:
+	RETVAL = gaim_find_conversation_with_account(name, account);
+OUTPUT:
+	RETVAL
+
+void *
+handle()
+CODE:
+	RETVAL = gaim_conversations_get_handle();
+OUTPUT:
+	RETVAL
+
+
+MODULE = Gaim::Conversation  PACKAGE = Gaim  PREFIX = gaim_
+PROTOTYPES: ENABLE
+
+void
+conversations()
+PREINIT:
+	GList *l;
+PPCODE:
+	for (l = gaim_get_conversations(); l != NULL; l = l->next)
+	{
+		XPUSHs(sv_2mortal(gaim_perl_bless_object(l->data,
+			"Gaim::Conversation")));
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/perl/common/Conversation_Chat.xs	Sun Aug 24 02:43:27 2003 +0000
@@ -0,0 +1,102 @@
+#include "module.h"
+
+MODULE = Gaim::Conversation::Chat  PACKAGE = Gaim::Conversation::Chat  PREFIX = gaim_chat_
+PROTOTYPES: ENABLE
+
+Gaim::Conversation::Chat
+new(account, name)
+	Gaim::Account account
+	const char *name
+CODE:
+	RETVAL = GAIM_CHAT(gaim_conversation_new(GAIM_CONV_CHAT, account, name));
+OUTPUT:
+	RETVAL
+
+void
+DESTROY(chat)
+	Gaim::Conversation::Chat chat
+CODE:
+	gaim_conversation_destroy(gaim_chat_get_conversation(chat));
+
+
+Gaim::Conversation
+gaim_chat_get_conversation(chat)
+	Gaim::Conversation::Chat chat
+
+void
+users(chat)
+	Gaim::Conversation::Chat chat
+PREINIT:
+	GList *l;
+PPCODE:
+	for (l = gaim_chat_get_users(chat); l != NULL; l = l->next)
+	{
+		XPUSHs(sv_2mortal(newSVpv(l->data, 0)));
+	}
+
+void
+gaim_chat_ignore(chat, name)
+	Gaim::Conversation::Chat chat
+	const char *name
+
+void
+gaim_chat_unignore(chat, name)
+	Gaim::Conversation::Chat chat
+	const char *name
+
+void
+ignored_users(chat)
+	Gaim::Conversation::Chat chat
+PREINIT:
+	GList *l;
+PPCODE:
+	for (l = gaim_chat_get_ignored(chat); l != NULL; l = l->next)
+	{
+		XPUSHs(sv_2mortal(newSVpv(l->data, 0)));
+	}
+
+gboolean
+gaim_chat_is_user_ignored(chat, user)
+	Gaim::Conversation::Chat chat
+	const char *user
+
+void
+gaim_chat_set_topic(chat, who, topic)
+	Gaim::Conversation::Chat chat
+	const char *who
+	const char *topic
+
+const char *
+gaim_chat_get_topic(chat)
+	Gaim::Conversation::Chat chat
+
+int
+gaim_chat_get_id(chat)
+	Gaim::Conversation::Chat chat
+
+void
+write(chat, who, message, flags)
+	Gaim::Conversation::Chat chat
+	const char *who
+	const char *message
+	int flags
+
+void
+gaim_chat_send(chat, message)
+	Gaim::Conversation::Chat chat
+	const char *message
+
+
+MODULE = Gaim::Conversation  PACKAGE = Gaim  PREFIX = gaim_
+PROTOTYPES: ENABLE
+
+void
+chats()
+PREINIT:
+	GList *l;
+PPCODE:
+	for (l = gaim_get_chats(); l != NULL; l = l->next)
+	{
+		XPUSHs(sv_2mortal(gaim_perl_bless_object(l->data,
+			"Gaim::Conversation")));
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/perl/common/Conversation_IM.xs	Sun Aug 24 02:43:27 2003 +0000
@@ -0,0 +1,53 @@
+#include "module.h"
+
+MODULE = Gaim::Conversation::IM  PACKAGE = Gaim::Conversation::IM  PREFIX = gaim_im_
+PROTOTYPES: ENABLE
+
+Gaim::Conversation::IM
+new(account, name)
+	Gaim::Account account
+	const char *name
+CODE:
+	RETVAL = GAIM_IM(gaim_conversation_new(GAIM_CONV_IM, account, name));
+OUTPUT:
+	RETVAL
+
+void
+DESTROY(im)
+	Gaim::Conversation::IM im
+CODE:
+	gaim_conversation_destroy(gaim_im_get_conversation(im));
+
+
+Gaim::Conversation
+gaim_im_get_conversation(im)
+	Gaim::Conversation::IM im
+
+void
+gaim_im_write(im, who, message, flags)
+	Gaim::Conversation::IM im
+	const char *who
+	const char *message
+	int flags
+CODE:
+	gaim_im_write(im, who, message, -1, flags, time(NULL));
+
+void
+gaim_im_send(im, message)
+	Gaim::Conversation::IM im
+	const char *message
+
+
+MODULE = Gaim::Conversation::IM  PACKAGE = Gaim  PREFIX = gaim_
+PROTOTYPES: ENABLE
+
+void
+ims()
+PREINIT:
+	GList *l;
+PPCODE:
+	for (l = gaim_get_ims(); l != NULL; l = l->next)
+	{
+		XPUSHs(sv_2mortal(gaim_perl_bless_object(GAIM_IM(l->data),
+			"Gaim::Conversation")));
+	}
--- a/plugins/perl/common/Gaim.xs	Sun Aug 24 01:57:38 2003 +0000
+++ b/plugins/perl/common/Gaim.xs	Sun Aug 24 02:43:27 2003 +0000
@@ -91,4 +91,8 @@
 	GAIM_PERL_BOOT(BuddyList__Buddy);
 	GAIM_PERL_BOOT(BuddyList__Chat);
 	GAIM_PERL_BOOT(Connection);
+	GAIM_PERL_BOOT(Conversation);
+	GAIM_PERL_BOOT(Conversation__Chat);
+	GAIM_PERL_BOOT(Conversation__IM);
+	GAIM_PERL_BOOT(ConvWindow);
 
--- a/plugins/perl/common/module.h	Sun Aug 24 01:57:38 2003 +0000
+++ b/plugins/perl/common/module.h	Sun Aug 24 02:43:27 2003 +0000
@@ -13,15 +13,19 @@
 
 #include "account.h"
 #include "connection.h"
+#include "conversation.h"
 #include "debug.h"
 #include "server.h"
 
 typedef GaimAccount *     Gaim__Account;
-typedef GaimConnection *  Gaim__Connection;
-typedef GaimConversation *Gaim__Conversation;
-typedef GaimPlugin *      Gaim__Plugin;
 typedef struct buddy *    Gaim__BuddyList__Buddy;
 typedef struct chat *     Gaim__BuddyList__Chat;
 typedef struct group *    Gaim__BuddyList__Group;
+typedef GaimConnection *  Gaim__Connection;
+typedef GaimConversation *Gaim__Conversation;
+typedef GaimChat *        Gaim__Conversation__Chat;
+typedef GaimIm *          Gaim__Conversation__IM;
+typedef GaimWindow *      Gaim__ConvWindow;
+typedef GaimPlugin *      Gaim__Plugin;
 
 typedef GaimDebugLevel Gaim__DebugLevel;
--- a/plugins/perl/common/typemap	Sun Aug 24 01:57:38 2003 +0000
+++ b/plugins/perl/common/typemap	Sun Aug 24 02:43:27 2003 +0000
@@ -4,9 +4,14 @@
 Gaim::BuddyList::Group   T_GaimObj
 Gaim::BuddyList::Buddy   T_GaimObj
 Gaim::BuddyList::Chat    T_GaimObj
+Gaim::Chat               T_GaimObj
 Gaim::Connection         T_GaimObj
 Gaim::Conversation       T_GaimObj
+Gaim::Conversation::Chat T_GaimObj
+Gaim::Conversation::IM   T_GaimObj
+Gaim::ConvWindow         T_GaimObj
 Gaim::DebugLevel         T_IV
+Gaim::IM                 T_GaimObj
 Gaim::Plugin             T_GaimObj
 
 INPUT