comparison src/server.c @ 3163:e102d1629c71

[gaim-migrate @ 3179] 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. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Tue, 23 Apr 2002 16:30:09 +0000
parents 1bd472b7f7a2
children dd34e0b40fed
comparison
equal deleted inserted replaced
3162:7dfd1871c39d 3163:e102d1629c71
496 * bitch all you want; i really don't want you to be dealing with it. */ 496 * bitch all you want; i really don't want you to be dealing with it. */
497 if (len < 0) { 497 if (len < 0) {
498 buffy = g_malloc(MAX(strlen(message) + 1, BUF_LONG)); 498 buffy = g_malloc(MAX(strlen(message) + 1, BUF_LONG));
499 strcpy(buffy, message); 499 strcpy(buffy, message);
500 angel = g_strdup(name); 500 angel = g_strdup(name);
501 plugin_return = plugin_event(event_im_recv, gc, &angel, &buffy, (void *)flags); 501 plugin_return = plugin_event(event_im_recv, gc, &angel, &buffy, (void *)&flags);
502 502
503 if (!buffy || !angel || plugin_return) { 503 if (!buffy || !angel || plugin_return) {
504 if (buffy) 504 if (buffy)
505 g_free(buffy); 505 g_free(buffy);
506 if (angel) 506 if (angel)
969 { 969 {
970 int w; 970 int w;
971 GSList *bcs = g->buddy_chats; 971 GSList *bcs = g->buddy_chats;
972 struct conversation *b = NULL; 972 struct conversation *b = NULL;
973 char *buf; 973 char *buf;
974 char *buffy, *angel;
975 int plugin_return;
974 976
975 while (bcs) { 977 while (bcs) {
976 b = (struct conversation *)bcs->data; 978 b = (struct conversation *)bcs->data;
977 if (id == b->id) 979 if (id == b->id)
978 break; 980 break;
981 983
982 } 984 }
983 if (!b) 985 if (!b)
984 return; 986 return;
985 987
986 if (plugin_event(event_chat_recv, g, (void *)b->id, who, message)) 988
989 /* plugin stuff. we pass a char ** but we don't want to pass what's been given us
990 * by the prpls. so we create temp holders and pass those instead. it's basically
991 * just to avoid segfaults. of course, if the data is binary, plugins don't see it.
992 * bitch all you want; i really don't want you to be dealing with it. */
993
994 buffy = g_malloc(MAX(strlen(message) + 1, BUF_LONG));
995 strcpy(buffy, message);
996 angel = g_strdup(who);
997 plugin_return = plugin_event(event_chat_recv, g, (void *)b->id, &angel, &buffy);
998
999 if (!buffy || !angel || plugin_return) {
1000 if (buffy)
1001 g_free(buffy);
1002 if (angel)
1003 g_free(angel);
987 return; 1004 return;
1005 }
1006 who = angel;
1007 message = buffy;
988 1008
989 buf = g_malloc(MAX(strlen(message) * 2, 8192)); 1009 buf = g_malloc(MAX(strlen(message) * 2, 8192));
990 strcpy(buf, message); 1010 strcpy(buf, message);
991 1011
992 if (convo_options & OPT_CONVO_SEND_LINKS) 1012 if (convo_options & OPT_CONVO_SEND_LINKS)
996 w = WFLAG_WHISPER; 1016 w = WFLAG_WHISPER;
997 else 1017 else
998 w = 0; 1018 w = 0;
999 1019
1000 chat_write(b, who, w, buf, mtime); 1020 chat_write(b, who, w, buf, mtime);
1021 g_free(who);
1022 g_free(message);
1001 g_free(buf); 1023 g_free(buf);
1002 } 1024 }
1003 1025
1004 static void des_popup(GtkWidget *w, GtkWidget *window) 1026 static void des_popup(GtkWidget *w, GtkWidget *window)
1005 { 1027 {