comparison src/protocols/gg/gg.c @ 12373:508512caa22e

[gaim-migrate @ 14677] deryni pointed out that ggp_buddy_get_name leaks when the user isn't a buddy. I went to fix that and tweaked a bunch of code. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Tue, 06 Dec 2005 19:50:47 +0000
parents 739e3aca067a
children e585695bc16b
comparison
equal deleted inserted replaced
12372:188d7e79166b 12373:508512caa22e
1068 GGPInfo *info = gc->proto_data; 1068 GGPInfo *info = gc->proto_data;
1069 GaimConversation *conv; 1069 GaimConversation *conv;
1070 gchar *from; 1070 gchar *from;
1071 gchar *msg; 1071 gchar *msg;
1072 gchar *tmp; 1072 gchar *tmp;
1073 const char *chat_name;
1074 int chat_id;
1075 1073
1076 from = g_strdup_printf("%lu", (unsigned long int)ev->event.msg.sender); 1074 from = g_strdup_printf("%lu", (unsigned long int)ev->event.msg.sender);
1077 1075
1078 msg = charset_convert((const char *)ev->event.msg.message, 1076 msg = charset_convert((const char *)ev->event.msg.message,
1079 "CP1250", "UTF-8"); 1077 "CP1250", "UTF-8");
1080 gaim_str_strip_char(msg, '\r'); 1078 gaim_str_strip_char(msg, '\r');
1081 tmp = g_markup_escape_text(msg, -1); 1079 tmp = g_markup_escape_text(msg, -1);
1080 g_free(msg);
1082 1081
1083 gaim_debug_info("gg", "msg form (%s): %s (class = %d; rcpt_count = %d)\n", 1082 gaim_debug_info("gg", "msg form (%s): %s (class = %d; rcpt_count = %d)\n",
1084 from, tmp, ev->event.msg.msgclass, 1083 from, tmp, ev->event.msg.msgclass,
1085 ev->event.msg.recipients_count); 1084 ev->event.msg.recipients_count);
1086 1085
1087 if (ev->event.msg.recipients_count == 0) { 1086 if (ev->event.msg.recipients_count == 0) {
1088 serv_got_im(gc, from, tmp, 0, ev->event.msg.time); 1087 serv_got_im(gc, from, tmp, 0, ev->event.msg.time);
1089 } else { 1088 } else {
1089 const char *chat_name;
1090 int chat_id;
1091 char *buddy_name;
1092
1090 chat_name = ggp_confer_find_by_participants(gc, 1093 chat_name = ggp_confer_find_by_participants(gc,
1091 ev->event.msg.recipients, 1094 ev->event.msg.recipients,
1092 ev->event.msg.recipients_count); 1095 ev->event.msg.recipients_count);
1093 if (chat_name == NULL) { 1096 if (chat_name == NULL) {
1094 chat_name = ggp_confer_add_new(gc, NULL); 1097 chat_name = ggp_confer_add_new(gc, NULL);
1101 ev->event.msg.recipients, 1104 ev->event.msg.recipients,
1102 ev->event.msg.recipients_count); 1105 ev->event.msg.recipients_count);
1103 } 1106 }
1104 conv = ggp_confer_find_by_name(gc, chat_name); 1107 conv = ggp_confer_find_by_name(gc, chat_name);
1105 chat_id = gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)); 1108 chat_id = gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv));
1106 serv_got_chat_in(gc, chat_id, 1109
1107 ggp_buddy_get_name(gc, ev->event.msg.sender), 1110 buddy_name = ggp_buddy_get_name(gc, ev->event.msg.sender);
1111 serv_got_chat_in(gc, chat_id, buddy_name,
1108 0, msg, ev->event.msg.time); 1112 0, msg, ev->event.msg.time);
1109 } 1113 g_free(buddy_name);
1110 g_free(msg); 1114 }
1111 g_free(tmp); 1115 g_free(tmp);
1112 g_free(from); 1116 g_free(from);
1113 } 1117 }
1114 /* }}} */ 1118 /* }}} */
1115 1119