changeset 808:9d61f3d01046

[gaim-migrate @ 818] event_new_conversation committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Thu, 31 Aug 2000 03:40:17 +0000
parents 632d781c29da
children 12d0aaef70fb
files plugins/ChangeLog plugins/SIGNALS plugins/events.c src/conversation.c src/gaim.h src/plugins.c
diffstat 6 files changed, 32 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/ChangeLog	Thu Aug 31 02:12:58 2000 +0000
+++ b/plugins/ChangeLog	Thu Aug 31 03:40:17 2000 +0000
@@ -16,6 +16,13 @@
 	buddy. This got fixed, but now when you sign on, event_buddy_away may
 	be called before event_buddy_signon. Not that it should matter much.
 
+	Just after I finish saying that no more events will be added, I go and
+	add one. Go figure. Anyway, it's event_new_conversation. Enough people
+	asked me to add it, and I found it useful enough, that I finally did
+	add it. It gets passed a char *, the name of the person who the
+	conversation is with. This gets triggered when a new conversation
+	window is created, in case you couldn't figure it out on your own.
+
 version 0.9.20:
 	It's 3 am the night before finals, it's obviously a good time to hack
 	gaim.
--- a/plugins/SIGNALS	Thu Aug 31 02:12:58 2000 +0000
+++ b/plugins/SIGNALS	Thu Aug 31 03:40:17 2000 +0000
@@ -19,7 +19,8 @@
 	event_chat_send,
 	event_warned,
 	event_error,
-	event_quit
+	event_quit,
+	event_new_conversation
 };
 
 To add a signal handler, call the fuction gaim_signal_connect with the
@@ -194,3 +195,10 @@
 	in the login window or the Quit option in the File menu on the buddy
 	list). If gaim dies or is murdered, this won't be called. It's not my
 	fault, it's Seg's.
+
+event_new_conversation:
+	char *who
+
+	'who' is who the conversation is with. This gets called when a new
+	conversation window is created. You can use find_conversation(char *)
+	to then find the struct conversation * and modify those values.
--- a/plugins/events.c	Thu Aug 31 02:12:58 2000 +0000
+++ b/plugins/events.c	Thu Aug 31 03:40:17 2000 +0000
@@ -116,6 +116,11 @@
 	printf("event_quit\n");
 }
 
+void evt_new_conversation(char *who, void *data)
+{
+	printf("event_new_conversation: %s\n", who);
+}
+
 int gaim_plugin_init(void *h)
 {
 	gaim_signal_connect(h, event_signon,           evt_signon, NULL);
@@ -139,6 +144,7 @@
 	gaim_signal_connect(h, event_warned,           evt_warned, NULL);
 	gaim_signal_connect(h, event_error,            evt_error, NULL);
 	gaim_signal_connect(h, event_quit,             evt_quit, NULL);
+	gaim_signal_connect(h, event_new_conversation, evt_new_conversation, NULL);
 	return 0;
 }
 
--- a/src/conversation.c	Thu Aug 31 02:12:58 2000 +0000
+++ b/src/conversation.c	Thu Aug 31 03:40:17 2000 +0000
@@ -144,6 +144,7 @@
 
         show_conv(c);
         conversations = g_list_append(conversations, c);
+	plugin_event(event_new_conversation, name, 0, 0);
         return c;
 }
 
--- a/src/gaim.h	Thu Aug 31 02:12:58 2000 +0000
+++ b/src/gaim.h	Thu Aug 31 03:40:17 2000 +0000
@@ -181,6 +181,7 @@
 	event_warned,
 	event_error,
 	event_quit,
+	event_new_conversation,
 	/* any others? it's easy to add... */
 };
 
@@ -401,7 +402,7 @@
 #define TYPE_SIGNOFF   4
 #define TYPE_KEEPALIVE 5
 
-#define REVISION "gaim:$Revision: 816 $"
+#define REVISION "gaim:$Revision: 818 $"
 #define FLAPON "FLAPON\r\n\r\n"
 
 #define ROAST "Tic/Toc"
--- a/src/plugins.c	Thu Aug 31 02:12:58 2000 +0000
+++ b/src/plugins.c	Thu Aug 31 03:40:17 2000 +0000
@@ -602,6 +602,9 @@
 		case event_quit:
 			sprintf(buf, "event_quit");
 			break;
+		case event_new_conversation:
+			sprintf(buf, "event_new_conversaion");
+			break;
 		default:
 			sprintf(buf, "event_unknown");
 			break;
@@ -660,6 +663,7 @@
 			case event_buddy_back:
 			case event_chat_join:
 			case event_chat_leave:
+			case event_new_conversation:
 				{
 					void (*function)(char *, void *) = g->function;
 					(*function)(arg1, g->data);
@@ -774,6 +778,9 @@
 		case event_quit:
 			buf[0] = 0;
 			break;
+		case event_new_conversation:
+			sprintf(buf, "\"%s\"", (char *)arg1);
+			break;
 		default:
 			break;
 	}