changeset 6509:e74e378e86bf

[gaim-migrate @ 7026] This changes the sending and receiving signals to use GaimAccounts and recipient/sender usernames rather than GaimConversations. The display* signals aren't changed yet because I'm not sure I fully grok them. committer: Tailor Script <tailor@pidgin.im>
author Ethan Blanton <elb@pidgin.im>
date Tue, 19 Aug 2003 23:52:07 +0000
parents cbd24b37350d
children 1c7ceac520e5
files plugins/signals-test.c src/conversation.c src/server.c src/signals.c src/signals.h
diffstat 5 files changed, 98 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/signals-test.c	Tue Aug 19 21:47:36 2003 +0000
+++ b/plugins/signals-test.c	Tue Aug 19 23:52:07 2003 +0000
@@ -175,31 +175,32 @@
 }
 
 static gboolean
-sending_im_msg_cb(GaimConversation *conv, char **buffer, void *data)
+sending_im_msg_cb(GaimAccount *account, char *recipient, char **buffer, void *data)
 {
 	gaim_debug(GAIM_DEBUG_MISC, "signals test",
-			   "sending-im-msg (%s, %s)\n",
-			   gaim_conversation_get_name(conv), *buffer);
+			   "sending-im-msg (%s, %s, %s)\n",
+			   gaim_account_get_username(account), recipient,
+			   *buffer);
 
 	return FALSE;
 }
 
 static void
-sent_im_msg_cb(GaimConversation *conv, const char *buffer, void *data)
+sent_im_msg_cb(GaimAccount *account, const char *recipient, const char *buffer, void *data)
 {
 	gaim_debug(GAIM_DEBUG_MISC, "signals test",
-			   "sent-im-msg (%s, %s)\n",
-			   gaim_conversation_get_name(conv), buffer);
+			   "sent-im-msg (%s, %s, %s)\n",
+			   gaim_account_get_username(account),
+			   recipient, buffer);
 }
 
 static gboolean
-received_im_msg_cb(GaimAccount *account, GaimConversation *conv,
-				   char **sender, char **buffer, int *flags, void *data)
+received_im_msg_cb(GaimAccount *account, char **sender, char **buffer,
+				   int *flags, void *data)
 {
 	gaim_debug(GAIM_DEBUG_MISC, "signals test",
-			   "received-im-msg (%s, %s, %s, %s, %d)\n",
-			   gaim_account_get_username(account),
-			   gaim_conversation_get_name(conv), *sender, *buffer, *flags);
+			   "received-im-msg (%s, %s, %s, %d)\n",
+			   gaim_account_get_username(account), *sender, *buffer, *flags);
 
 	return FALSE;
 }
@@ -223,31 +224,30 @@
 }
 
 static gboolean
-sending_chat_msg_cb(GaimConversation *conv, char **buffer, void *data)
+sending_chat_msg_cb(GaimAccount *account, char **buffer, int id, void *data)
 {
 	gaim_debug(GAIM_DEBUG_MISC, "signals test",
-			   "sending-chat-msg (%s, %s)\n",
-			   gaim_conversation_get_name(conv), *buffer);
+			   "sending-chat-msg (%s, %s, %d)\n",
+			   gaim_account_get_username(account), *buffer, id);
 
 	return FALSE;
 }
 
 static void
-sent_chat_msg_cb(GaimConversation *conv, const char *buffer, void *data)
+sent_chat_msg_cb(GaimAccount *account, const char *buffer, int id, void *data)
 {
 	gaim_debug(GAIM_DEBUG_MISC, "signals test",
-			   "sent-chat-msg (%s, %s)\n",
-			   gaim_conversation_get_name(conv), buffer);
+			   "sent-chat-msg (%s, %s, %d)\n",
+			   gaim_account_get_username(account), buffer, id);
 }
 
 static gboolean
-received_chat_msg_cb(GaimAccount *account, GaimConversation *conv,
-					 char **sender, char **buffer, void *data)
+received_chat_msg_cb(GaimAccount *account, char **sender, char **buffer,
+					 int id, void *data)
 {
 	gaim_debug(GAIM_DEBUG_MISC, "signals test",
-			   "received-chat-msg (%s, %s, %s, %s)\n",
-			   gaim_account_get_username(account),
-			   gaim_conversation_get_name(conv), *sender, *buffer);
+			   "received-chat-msg (%s, %s, %s, %s, %d)\n",
+			   gaim_account_get_username(account), *sender, *buffer, id);
 
 	return FALSE;
 }
--- a/src/conversation.c	Tue Aug 19 21:47:36 2003 +0000
+++ b/src/conversation.c	Tue Aug 19 23:52:07 2003 +0000
@@ -259,7 +259,8 @@
 
 		buffy = g_strdup(buf);
 		gaim_signal_emit(gaim_conversations_get_handle(), "sending-im-msg",
-						 conv, &buffy);
+						 gaim_conversation_get_account(conv),
+						 gaim_conversation_get_name(conv), &buffy);
 
 		if (buffy != NULL) {
 			int imflags = 0;
@@ -392,7 +393,8 @@
 			}
 
 			gaim_signal_emit(gaim_conversations_get_handle(), "sent-im-msg",
-							 conv, buffy);
+							 gaim_conversation_get_account(conv),
+							 gaim_conversation_get_name(conv), buffy);
 
 			g_free(buffy);
 		}
@@ -401,13 +403,15 @@
 		buffy = g_strdup(buf);
 
 		gaim_signal_emit(gaim_conversations_get_handle(), "sending-chat-msg",
-						 conv, &buffy);
+						 gaim_conversation_get_account(conv), &buffy,
+						 gaim_chat_get_id(GAIM_CHAT(conv)));
 
 		if (buffy != NULL) {
 			err = serv_chat_send(gc, gaim_chat_get_id(GAIM_CHAT(conv)), buffy);
 
 			gaim_signal_emit(gaim_conversations_get_handle(), "sent-chat-msg",
-							 conv, buf);
+							 gaim_conversation_get_account(conv), buf,
+							 gaim_chat_get_id(GAIM_CHAT(conv)));
 
 			g_free(buffy);
 		}
@@ -2621,22 +2625,22 @@
 	gaim_signal_register(handle, "displayed-im-msg",
 						 gaim_marshal_VOID__POINTER_POINTER);
 	gaim_signal_register(handle, "sending-im-msg",
-						 gaim_marshal_VOID__POINTER_POINTER);
+						 gaim_marshal_VOID__POINTER_POINTER_POINTER);
 	gaim_signal_register(handle, "sent-im-msg",
-						 gaim_marshal_VOID__POINTER_POINTER);
+						 gaim_marshal_VOID__POINTER_POINTER_POINTER);
 	gaim_signal_register(handle, "received-im-msg",
-			gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER);
+						 gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER);
 
 	gaim_signal_register(handle, "displaying-chat-msg",
-						 gaim_marshal_BOOLEAN__POINTER_POINTER);
+						 gaim_marshal_BOOLEAN__POINTER_POINTER_UINT);
 	gaim_signal_register(handle, "displayed-chat-msg",
-						 gaim_marshal_VOID__POINTER_POINTER);
+						 gaim_marshal_VOID__POINTER_POINTER_UINT);
 	gaim_signal_register(handle, "sending-chat-msg",
-						 gaim_marshal_VOID__POINTER_POINTER);
+						 gaim_marshal_VOID__POINTER_POINTER_UINT);
 	gaim_signal_register(handle, "sent-chat-msg",
-						 gaim_marshal_VOID__POINTER_POINTER);
+						 gaim_marshal_VOID__POINTER_POINTER_UINT);
 	gaim_signal_register(handle, "received-chat-msg",
-						 gaim_marshal_VOID__POINTER_POINTER_POINTER_POINTER);
+				gaim_marshal_VOID__POINTER_POINTER_POINTER_UINT);
 
 	gaim_signal_register(handle, "conversation-switching",
 						 gaim_marshal_VOID__POINTER_POINTER);
--- a/src/server.c	Tue Aug 19 21:47:36 2003 +0000
+++ b/src/server.c	Tue Aug 19 23:52:07 2003 +0000
@@ -858,8 +858,8 @@
 
 		plugin_return = GPOINTER_TO_INT(
 			gaim_signal_emit_return_1(gaim_conversations_get_handle(),
-									  "received-im-msg",
-									  cnv, &angel, &buffy, &flags));
+									  "received-im-msg", gc->account,
+									  &angel, &buffy, &flags));
 
 		if (!buffy || !angel || plugin_return) {
 			if (buffy)
@@ -1472,8 +1472,9 @@
 
 	plugin_return = GPOINTER_TO_INT(
 		gaim_signal_emit_return_1(gaim_conversations_get_handle(),
-								  "received-chat-msg",
-								  conv, &angel, &buffy));
+								  "received-chat-msg", g->account,
+								  &angel, &buffy,
+								  gaim_chat_get_id(GAIM_CHAT(conv))));
 
 	if (!buffy || !angel || plugin_return) {
 		if (buffy)
--- a/src/signals.c	Tue Aug 19 21:47:36 2003 +0000
+++ b/src/signals.c	Tue Aug 19 23:52:07 2003 +0000
@@ -491,6 +491,21 @@
 
 	((void (*)(void *, void *, void *, void *, void *))cb)(arg1, arg2, arg3, arg4, data);
 }
+
+void
+gaim_marshal_VOID__POINTER_POINTER_POINTER_UINT(GaimCallback cb,
+												   va_list args,
+												   void *data,
+												   void **return_val)
+{
+	void *arg1 = va_arg(args, void *);
+	void *arg2 = va_arg(args, void *);
+	void *arg3 = va_arg(args, void *);
+	guint arg4 = va_arg(args, guint);
+
+	((void (*)(void *, void *, void *, guint, void *))cb)(arg1, arg2, arg3, arg4, data);
+}
+
 void
 gaim_marshal_VOID__POINTER_POINTER_POINTER_UINT_UINT(GaimCallback cb,
 													 va_list args,
@@ -535,6 +550,40 @@
 }
 
 void
+gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER(GaimCallback cb, va_list args,
+											  void *data, void **return_val)
+{
+	gboolean ret_val;
+	void *arg1 = va_arg(args, void *);
+	void *arg2 = va_arg(args, void *);
+	void *arg3 = va_arg(args, void *);
+
+	ret_val = ((gboolean (*)(void *, void *, void *, void *))cb)(arg1, arg2,
+																 arg3, data);
+
+	if (return_val != NULL)
+		*return_val = GINT_TO_POINTER(ret_val);
+}
+
+void
+gaim_marshal_BOOLEAN__POINTER_POINTER_UINT(GaimCallback cb,
+												   va_list args,
+												   void *data,
+												   void **return_val)
+{
+	gboolean ret_val;
+	void *arg1 = va_arg(args, void *);
+	void *arg2 = va_arg(args, void *);
+	guint arg3 = va_arg(args, guint);
+
+	ret_val = ((gboolean (*)(void *, void *, guint, void *))cb)(
+			arg1, arg2, arg3, data);
+
+	if (return_val != NULL)
+		*return_val = GINT_TO_POINTER(ret_val);
+}
+
+void
 gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_UINT(GaimCallback cb,
 												   va_list args,
 												   void *data,
--- a/src/signals.h	Tue Aug 19 21:47:36 2003 +0000
+++ b/src/signals.h	Tue Aug 19 23:52:07 2003 +0000
@@ -228,6 +228,8 @@
 		GaimCallback cb, va_list args, void *data, void **return_val);
 void gaim_marshal_VOID__POINTER_POINTER_POINTER_POINTER(
 		GaimCallback cb, va_list args, void *data, void **return_val);
+void gaim_marshal_VOID__POINTER_POINTER_POINTER_UINT(
+		GaimCallback cb, va_list args, void *data, void **return_val);
 void gaim_marshal_VOID__POINTER_POINTER_POINTER_UINT_UINT(
 		GaimCallback cb, va_list args, void *data, void **return_val);
 
@@ -235,6 +237,10 @@
 		GaimCallback cb, va_list args, void *data, void **return_val);
 void gaim_marshal_BOOLEAN__POINTER_POINTER(
 		GaimCallback cb, va_list args, void *data, void **return_val);
+void gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER(
+		GaimCallback cb, va_list args, void *data, void **return_val);
+void gaim_marshal_BOOLEAN__POINTER_POINTER_UINT(
+		GaimCallback cb, va_list args, void *data, void **return_val);
 void gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_UINT(
 		GaimCallback cb, va_list args, void *data, void **return_val);
 void gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER(