comparison libpurple/protocols/qq/im.c @ 24065:bdfcfd71449c

patch 20080922 from ccpaging <ccpaging(at)gmail.com>
author SHiNE CsyFeK <csyfek@gmail.com>
date Wed, 22 Oct 2008 14:33:20 +0000
parents d57928c9dd8f
children dbc7a9742f8d
comparison
equal deleted inserted replaced
24064:a3cd7c3d9da1 24065:bdfcfd71449c
34 #include "buddy_info.h" 34 #include "buddy_info.h"
35 #include "buddy_list.h" 35 #include "buddy_list.h"
36 #include "buddy_opt.h" 36 #include "buddy_opt.h"
37 #include "char_conv.h" 37 #include "char_conv.h"
38 #include "group_im.h" 38 #include "group_im.h"
39 #include "header_info.h" 39 #include "qq_define.h"
40 #include "im.h" 40 #include "im.h"
41 #include "packet_parse.h" 41 #include "packet_parse.h"
42 #include "qq_network.h" 42 #include "qq_network.h"
43 #include "send_file.h" 43 #include "send_file.h"
44 #include "utils.h" 44 #include "utils.h"
500 /* send an IM to to_uid */ 500 /* send an IM to to_uid */
501 void qq_send_packet_im(PurpleConnection *gc, guint32 to_uid, gchar *msg, gint type) 501 void qq_send_packet_im(PurpleConnection *gc, guint32 to_uid, gchar *msg, gint type)
502 { 502 {
503 qq_data *qd; 503 qq_data *qd;
504 guint8 *raw_data, *send_im_tail; 504 guint8 *raw_data, *send_im_tail;
505 guint16 client_tag, normal_im_type; 505 guint16 normal_im_type;
506 gint msg_len, raw_len, font_name_len, tail_len, bytes; 506 gint msg_len, raw_len, font_name_len, tail_len, bytes;
507 time_t now; 507 time_t now;
508 gchar *msg_filtered; 508 gchar *msg_filtered;
509 GData *attribs; 509 GData *attribs;
510 gchar *font_size = NULL, *font_color = NULL, *font_name = NULL, *tmp; 510 gchar *font_size = NULL, *font_color = NULL, *font_name = NULL, *tmp;
511 gboolean is_bold = FALSE, is_italic = FALSE, is_underline = FALSE; 511 gboolean is_bold = FALSE, is_italic = FALSE, is_underline = FALSE;
512 const gchar *start, *end, *last; 512 const gchar *start, *end, *last;
513 513
514 qd = (qq_data *) gc->proto_data; 514 qd = (qq_data *) gc->proto_data;
515 client_tag = QQ_CLIENT;
516 normal_im_type = QQ_NORMAL_IM_TEXT; 515 normal_im_type = QQ_NORMAL_IM_TEXT;
517 516
518 last = msg; 517 last = msg;
519 while (purple_markup_find_tag("font", last, &start, &end, &attribs)) { 518 while (purple_markup_find_tag("font", last, &start, &end, &attribs)) {
520 tmp = g_datalist_get_data(&attribs, "size"); 519 tmp = g_datalist_get_data(&attribs, "size");
570 /* 000-003: receiver uid */ 569 /* 000-003: receiver uid */
571 bytes += qq_put32(raw_data + bytes, qd->uid); 570 bytes += qq_put32(raw_data + bytes, qd->uid);
572 /* 004-007: sender uid */ 571 /* 004-007: sender uid */
573 bytes += qq_put32(raw_data + bytes, to_uid); 572 bytes += qq_put32(raw_data + bytes, to_uid);
574 /* 008-009: sender client version */ 573 /* 008-009: sender client version */
575 bytes += qq_put16(raw_data + bytes, client_tag); 574 bytes += qq_put16(raw_data + bytes, qd->client_version);
576 /* 010-013: receiver uid */ 575 /* 010-013: receiver uid */
577 bytes += qq_put32(raw_data + bytes, qd->uid); 576 bytes += qq_put32(raw_data + bytes, qd->uid);
578 /* 014-017: sender uid */ 577 /* 014-017: sender uid */
579 bytes += qq_put32(raw_data + bytes, to_uid); 578 bytes += qq_put32(raw_data + bytes, to_uid);
580 /* 018-033: md5 of (uid+session_key) */ 579 /* 018-033: md5 of (uid+session_key) */