From: Sean E. <sea...@us...> - 2002-04-23 16:30:13
|
Update of /cvsroot/gaim/gaim/src In directory usw-pr-cvs1:/tmp/cvs-serv20859/src Modified Files: module.c server.c Log Message: event_chat_recv takes char** arguments, so you can change the incoming text and sender. event_im_recv takes a guint32* for its flags, so you can change the flags too. Index: module.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/module.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- module.c 2 Mar 2002 04:52:21 -0000 1.15 +++ module.c 23 Apr 2002 16:30:09 -0000 1.16 @@ -449,8 +449,8 @@ debug_printf("%s: %s %d %s\n", event_name(event), ((struct gaim_connection *)arg1)->username, (int)arg2, - (char *)arg3 ? (char *)arg3 : "", - (char *)arg4 ? (char *)arg4 : ""); + *(char **)arg3 ? *(char **)arg3 : "", + *(char **)arg4 ? *(char **)arg4 : ""); break; case event_chat_send_invite: debug_printf("%s: %s %d %s %s\n", event_name(event), Index: server.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/server.c,v retrieving revision 1.226 retrieving revision 1.227 diff -u -d -r1.226 -r1.227 --- server.c 12 Apr 2002 02:15:24 -0000 1.226 +++ server.c 23 Apr 2002 16:30:09 -0000 1.227 @@ -498,7 +498,7 @@ buffy = g_malloc(MAX(strlen(message) + 1, BUF_LONG)); strcpy(buffy, message); angel = g_strdup(name); - plugin_return = plugin_event(event_im_recv, gc, &angel, &buffy, (void *)flags); + plugin_return = plugin_event(event_im_recv, gc, &angel, &buffy, (void *)&flags); if (!buffy || !angel || plugin_return) { if (buffy) @@ -971,6 +971,8 @@ GSList *bcs = g->buddy_chats; struct conversation *b = NULL; char *buf; + char *buffy, *angel; + int plugin_return; while (bcs) { b = (struct conversation *)bcs->data; @@ -983,8 +985,26 @@ if (!b) return; - if (plugin_event(event_chat_recv, g, (void *)b->id, who, message)) + + /* plugin stuff. we pass a char ** but we don't want to pass what's been given us + * by the prpls. so we create temp holders and pass those instead. it's basically + * just to avoid segfaults. of course, if the data is binary, plugins don't see it. + * bitch all you want; i really don't want you to be dealing with it. */ + + buffy = g_malloc(MAX(strlen(message) + 1, BUF_LONG)); + strcpy(buffy, message); + angel = g_strdup(who); + plugin_return = plugin_event(event_chat_recv, g, (void *)b->id, &angel, &buffy); + + if (!buffy || !angel || plugin_return) { + if (buffy) + g_free(buffy); + if (angel) + g_free(angel); return; + } + who = angel; + message = buffy; buf = g_malloc(MAX(strlen(message) * 2, 8192)); strcpy(buf, message); @@ -998,6 +1018,8 @@ w = 0; chat_write(b, who, w, buf, mtime); + g_free(who); + g_free(message); g_free(buf); } |