libpurple/protocols/gg/message-prpl.c

changeset 34437
ca6d1b4d24b5
parent 34430
15639e15839e
child 34946
76aa2e0f8701
equal deleted inserted replaced
34436:3282a6c292dc 34437:ca6d1b4d24b5
241 241
242 msg->gc = gc; 242 msg->gc = gc;
243 msg->time = ev->time; 243 msg->time = ev->time;
244 msg->user = ev->sender; 244 msg->user = ev->sender;
245 245
246 #if GGP_ENABLE_GG11
246 if (ev->chat_id != 0) 247 if (ev->chat_id != 0)
247 { 248 {
248 msg->type = GGP_MESSAGE_GOT_TYPE_CHAT; 249 msg->type = GGP_MESSAGE_GOT_TYPE_CHAT;
249 msg->chat_id = ev->chat_id; 250 msg->chat_id = ev->chat_id;
250 } 251 }
251 else 252 else
253 #endif
252 { 254 {
253 msg->type = GGP_MESSAGE_GOT_TYPE_IM; 255 msg->type = GGP_MESSAGE_GOT_TYPE_IM;
254 } 256 }
255 257
256 ggp_message_format_from_gg(msg, ev->xhtml_message); 258 ggp_message_format_from_gg(msg, ev->xhtml_message);
268 270
269 msg->gc = gc; 271 msg->gc = gc;
270 msg->time = ev->time; 272 msg->time = ev->time;
271 msg->user = ev->sender; /* not really a sender*/ 273 msg->user = ev->sender; /* not really a sender*/
272 274
275 #if GGP_ENABLE_GG11
273 if (ev->chat_id != 0) 276 if (ev->chat_id != 0)
274 { 277 {
275 msg->type = GGP_MESSAGE_GOT_TYPE_CHAT; 278 msg->type = GGP_MESSAGE_GOT_TYPE_CHAT;
276 msg->chat_id = ev->chat_id; 279 msg->chat_id = ev->chat_id;
277 } 280 }
278 else 281 else
282 #endif
279 { 283 {
280 msg->type = GGP_MESSAGE_GOT_TYPE_MULTILOGON; 284 msg->type = GGP_MESSAGE_GOT_TYPE_MULTILOGON;
281 } 285 }
282 286
283 ggp_message_format_from_gg(msg, ev->xhtml_message); 287 ggp_message_format_from_gg(msg, ev->xhtml_message);
294 if (msg->type == GGP_MESSAGE_GOT_TYPE_IM) 298 if (msg->type == GGP_MESSAGE_GOT_TYPE_IM)
295 { 299 {
296 serv_got_im(gc, ggp_uin_to_str(msg->user), msg->text, 300 serv_got_im(gc, ggp_uin_to_str(msg->user), msg->text,
297 PURPLE_MESSAGE_RECV, msg->time); 301 PURPLE_MESSAGE_RECV, msg->time);
298 } 302 }
303 #if GGP_ENABLE_GG11
299 else if (msg->type == GGP_MESSAGE_GOT_TYPE_CHAT) 304 else if (msg->type == GGP_MESSAGE_GOT_TYPE_CHAT)
300 { 305 {
301 ggp_chat_got_message(gc, msg->chat_id, msg->text, msg->time, 306 ggp_chat_got_message(gc, msg->chat_id, msg->text, msg->time,
302 msg->user); 307 msg->user);
303 } 308 }
309 #endif
304 else if (msg->type == GGP_MESSAGE_GOT_TYPE_MULTILOGON) 310 else if (msg->type == GGP_MESSAGE_GOT_TYPE_MULTILOGON)
305 { 311 {
306 PurpleConversation *conv = ggp_message_get_conv(gc, msg->user); 312 PurpleConversation *conv = ggp_message_get_conv(gc, msg->user);
307 const gchar *me = purple_account_get_username( 313 const gchar *me = purple_account_get_username(
308 purple_connection_get_account(gc)); 314 purple_connection_get_account(gc));
780 { 786 {
781 g_free(gg_msg); 787 g_free(gg_msg);
782 return -E2BIG; 788 return -E2BIG;
783 } 789 }
784 790
791 #if GGP_ENABLE_GG11
785 succ = (gg_send_message_html(info->session, GG_CLASS_CHAT, 792 succ = (gg_send_message_html(info->session, GG_CLASS_CHAT,
786 ggp_str_to_uin(who), (unsigned char *)gg_msg) >= 0); 793 ggp_str_to_uin(who), (unsigned char *)gg_msg) >= 0);
794 #else
795 {
796 gchar *plain = purple_markup_strip_html(gg_msg);
797 succ = (gg_send_message(info->session, GG_CLASS_CHAT,
798 ggp_str_to_uin(who), (unsigned char *)plain) >= 0);
799 g_free(plain);
800 }
801 #endif
787 802
788 g_free(gg_msg); 803 g_free(gg_msg);
789 804
790 return succ ? 1 : -1; 805 return succ ? 1 : -1;
791 } 806 }

mercurial