changeset 101:a9aa982272f9

[gaim-migrate @ 111] Heh, this is a good thing to fix. Before, if you send an IM, you can change it going out, but on your converation window, it would look unchanged. Now, if a plugin changes the outgoing text, the conversation window displays the new text. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sun, 09 Apr 2000 23:03:44 +0000
parents da0883dfa7db
children 8c301530b2a3
files src/conversation.c src/server.c
diffstat 2 files changed, 18 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/src/conversation.c	Sun Apr 09 20:48:48 2000 +0000
+++ b/src/conversation.c	Sun Apr 09 23:03:44 2000 +0000
@@ -325,7 +325,7 @@
 
 static void send_callback(GtkWidget *widget, struct conversation *c)
 {
-        char buf[BUF_LEN*4];
+        char *buf = g_malloc(BUF_LEN * 4);
 	char *buf2;
 	gchar *buf4;
         int hdrlen;
@@ -372,6 +372,22 @@
                 g_snprintf(buf2, BUF_LONG, "<STRIKE>%s</STRIKE>", buf);
                 strcpy(buf, buf2);
         }
+
+#ifdef GAIM_PLUGINS
+	{
+		GList *ca = callbacks;
+		struct gaim_callback *g;
+		void (*function)(char *, char **, void *);
+		while (ca) {
+			g = (struct gaim_callback *)(ca->data);
+			if (g->event == event_im_send && g->function != NULL) {
+				function = g->function;
+				(*function)(c->name, &buf, g->data);
+			}
+			ca = ca->next;
+		}
+	}
+#endif
         
 	write_to_conv(c, buf, WFLAG_SEND);
 
@@ -402,7 +418,7 @@
 	gtk_widget_grab_focus(c->entry);
 
         g_free(buf2);
-
+	g_free(buf);
 }
 
 static int
--- a/src/server.c	Sun Apr 09 20:48:48 2000 +0000
+++ b/src/server.c	Sun Apr 09 23:03:44 2000 +0000
@@ -138,24 +138,6 @@
 {
 	char buf[MSG_LEN - 7];
 
-#ifdef GAIM_PLUGINS
-	GList *c = callbacks;
-	struct gaim_callback *g;
-	void (*function)(char **, char **, void *);
-	while (c) {
-		g = (struct gaim_callback *)c->data;
-		if (g->event == event_im_send && g->function != NULL) {
-			function = g->function;
-			/* I can guarantee you this is wrong */
-			(*function)(&name, &message, g->data);
-		}
-		c = c->next;
-	}
-	/* make sure no evil plugin is trying to crash gaim */
-	if (message == NULL)
-		return;
-#endif
-
 #ifndef USE_OSCAR
         g_snprintf(buf, MSG_LEN - 8, "toc_send_im %s \"%s\"%s", normalize(name),
                    message, ((away) ? " auto" : ""));