comparison libpurple/protocols/qq/qq.c @ 24077:ce94189f15ad

Flos Lonicerae <lonicerae(at)gmail.com> * Merge lonicerae and ccpaging into trunk
author SHiNE CsyFeK <csyfek@gmail.com>
date Wed, 22 Oct 2008 14:52:26 +0000
parents ec3f7d3e0445
children 0a92aa673a33
comparison
equal deleted inserted replaced
24076:ec3f7d3e0445 24077:ce94189f15ad
433 433
434 /* IMPORTANT: PurpleConvImFlags -> PurpleMessageFlags */ 434 /* IMPORTANT: PurpleConvImFlags -> PurpleMessageFlags */
435 /* send an instant msg to a buddy */ 435 /* send an instant msg to a buddy */
436 static gint qq_send_im(PurpleConnection *gc, const gchar *who, const gchar *message, PurpleMessageFlags flags) 436 static gint qq_send_im(PurpleConnection *gc, const gchar *who, const gchar *message, PurpleMessageFlags flags)
437 { 437 {
438 gint type, to_uid; 438 gint type, uid_to;
439 gchar *msg, *msg_with_qq_smiley; 439 gchar *msg, *msg_with_qq_smiley;
440 qq_data *qd; 440 qq_data *qd;
441 441
442 g_return_val_if_fail(who != NULL, -1); 442 g_return_val_if_fail(who != NULL, -1);
443 443
444 qd = (qq_data *) gc->proto_data; 444 qd = (qq_data *) gc->proto_data;
445 445
446 g_return_val_if_fail(strlen(message) <= QQ_MSG_IM_MAX, -E2BIG); 446 g_return_val_if_fail(strlen(message) <= QQ_MSG_IM_MAX, -E2BIG);
447 447
448 type = (flags == PURPLE_MESSAGE_AUTO_RESP ? QQ_IM_AUTO_REPLY : QQ_IM_TEXT); 448 type = (flags == PURPLE_MESSAGE_AUTO_RESP ? QQ_IM_AUTO_REPLY : QQ_IM_TEXT);
449 to_uid = purple_name_to_uid(who); 449 uid_to = purple_name_to_uid(who);
450 450
451 /* if msg is to myself, bypass the network */ 451 /* if msg is to myself, bypass the network */
452 if (to_uid == qd->uid) { 452 if (uid_to == qd->uid) {
453 serv_got_im(gc, who, message, flags, time(NULL)); 453 serv_got_im(gc, who, message, flags, time(NULL));
454 } else { 454 } else {
455 msg = utf8_to_qq(message, QQ_CHARSET_DEFAULT); 455 msg = utf8_to_qq(message, QQ_CHARSET_DEFAULT);
456 msg_with_qq_smiley = purple_smiley_to_qq(msg); 456 msg_with_qq_smiley = purple_smiley_to_qq(msg);
457 qq_send_packet_im(gc, to_uid, msg_with_qq_smiley, type); 457 qq_request_send_im(gc, uid_to, msg_with_qq_smiley, type);
458 g_free(msg); 458 g_free(msg);
459 g_free(msg_with_qq_smiley); 459 g_free(msg_with_qq_smiley);
460 } 460 }
461 461
462 return 1; 462 return 1;