Mercurial > pidgin
annotate libpurple/protocols/qq/im.c @ 28315:d9eb51a3a3a2
jabber: Don't try to pull a photo out of the <PHOTO/> cdata.
When the data from the server looks literally like:
<PHOTO>
<TYPE>image/jpeg</TYPE>
<BINVAL></BINVAL>
</PHOTO>
xmlnode_get_data(photo_node) will contain (whitespace) data, but in
no way is it a base64-encoded image. I can't find any reference to
clients distributing avatars in that way in the XEP or the RFC.
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Sat, 03 Oct 2009 02:50:48 +0000 |
parents | 4b8c4870b13a |
children | 351d07aefb09 |
rev | line source |
---|---|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2 * @file im.c |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3 * |
15822 | 4 * purple |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
5 * |
15822 | 6 * Purple is the legal property of its developers, whose names are too numerous |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
7 * to list here. Please refer to the COPYRIGHT file distributed with this |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
8 * source distribution. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
9 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
10 * This program is free software; you can redistribute it and/or modify |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
11 * it under the terms of the GNU General Public License as published by |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
12 * the Free Software Foundation; either version 2 of the License, or |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
13 * (at your option) any later version. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
14 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
15 * This program is distributed in the hope that it will be useful, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
18 * GNU General Public License for more details. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
19 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
20 * You should have received a copy of the GNU General Public License |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
21 * along with this program; if not, write to the Free Software |
19681
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18807
diff
changeset
|
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
23 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
24 |
18210
b8572b937c09
#include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <stu@nosnilmot.com>
parents:
16208
diff
changeset
|
25 #include "internal.h" |
b8572b937c09
#include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <stu@nosnilmot.com>
parents:
16208
diff
changeset
|
26 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
27 #include "conversation.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
28 #include "debug.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
29 #include "internal.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
30 #include "notify.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
31 #include "server.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
32 #include "util.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
33 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
34 #include "buddy_info.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
35 #include "buddy_list.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
36 #include "buddy_opt.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
37 #include "char_conv.h" |
24134
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24117
diff
changeset
|
38 #include "qq_define.h" |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
39 #include "im.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
40 #include "packet_parse.h" |
23050 | 41 #include "qq_network.h" |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
42 #include "send_file.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
43 #include "utils.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
44 |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
45 #define QQ_MSG_IM_MAX 700 /* max length of IM */ |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
46 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
47 enum { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
48 QQ_IM_TEXT = 0x01, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
49 QQ_IM_AUTO_REPLY = 0x02 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
50 }; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
51 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
52 enum |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
53 { |
23048 | 54 QQ_NORMAL_IM_TEXT = 0x000b, |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
55 QQ_NORMAL_IM_FILE_REQUEST_TCP = 0x0001, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
56 QQ_NORMAL_IM_FILE_APPROVE_TCP = 0x0003, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
57 QQ_NORMAL_IM_FILE_REJECT_TCP = 0x0005, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
58 QQ_NORMAL_IM_FILE_REQUEST_UDP = 0x0035, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
59 QQ_NORMAL_IM_FILE_APPROVE_UDP = 0x0037, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
60 QQ_NORMAL_IM_FILE_REJECT_UDP = 0x0039, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
61 QQ_NORMAL_IM_FILE_NOTIFY = 0x003b, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
62 QQ_NORMAL_IM_FILE_PASV = 0x003f, /* are you behind a firewall? */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
63 QQ_NORMAL_IM_FILE_CANCEL = 0x0049, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
64 QQ_NORMAL_IM_FILE_EX_REQUEST_UDP = 0x81, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
65 QQ_NORMAL_IM_FILE_EX_REQUEST_ACCEPT = 0x83, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
66 QQ_NORMAL_IM_FILE_EX_REQUEST_CANCEL = 0x85, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
67 QQ_NORMAL_IM_FILE_EX_NOTIFY_IP = 0x87 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
68 }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
69 |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
70 typedef struct _qq_im_header qq_im_header; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
71 struct _qq_im_header { |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
72 /* this is the common part of normal_text */ |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
73 guint16 version_from; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
74 guint32 uid_from; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
75 guint32 uid_to; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
76 guint8 session_md5[QQ_KEY_LENGTH]; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
77 guint16 im_type; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
78 }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
79 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
80 /* read the common parts of the normal_im, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
81 * returns the bytes read if succeed, or -1 if there is any error */ |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
82 static gint get_im_header(qq_im_header *im_header, guint8 *data, gint len) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
83 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
84 gint bytes; |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
85 g_return_val_if_fail(data != NULL && len > 0, -1); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
86 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
87 bytes = 0; |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
88 bytes += qq_get16(&(im_header->version_from), data + bytes); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
89 bytes += qq_get32(&(im_header->uid_from), data + bytes); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
90 bytes += qq_get32(&(im_header->uid_to), data + bytes); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
91 bytes += qq_getdata(im_header->session_md5, QQ_KEY_LENGTH, data + bytes); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
92 bytes += qq_get16(&(im_header->im_type), data + bytes); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
93 return bytes; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
94 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
95 |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
96 typedef struct _qq_emoticon qq_emoticon; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
97 struct _qq_emoticon { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
98 guint8 symbol; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
99 gchar *name; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
100 }; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
101 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
102 static gboolean emoticons_is_sorted = FALSE; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
103 /* Map for purple smiley convert to qq, need qsort */ |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
104 static qq_emoticon emoticons_std[] = { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
105 {0x4f, "/:)"}, {0x4f, "/wx"}, {0x4f, "/small_smile"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
106 {0x42, "/:~"}, {0x42, "/pz"}, {0x42, "/curl_lip"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
107 {0x43, "/:*"}, {0x43, "/se"}, {0x43, "/desire"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
108 {0x44, "/:|"}, {0x44, "/fd"}, {0x44, "/dazed"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
109 {0x45, "/8-)"}, {0x45, "/dy"}, {0x45, "/revel"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
110 {0x46, "/:<"}, {0x46, "/ll"}, {0x46, "/cry"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
111 {0x47, "/:$"}, {0x47, "/hx"}, {0x47, "/bashful"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
112 {0x48, "/:x"}, {0x48, "/bz"}, {0x48, "/shut_mouth"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
113 {0x8f, "/|-)"}, {0x8f, "/kun"}, {0x8f, "/sleepy"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
114 {0x49, "/:z"}, {0x49, "/shui"}, {0x49, "/sleep"}, /* after sleepy */ |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
115 {0x4a, "/:'"}, {0x4a, "/dk"}, {0x4a, "/weep"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
116 {0x4b, "/:-|"}, {0x4b, "/gg"}, {0x4b, "/embarassed"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
117 {0x4c, "/:@"}, {0x4c, "/fn"}, {0x4c, "/pissed_off"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
118 {0x4d, "/:P"}, {0x4d, "/tp"}, {0x4d, "/act_up"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
119 {0x4e, "/:D"}, {0x4e, "/cy"}, {0x4e, "/toothy_smile"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
120 {0x41, "/:O"}, {0x41, "/jy"}, {0x41, "/surprised"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
121 {0x73, "/:("}, {0x73, "/ng"}, {0x73, "/sad"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
122 {0x74, "/:+"}, {0x74, "/kuk"}, {0x74, "/cool"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
123 {0xa1, "/--b"}, {0xa1, "/lengh"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
124 {0x76, "/:Q"}, {0x76, "/zk"}, {0x76, "/crazy"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
125 {0x8a, "/;P"}, {0x8a, "/tx"}, {0x8a, "/titter"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
126 {0x8b, "/;-D"}, {0x8b, "/ka"}, {0x8b, "/cute"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
127 {0x8c, "/;d"}, {0x8c, "/by"}, {0x8c, "/disdain"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
128 {0x8d, "/;o"}, {0x8d, "/am"}, {0x8d, "/arrogant"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
129 {0x8e, "/:g"}, {0x8e, "/jie"}, {0x8e, "/starving"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
130 {0x78, "/:!"}, {0x78, "/jk"}, {0x78, "/terror"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
131 {0x79, "/:L"}, {0x79, "/lh"}, {0x79, "/sweat"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
132 {0x7a, "/:>"}, {0x7a, "/hanx"}, {0x7a, "/smirk"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
133 {0x7b, "/:;"}, {0x7b, "/db"}, {0x7b, "/soldier"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
134 {0x90, "/;f"}, {0x90, "/fendou"}, {0x90, "/struggle"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
135 {0x91, "/:-S"}, {0x91, "/zhm"}, {0x91, "/curse"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
136 {0x92, "/?"}, {0x92, "/yiw"}, {0x92, "/question"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
137 {0x93, "/;x"}, {0x93, "/xu"}, {0x93, "/shh"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
138 {0x94, "/;@"}, {0x94, "/yun"}, {0x94, "/dizzy"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
139 {0x95, "/:8"}, {0x95, "/zhem"}, {0x95, "/excrutiating"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
140 {0x96, "/;!"}, {0x96, "/shuai"}, {0x96, "/freaked_out"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
141 {0x97, "/!!!"}, {0x97, "/kl"}, {0x97, "/skeleton"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
142 {0x98, "/xx"}, {0x98, "/qiao"}, {0x98, "/hammer"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
143 {0x99, "/bye"}, {0x99, "/zj"}, {0x99, "/bye"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
144 {0xa2, "/wipe"}, {0xa2, "/ch"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
145 {0xa3, "/dig"}, {0xa3, "/kb"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
146 {0xa4, "/handclap"},{0xa4, "/gz"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
147 {0xa5, "/&-("}, {0xa5, "/qd"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
148 {0xa6, "/B-)"}, {0xa6, "/huaix"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
149 {0xa7, "/<@"}, {0xa7, "/zhh"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
150 {0xa8, "/@>"}, {0xa8, "/yhh"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
151 {0xa9, "/:-O"}, {0xa9, "/hq"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
152 {0xaa, "/>-|"}, {0xaa, "/bs"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
153 {0xab, "/P-("}, {0xab, "/wq"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
154 {0xac, "/:'|"}, {0xac, "/kk"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
155 {0xad, "/X-)"}, {0xad, "/yx"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
156 {0xae, "/:*"}, {0xae, "/qq"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
157 {0xaf, "/@x"}, {0xaf, "/xia"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
158 {0xb0, "/8*"}, {0xb0, "/kel"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
159 {0xb1, "/pd"}, {0xb1, "/cd"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
160 {0x61, "/<W>"}, {0x61, "/xig"}, {0x61, "/watermelon"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
161 {0xb2, "/beer"}, {0xb2, "/pj"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
162 {0xb3, "/basketb"}, {0xb3, "/lq"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
163 {0xb4, "/oo"}, {0xb4, "/pp"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
164 {0x80, "/coffee"}, {0x80, "/kf"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
165 {0x81, "/eat"}, {0x81, "/fan"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
166 {0x62, "/rose"}, {0x62, "/mg"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
167 {0x63, "/fade"}, {0x63, "/dx"}, {0x63, "/wilt"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
168 {0xb5, "/showlove"},{0xb5, "/sa"}, /* after sad */ |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
169 {0x65, "/heart"}, {0x65, "/xin"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
170 {0x66, "/break"}, {0x66, "/xs"}, {0x66, "/broken_heart"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
171 {0x67, "/cake"}, {0x67, "/dg"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
172 {0x9c, "/li"}, {0x9c, "/shd"}, {0x9c, "/lightning"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
173 {0x9d, "/bome"}, {0x9d, "/zhd"}, {0x9d, "/bomb"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
174 {0x9e, "/kn"}, {0x9e, "/dao"}, {0x9e, "/knife"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
175 {0x5e, "/footb"}, {0x5e, "/zq"}, {0x5e, "/soccer"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
176 {0xb6, "/ladybug"}, {0xb6, "/pc"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
177 {0x89, "/shit"}, {0x89, "/bb"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
178 {0x6e, "/moon"}, {0x6e, "/yl"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
179 {0x6b, "/sun"}, {0x6b, "/ty"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
180 {0x68, "/gift"}, {0x68, "/lw"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
181 {0x7f, "/hug"}, {0x7f, "/yb"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
182 {0x6f, "/strong"}, {0x6f, "/qiang"}, {0x6f, "/thumbs_up"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
183 {0x70, "/weak"}, {0x70, "/ruo"}, {0x70, "/thumbs_down"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
184 {0x88, "/share"}, {0x88, "/ws"}, {0x88, "/handshake"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
185 {0xb7, "/@)"}, {0xb7, "/bq"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
186 {0xb8, "/jj"}, {0xb8, "/gy"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
187 {0xb9, "/@@"}, {0xb9, "/qt"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
188 {0xba, "/bad"}, {0xba, "/cj"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
189 {0xbb, "/loveu"}, {0xbb, "/aini"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
190 {0xbc, "/no"}, {0xbc, "/bu"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
191 {0xbd, "/ok"}, {0xbd, "/hd"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
192 {0x5c, "/love"}, {0x5c, "/aiq"}, /* after loveu */ |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
193 {0x56, "/<L>"}, {0x56, "/fw"}, {0x56, "/blow_kiss"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
194 {0x58, "/jump"}, {0x58, "/tiao"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
195 {0x5a, "/shake"}, {0x5a, "/fad"}, /* after fade */ |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
196 {0x5b, "/<O>"}, {0x5b, "/oh"}, {0x5b, "/angry"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
197 {0xbe, "/circle"}, {0xbe, "/zhq"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
198 {0xbf, "/kotow"}, {0xbf, "/kt"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
199 {0xc0, "/turn"}, {0xc0, "/ht"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
200 {0x77, "/:t"}, {0x77, "/tu"}, {0x77, "/vomit"}, /* after turn */ |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
201 {0xa0, "/victory"}, {0xa0, "/shl"}, {0xa0, "/v"}, /* end of v */ |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
202 {0xc1, "/skip"}, {0xc1, "/tsh"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
203 {0xc2, "/oY"}, {0xc2, "/hsh"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
204 {0xc3, "/#-O"}, {0xc3, "/jd"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
205 {0xc4, "/hiphop"}, {0xc4, "/jw"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
206 {0xc5, "/kiss"}, {0xc5, "/xw"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
207 {0xc6, "/<&"}, {0xc6, "/ztj"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
208 {0x7c, "/pig"}, {0x7c, "/zt"}, /* after ztj */ |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
209 {0xc7, "/&>"}, {0xc7, "/ytj"}, /* must be end of "&" */ |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
210 {0x75, "/:#"}, {0x75, "/feid"}, {0x75, "/SARS"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
211 {0x59, "/go"}, {0x59, "/shan"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
212 {0x57, "/find"}, {0x57, "/zhao"}, {0x57, "/search"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
213 {0x55, "/&"}, {0x55, "/mm"}, {0x55, "/beautiful_eyebrows"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
214 {0x7d, "/cat"}, {0x7d, "/maom"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
215 {0x7e, "/dog"}, {0x7e, "/xg"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
216 {0x9a, "/$"}, {0x9a, "/qianc"}, {0x9a, "/money"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
217 {0x9b, "/(!)"}, {0x9b, "/dp"}, {0x9b, "/lightbulb"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
218 {0x60, "/cup"}, {0x60, "/bei"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
219 {0x9f, "/music"}, {0x9f, "/yy"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
220 {0x82, "/pill"}, {0x82, "/yw"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
221 {0x64, "/kiss"}, {0x64, "/wen"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
222 {0x83, "/meeting"}, {0x83, "/hy"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
223 {0x84, "/phone"}, {0x84, "/dh"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
224 {0x85, "/time"}, {0x85, "/sj"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
225 {0x86, "/email"}, {0x86, "/yj"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
226 {0x87, "/tv"}, {0x87, "/ds"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
227 {0x50, "/<D>"}, {0x50, "/dd"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
228 {0x51, "/<J>"}, {0x51, "/mn"}, {0x51, "/beauty"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
229 {0x52, "/<H>"}, {0x52, "/hl"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
230 {0x53, "/<M>"}, {0x53, "/mamao"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
231 {0x54, "/<QQ>"}, {0x54, "/qz"}, {0x54, "/qq"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
232 {0x5d, "/<B>"}, {0x5d, "/bj"}, {0x5d, "/baijiu"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
233 {0x5f, "/<U>"}, {0x5f, "/qsh"}, {0x5f, "/soda"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
234 {0x69, "/<!!>"}, {0x69, "/xy"}, {0x69, "/rain"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
235 {0x6a, "/<~>"}, {0x6a, "/duoy"}, {0x6a, "/cloudy"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
236 {0x6c, "/<Z>"}, {0x6c, "/xr"}, {0x6c, "/snowman"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
237 {0x6d, "/<*>"}, {0x6d, "/xixing"}, {0x6d, "/star"}, /* after starving */ |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
238 {0x71, "/<00>"}, {0x71, "/nv"}, {0x71, "/woman"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
239 {0x72, "/<11>"}, {0x72, "/nan"}, {0x72, "/man"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
240 {0, NULL} |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
241 }; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
242 gint emoticons_std_num = sizeof(emoticons_std) / sizeof(qq_emoticon) - 1; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
243 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
244 /* Map for purple smiley convert to qq, need qsort */ |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
245 static qq_emoticon emoticons_ext[] = { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
246 {0xc7, "/&>"}, {0xa5, "/&-("}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
247 {0xbb, "/loveu"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
248 {0x63, "/fade"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
249 {0x8f, "/sleepy"}, {0x73, "/sad"}, {0x8e, "/starving"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
250 {0xc0, "/turn"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
251 {0xa0, "/victory"}, {0x77, "/vomit"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
252 {0xc6, "/ztj"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
253 {0, NULL} |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
254 }; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
255 gint emoticons_ext_num = sizeof(emoticons_ext) / sizeof(qq_emoticon) - 1; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
256 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
257 /* Map for qq smiley convert to purple */ |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
258 static qq_emoticon emoticons_sym[] = { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
259 {0x41, "/jy"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
260 {0x42, "/pz"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
261 {0x43, "/se"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
262 {0x44, "/fd"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
263 {0x45, "/dy"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
264 {0x46, "/ll"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
265 {0x47, "/hx"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
266 {0x48, "/bz"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
267 {0x49, "/shui"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
268 {0x4a, "/dk"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
269 {0x4b, "/gg"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
270 {0x4c, "/fn"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
271 {0x4d, "/tp"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
272 {0x4e, "/cy"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
273 {0x4f, "/wx"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
274 {0x50, "/dd"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
275 {0x51, "/mn"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
276 {0x52, "/hl"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
277 {0x53, "/mamao"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
278 {0x54, "/qz"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
279 {0x55, "/mm"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
280 {0x56, "/fw"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
281 {0x57, "/zhao"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
282 {0x58, "/tiao"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
283 {0x59, "/shan"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
284 {0x5a, "/fad"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
285 {0x5b, "/oh"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
286 {0x5c, "/aiq"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
287 {0x5d, "/bj"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
288 {0x5e, "/zq"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
289 {0x5f, "/qsh"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
290 {0x60, "/bei"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
291 {0x61, "/xig"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
292 {0x62, "/mg"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
293 {0x63, "/dx"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
294 {0x64, "/wen"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
295 {0x65, "/xin"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
296 {0x66, "/xs"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
297 {0x67, "/dg"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
298 {0x68, "/lw"}, |
24629 | 299 {0x69, "/xy"}, |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
300 {0x6a, "/duoy"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
301 {0x6b, "/ty"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
302 {0x6c, "/xr"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
303 {0x6d, "/xixing"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
304 {0x6e, "/yl"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
305 {0x6f, "/qiang"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
306 {0x70, "/ruo"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
307 {0x71, "/nv"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
308 {0x72, "/nan"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
309 {0x73, "/ng"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
310 {0x74, "/kuk"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
311 {0x75, "/feid"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
312 {0x76, "/zk"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
313 {0x77, "/tu"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
314 {0x78, "/jk"}, |
24652 | 315 {0x79, "/sweat"}, |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
316 {0x7a, "/hanx"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
317 {0x7b, "/db"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
318 {0x7c, "/zt"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
319 {0x7d, "/maom"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
320 {0x7e, "/xg"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
321 {0x7f, "/yb"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
322 {0x80, "/coffee"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
323 {0x81, "/fan"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
324 {0x82, "/yw"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
325 {0x83, "/hy"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
326 {0x84, "/dh"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
327 {0x85, "/sj"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
328 {0x86, "/yj"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
329 {0x87, "/ds"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
330 {0x88, "/ws"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
331 {0x89, "/bb"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
332 {0x8a, "/tx"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
333 {0x8b, "/ka"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
334 {0x8c, "/by"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
335 {0x8d, "/am"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
336 {0x8e, "/jie"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
337 {0x8f, "/kun"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
338 {0x90, "/fendou"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
339 {0x91, "/zhm"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
340 {0x92, "/yiw"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
341 {0x93, "/xu"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
342 {0x94, "/yun"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
343 {0x95, "/zhem"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
344 {0x96, "/shuai"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
345 {0x97, "/kl"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
346 {0x98, "/qiao"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
347 {0x99, "/zj"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
348 {0x9a, "/qianc"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
349 {0x9b, "/dp"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
350 {0x9c, "/shd"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
351 {0x9d, "/zhd"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
352 {0x9e, "/dao"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
353 {0x9f, "/yy"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
354 {0xa0, "/shl"}, |
24652 | 355 {0xa1, "/lengh"}, |
24635
3327b1f20fa6
Fixed: Not set flag after qsort
Hu Yong <ccpaging@gmail.com>
parents:
24629
diff
changeset
|
356 {0xa2, "/wipe"}, |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
357 {0xa3, "/kb"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
358 {0xa4, "/gz"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
359 {0xa5, "/qd"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
360 {0xa6, "/huaix"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
361 {0xa7, "/zhh"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
362 {0xa8, "/yhh"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
363 {0xa9, "/hq"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
364 {0xaa, "/bs"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
365 {0xab, "/wq"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
366 {0xac, "/kk"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
367 {0xad, "/yx"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
368 {0xae, "/qq"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
369 {0xaf, "/xia"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
370 {0xb0, "/kel"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
371 {0xb1, "/cd"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
372 {0xb2, "/pj"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
373 {0xb3, "/lq"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
374 {0xb4, "/pp"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
375 {0xb5, "/sa"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
376 {0xb6, "/pc"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
377 {0xb7, "/bq"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
378 {0xb8, "/gy"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
379 {0xb9, "/qt"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
380 {0xba, "/cj"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
381 {0xbb, "/aini"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
382 {0xbc, "/bu"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
383 {0xbd, "/hd"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
384 {0xbe, "/zhq"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
385 {0xbf, "/kt"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
386 {0xc0, "/ht"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
387 {0xc1, "/tsh"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
388 {0xc2, "/hsh"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
389 {0xc3, "/jd"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
390 {0xc4, "/jw"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
391 {0xc5, "/xw"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
392 {0xc6, "/ztj"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
393 {0xc7, "/ytj"}, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
394 {0, NULL} |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
395 }; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
396 gint emoticons_sym_num = sizeof(emoticons_sym) / sizeof(qq_emoticon) - 1;; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
397 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
398 static int emoticon_cmp(const void *k1, const void *k2) |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
399 { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
400 const qq_emoticon *e1 = (const qq_emoticon *) k1; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
401 const qq_emoticon *e2 = (const qq_emoticon *) k2; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
402 if (e1->symbol == 0) { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
403 /* purple_debug_info("QQ", "emoticon_cmp len %d\n", strlen(e2->name)); */ |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
404 return strncmp(e1->name, e2->name, strlen(e2->name)); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
405 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
406 if (e2->symbol == 0) { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
407 /* purple_debug_info("QQ", "emoticon_cmp len %d\n", strlen(e1->name)); */ |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
408 return strncmp(e1->name, e2->name, strlen(e1->name)); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
409 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
410 return strcmp(e1->name, e2->name); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
411 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
412 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
413 static void emoticon_try_sort() |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
414 { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
415 if (emoticons_is_sorted) |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
416 return; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
417 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
418 purple_debug_info("QQ", "qsort stand emoticons\n"); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
419 qsort(emoticons_std, emoticons_std_num, sizeof(qq_emoticon), emoticon_cmp); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
420 purple_debug_info("QQ", "qsort extend emoticons\n"); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
421 qsort(emoticons_ext, emoticons_ext_num, sizeof(qq_emoticon), emoticon_cmp); |
24635
3327b1f20fa6
Fixed: Not set flag after qsort
Hu Yong <ccpaging@gmail.com>
parents:
24629
diff
changeset
|
422 emoticons_is_sorted = TRUE; |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
423 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
424 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
425 static qq_emoticon *emoticon_find(gchar *name) |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
426 { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
427 qq_emoticon *ret = NULL; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
428 qq_emoticon key; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
429 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
430 g_return_val_if_fail(name != NULL, NULL); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
431 emoticon_try_sort(); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
432 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
433 key.name = name; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
434 key.symbol = 0; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
435 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
436 /* purple_debug_info("QQ", "bsearch emoticon %.20s\n", name); */ |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
437 ret = (qq_emoticon *)bsearch(&key, emoticons_ext, emoticons_ext_num, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
438 sizeof(qq_emoticon), emoticon_cmp); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
439 if (ret != NULL) { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
440 return ret; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
441 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
442 ret = (qq_emoticon *)bsearch(&key, emoticons_std, emoticons_std_num, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
443 sizeof(qq_emoticon), emoticon_cmp); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
444 return ret; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
445 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
446 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
447 static gchar *emoticon_get(guint8 symbol) |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
448 { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
449 g_return_val_if_fail(symbol >= emoticons_sym[0].symbol, NULL); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
450 g_return_val_if_fail(symbol <= emoticons_sym[emoticons_sym_num - 2].symbol, NULL); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
451 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
452 return emoticons_sym[symbol - emoticons_sym[0].symbol].name; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
453 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
454 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
455 /* convert qq emote icon to purple sytle |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
456 Notice: text is in qq charset, GB18030 or utf8 */ |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
457 gchar *qq_emoticon_to_purple(gchar *text) |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
458 { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
459 gchar *ret; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
460 GString *converted; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
461 gchar **segments; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
462 gboolean have_smiley; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
463 gchar *purple_smiley; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
464 gchar *cur; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
465 guint8 symbol; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
466 |
24642
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
467 /* qq_show_packet("text", (guint8 *)text, strlen(text)); */ |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
468 g_return_val_if_fail(text != NULL && strlen(text) != 0, g_strdup("")); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
469 |
24925
1300601041ac
g_strsplit_set is new in glib 2.4
Stu Tomlinson <stu@nosnilmot.com>
parents:
24719
diff
changeset
|
470 while ((cur = strchr(text, '\x14')) != NULL) |
1300601041ac
g_strsplit_set is new in glib 2.4
Stu Tomlinson <stu@nosnilmot.com>
parents:
24719
diff
changeset
|
471 *cur = '\x15'; |
1300601041ac
g_strsplit_set is new in glib 2.4
Stu Tomlinson <stu@nosnilmot.com>
parents:
24719
diff
changeset
|
472 |
1300601041ac
g_strsplit_set is new in glib 2.4
Stu Tomlinson <stu@nosnilmot.com>
parents:
24719
diff
changeset
|
473 segments = g_strsplit(text, "\x15", 0); |
24653
fecedf6d9ee1
propagate from branch 'im.pidgin.pidgin' (head 97d295a04f3a9852a3b29cf0df43d56d1ddcc672)
SHiNE CsyFeK <csyfek@gmail.com>
diff
changeset
|
474 if(segments == NULL) { |
fecedf6d9ee1
propagate from branch 'im.pidgin.pidgin' (head 97d295a04f3a9852a3b29cf0df43d56d1ddcc672)
SHiNE CsyFeK <csyfek@gmail.com>
diff
changeset
|
475 return g_strdup(""); |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
476 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
477 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
478 converted = g_string_new(""); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
479 have_smiley = FALSE; |
24642
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
480 if (segments[0] != NULL) { |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
481 g_string_append(converted, segments[0]); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
482 } else { |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
483 purple_debug_info("QQ", "segments[0] is NULL\n"); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
484 } |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
485 while ((*(++segments)) != NULL) { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
486 have_smiley = TRUE; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
487 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
488 cur = *segments; |
24642
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
489 if (cur == NULL) { |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
490 purple_debug_info("QQ", "current segment is NULL\n"); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
491 break; |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
492 } |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
493 if (strlen(cur) == 0) { |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
494 purple_debug_info("QQ", "current segment length is 0\n"); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
495 break; |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
496 } |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
497 symbol = (guint8)cur[0]; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
498 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
499 purple_smiley = emoticon_get(symbol); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
500 if (purple_smiley == NULL) { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
501 purple_debug_info("QQ", "Not found smiley of 0x%02X\n", symbol); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
502 g_string_append(converted, "<IMG ID=\"0\">"); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
503 } else { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
504 purple_debug_info("QQ", "Found 0x%02X smiley is %s\n", symbol, purple_smiley); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
505 g_string_append(converted, purple_smiley); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
506 g_string_append(converted, cur + 1); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
507 } |
24642
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
508 /* purple_debug_info("QQ", "next segment\n"); */ |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
509 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
510 |
24642
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
511 /* purple_debug_info("QQ", "end of convert\n"); */ |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
512 if (!have_smiley) { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
513 g_string_prepend(converted, "<font sml=\"none\">"); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
514 g_string_append(converted, "</font>"); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
515 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
516 ret = converted->str; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
517 g_string_free(converted, FALSE); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
518 return ret; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
519 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
520 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
521 void qq_im_fmt_free(qq_im_format *fmt) |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
522 { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
523 g_return_if_fail(fmt != NULL); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
524 if (fmt->font) g_free(fmt->font); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
525 g_free(fmt); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
526 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
527 |
24642
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
528 qq_im_format *qq_im_fmt_new(void) |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
529 { |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
530 qq_im_format *fmt; |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
531 const gchar simsun[] = { 0xcb, 0xce, 0xcc, 0xe5, 0}; /* simsun in Chinese */ |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
532 |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
533 fmt = g_new0(qq_im_format, 1); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
534 memset(fmt, 0, sizeof(qq_im_format)); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
535 fmt->font_len = strlen(simsun); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
536 fmt->font = g_strdup(simsun); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
537 fmt->attr = 10; |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
538 /* encoding, 0x8602=GB, 0x0000=EN, define BIG5 support here */ |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
539 fmt->charset = 0x8602; |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
540 |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
541 return fmt; |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
542 } |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
543 |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
544 qq_im_format *qq_im_fmt_new_by_purple(const gchar *msg) |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
545 { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
546 qq_im_format *fmt; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
547 const gchar *start, *end, *last; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
548 GData *attribs; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
549 gchar *tmp; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
550 unsigned char *rgb; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
551 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
552 g_return_val_if_fail(msg != NULL, NULL); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
553 |
24642
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
554 fmt = qq_im_fmt_new(); |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
555 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
556 last = msg; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
557 while (purple_markup_find_tag("font", last, &start, &end, &attribs)) { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
558 tmp = g_datalist_get_data(&attribs, "face"); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
559 if (tmp && strlen(tmp) > 0) { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
560 if (fmt->font) g_free(fmt->font); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
561 fmt->font_len = strlen(tmp); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
562 fmt->font = g_strdup(tmp); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
563 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
564 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
565 tmp = g_datalist_get_data(&attribs, "size"); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
566 if (tmp) { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
567 fmt->attr = atoi(tmp) * 3 + 1; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
568 fmt->attr &= 0x0f; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
569 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
570 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
571 tmp = g_datalist_get_data(&attribs, "color"); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
572 if (tmp && strlen(tmp) > 1) { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
573 rgb = purple_base16_decode(tmp + 1, NULL); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
574 g_memmove(fmt->rgb, rgb, 3); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
575 g_free(rgb); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
576 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
577 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
578 g_datalist_clear(&attribs); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
579 last = end + 1; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
580 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
581 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
582 if (purple_markup_find_tag("b", msg, &start, &end, &attribs)) { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
583 fmt->attr |= 0x20; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
584 g_datalist_clear(&attribs); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
585 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
586 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
587 if (purple_markup_find_tag("i", msg, &start, &end, &attribs)) { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
588 fmt->attr |= 0x40; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
589 g_datalist_clear(&attribs); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
590 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
591 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
592 if (purple_markup_find_tag("u", msg, &start, &end, &attribs)) { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
593 fmt->attr |= 0x80; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
594 g_datalist_clear(&attribs); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
595 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
596 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
597 return fmt; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
598 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
599 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
600 /* convert qq format to purple |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
601 Notice: text is in qq charset, GB18030 or utf8 */ |
24642
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
602 gchar *qq_im_fmt_to_purple(qq_im_format *fmt, gchar *text) |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
603 { |
24642
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
604 GString *converted, *tmp; |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
605 gchar *ret; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
606 gint size; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
607 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
608 converted = g_string_new(text); |
24642
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
609 tmp = g_string_new(""); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
610 g_string_append_printf(tmp, "<font color=\"#%02x%02x%02x\">", |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
611 fmt->rgb[0], fmt->rgb[1], fmt->rgb[2]); |
24642
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
612 g_string_prepend(converted, tmp->str); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
613 g_string_set_size(tmp, 0); |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
614 g_string_append(converted, "</font>"); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
615 |
24642
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
616 /* Fixme: |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
617 * check font face can be convert to utf8 or not? |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
618 * If failed, prepending font face cause msg display as "(NULL)" */ |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
619 if (fmt->font != NULL) { |
24642
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
620 g_string_append_printf(tmp, "<font face=\"%s\">", fmt->font); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
621 g_string_prepend(converted, tmp->str); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
622 g_string_set_size(tmp, 0); |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
623 g_string_append(converted, "</font>"); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
624 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
625 size = (fmt->attr & 0x1f) / 3; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
626 if (size >= 0) { |
24642
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
627 g_string_append_printf(tmp, "<font size=\"%d\">", size); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
628 g_string_prepend(converted, tmp->str); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
629 g_string_set_size(tmp, 0); |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
630 g_string_append(converted, "</font>"); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
631 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
632 if (fmt->attr & 0x20) { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
633 /* bold */ |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
634 g_string_prepend(converted, "<b>"); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
635 g_string_append(converted, "</b>"); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
636 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
637 if (fmt->attr & 0x40) { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
638 /* italic */ |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
639 g_string_prepend(converted, "<i>"); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
640 g_string_append(converted, "</i>"); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
641 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
642 if (fmt->attr & 0x80) { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
643 /* underline */ |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
644 g_string_prepend(converted, "<u>"); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
645 g_string_append(converted, "</u>"); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
646 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
647 |
24642
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
648 g_string_free(tmp, TRUE); |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
649 ret = converted->str; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
650 g_string_free(converted, FALSE); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
651 return ret; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
652 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
653 |
24642
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
654 gint qq_put_im_tail(guint8 *buf, qq_im_format *fmt) |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
655 { |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
656 gint bytes; |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
657 |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
658 g_return_val_if_fail(buf != NULL && fmt != NULL, 0); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
659 |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
660 bytes = 0; |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
661 bytes += qq_put8(buf + bytes, 0); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
662 bytes += qq_put8(buf + bytes, fmt->attr); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
663 bytes += qq_putdata(buf + bytes, fmt->rgb, sizeof(fmt->rgb)); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
664 bytes += qq_put8(buf + bytes, 0); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
665 bytes += qq_put16(buf + bytes, fmt->charset); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
666 if (fmt->font != NULL && fmt->font_len > 0) { |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
667 bytes += qq_putdata(buf + bytes, (guint8 *)fmt->font, fmt->font_len); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
668 } else { |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
669 purple_debug_warning("QQ", "Font name is empty\n"); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
670 } |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
671 bytes += qq_put8(buf + bytes, bytes + 1); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
672 /* qq_show_packet("IM tail", buf, bytes); */ |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
673 return bytes; |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
674 } |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
675 |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
676 /* data includes text msg and font attr*/ |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
677 gint qq_get_im_tail(qq_im_format *fmt, guint8 *data, gint data_len) |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
678 { |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
679 gint bytes, text_len; |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
680 guint8 tail_len; |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
681 guint8 font_len; |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
682 |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
683 g_return_val_if_fail(fmt != NULL && data != NULL, 0); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
684 g_return_val_if_fail(data_len > 1, 0); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
685 tail_len = data[data_len - 1]; |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
686 g_return_val_if_fail(tail_len > 2, 0); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
687 text_len = data_len - tail_len; |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
688 g_return_val_if_fail(text_len >= 0, 0); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
689 |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
690 bytes = text_len; |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
691 /* qq_show_packet("IM tail", data + bytes, tail_len); */ |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
692 bytes += 1; /* skip 0x00 */ |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
693 bytes += qq_get8(&fmt->attr, data + bytes); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
694 bytes += qq_getdata(fmt->rgb, sizeof(fmt->rgb), data + bytes); /* red,green,blue */ |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
695 bytes += 1; /* skip 0x00 */ |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
696 bytes += qq_get16(&fmt->charset, data + bytes); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
697 |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
698 font_len = data_len - bytes - 1; |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
699 g_return_val_if_fail(font_len > 0, bytes + 1); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
700 |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
701 fmt->font_len = font_len; |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
702 if (fmt->font != NULL) g_free(fmt->font); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
703 fmt->font = g_strndup((gchar *)data + bytes, fmt->font_len); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
704 return tail_len; |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
705 } |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
706 |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
707 void qq_got_message(PurpleConnection *gc, const gchar *msg) |
24135
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
708 { |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
709 qq_data *qd; |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
710 gchar *from; |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
711 time_t now = time(NULL); |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
712 |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
713 g_return_if_fail(gc != NULL && gc->proto_data != NULL); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
714 qd = gc->proto_data; |
24135
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
715 |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
716 g_return_if_fail(qd->uid > 0); |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
717 |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
718 qq_buddy_find_or_new(gc, qd->uid); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
719 |
24138
dc112387190f
2008.09.29 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24135
diff
changeset
|
720 from = uid_to_purple_name(qd->uid); |
25511
9f1b9eff5ebc
applied changes from 30c025a5facc491ee082435ffe5d2ccfec619678
Evan Schoenberg <evan.s@dreskin.net>
parents:
24925
diff
changeset
|
721 serv_got_im(gc, from, msg, PURPLE_MESSAGE_SYSTEM, now); |
24138
dc112387190f
2008.09.29 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24135
diff
changeset
|
722 g_free(from); |
24135
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
723 } |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
724 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
725 /* process received normal text IM */ |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
726 static void process_im_text(PurpleConnection *gc, guint8 *data, gint len, qq_im_header *im_header) |
24143
c2253c485728
2008.10.04 - ccpaging <ccpagint(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24140
diff
changeset
|
727 { |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
728 qq_data *qd; |
24143
c2253c485728
2008.10.04 - ccpaging <ccpagint(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24140
diff
changeset
|
729 guint16 purple_msg_type; |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
730 gchar *who; |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
731 gchar *msg_smiley, *msg_fmt, *msg_utf8; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
732 PurpleBuddy *buddy; |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
733 qq_buddy_data *bd; |
24642
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
734 gint bytes, tail_len; |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
735 qq_im_format *fmt = NULL; |
24145
ec3f7d3e0445
2008.10.04 - lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24143
diff
changeset
|
736 |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
737 struct { |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
738 /* now comes the part for text only */ |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
739 guint16 msg_seq; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
740 guint32 send_time; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
741 guint16 sender_icon; |
24642
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
742 guint8 unknown1[3]; |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
743 guint8 has_font_attr; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
744 guint8 fragment_count; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
745 guint8 fragment_index; |
24642
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
746 guint8 msg_id; |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
747 guint8 unknown2; |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
748 guint8 msg_type; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
749 gchar *msg; /* no fixed length, ends with 0x00 */ |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
750 } im_text; |
24143
c2253c485728
2008.10.04 - ccpaging <ccpagint(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24140
diff
changeset
|
751 |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
752 g_return_if_fail (data != NULL && len > 0); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
753 g_return_if_fail(im_header != NULL); |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
754 |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
755 qd = (qq_data *) gc->proto_data; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
756 memset(&im_text, 0, sizeof(im_text)); |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
757 |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
758 /* qq_show_packet("IM text", data, len); */ |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
759 bytes = 0; |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
760 bytes += qq_get16(&(im_text.msg_seq), data + bytes); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
761 bytes += qq_get32(&(im_text.send_time), data + bytes); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
762 bytes += qq_get16(&(im_text.sender_icon), data + bytes); |
24642
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
763 bytes += qq_getdata(im_text.unknown1, sizeof(im_text.unknown1), data + bytes); /* 0x(00 00 00)*/ |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
764 bytes += qq_get8(&(im_text.has_font_attr), data + bytes); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
765 bytes += qq_get8(&(im_text.fragment_count), data + bytes); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
766 bytes += qq_get8(&(im_text.fragment_index), data + bytes); |
24642
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
767 bytes += qq_get8(&(im_text.msg_id), data + bytes); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
768 bytes += 1; /* skip 0x00 */ |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
769 bytes += qq_get8(&(im_text.msg_type), data + bytes); |
24642
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
770 purple_debug_info("QQ", "IM Seq %u, id %04X, fragment %d-%d, type %d, %s\n", |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
771 im_text.msg_seq, im_text.msg_id, |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
772 im_text.fragment_count, im_text.fragment_index, |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
773 im_text.msg_type, |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
774 im_text.has_font_attr ? "exist font atrr" : ""); |
24145
ec3f7d3e0445
2008.10.04 - lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24143
diff
changeset
|
775 |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
776 if (im_text.has_font_attr) { |
24642
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
777 fmt = qq_im_fmt_new(); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
778 tail_len = qq_get_im_tail(fmt, data + bytes, len - bytes); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
779 im_text.msg = g_strndup((gchar *)(data + bytes), len - tail_len); |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
780 } else { |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
781 im_text.msg = g_strndup((gchar *)(data + bytes), len - bytes); |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
782 } |
24642
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
783 /* qq_show_packet("IM text", (guint8 *)im_text.msg , strlen(im_text.msg) ); */ |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
784 |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
785 who = uid_to_purple_name(im_header->uid_from); |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
786 buddy = purple_find_buddy(gc->account, who); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
787 if (buddy == NULL) { |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
788 /* create no-auth buddy */ |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
789 buddy = qq_buddy_new(gc, im_header->uid_from); |
24145
ec3f7d3e0445
2008.10.04 - lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24143
diff
changeset
|
790 } |
25872
cf6dfd38c7c1
Fix a botched line in the merge...
Gary Kramlich <grim@reaperworld.com>
parents:
25871
diff
changeset
|
791 bd = (buddy == NULL) ? NULL : purple_buddy_get_protocol_data(buddy); |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
792 if (bd != NULL) { |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
793 bd->client_tag = im_header->version_from; |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
794 bd->face = im_text.sender_icon; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
795 qq_update_buddy_icon(gc->account, who, bd->face); |
24143
c2253c485728
2008.10.04 - ccpaging <ccpagint(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24140
diff
changeset
|
796 } |
c2253c485728
2008.10.04 - ccpaging <ccpagint(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24140
diff
changeset
|
797 |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
798 purple_msg_type = (im_text.msg_type == QQ_IM_AUTO_REPLY) |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
799 ? PURPLE_MESSAGE_AUTO_RESP : 0; |
24143
c2253c485728
2008.10.04 - ccpaging <ccpagint(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24140
diff
changeset
|
800 |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
801 msg_smiley = qq_emoticon_to_purple(im_text.msg); |
24642
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
802 if (fmt != NULL) { |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
803 msg_fmt = qq_im_fmt_to_purple(fmt, msg_smiley); |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
804 msg_utf8 = qq_to_utf8(msg_fmt, QQ_CHARSET_DEFAULT); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
805 g_free(msg_fmt); |
24642
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
806 qq_im_fmt_free(fmt); |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
807 } else { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
808 msg_utf8 = qq_to_utf8(msg_smiley, QQ_CHARSET_DEFAULT); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
809 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
810 g_free(msg_smiley); |
24143
c2253c485728
2008.10.04 - ccpaging <ccpagint(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24140
diff
changeset
|
811 |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
812 /* send encoded to purple, note that we use im_text.send_time, |
24143
c2253c485728
2008.10.04 - ccpaging <ccpagint(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24140
diff
changeset
|
813 * not the time we receive the message |
c2253c485728
2008.10.04 - ccpaging <ccpagint(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24140
diff
changeset
|
814 * as it may have been delayed when I am not online. */ |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
815 purple_debug_info("QQ", "IM from %u: %s\n", im_header->uid_from,msg_utf8); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
816 serv_got_im(gc, who, msg_utf8, purple_msg_type, (time_t) im_text.send_time); |
24143
c2253c485728
2008.10.04 - ccpaging <ccpagint(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24140
diff
changeset
|
817 |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
818 g_free(msg_utf8); |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
819 g_free(who); |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
820 g_free(im_text.msg); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
821 } |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
822 |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
823 /* process received extended (2007) text IM */ |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
824 static void process_extend_im_text(PurpleConnection *gc, guint8 *data, gint len, qq_im_header *im_header) |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
825 { |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
826 qq_data *qd; |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
827 guint16 purple_msg_type; |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
828 gchar *who; |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
829 gchar *msg_smiley, *msg_fmt, *msg_utf8; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
830 PurpleBuddy *buddy; |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
831 qq_buddy_data *bd; |
24642
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
832 gint bytes, tail_len; |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
833 qq_im_format *fmt = NULL; |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
834 |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
835 struct { |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
836 /* now comes the part for text only */ |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
837 guint16 msg_seq; |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
838 guint32 send_time; |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
839 guint16 sender_icon; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
840 guint32 has_font_attr; |
24642
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
841 guint8 unknown1[8]; |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
842 guint8 fragment_count; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
843 guint8 fragment_index; |
24642
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
844 guint8 msg_id; |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
845 guint8 unknown2; |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
846 guint8 msg_type; |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
847 gchar *msg; /* no fixed length, ends with 0x00 */ |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
848 guint8 fromMobileQQ; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
849 } im_text; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
850 |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
851 g_return_if_fail (data != NULL && len > 0); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
852 g_return_if_fail(im_header != NULL); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
853 |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
854 qd = (qq_data *) gc->proto_data; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
855 memset(&im_text, 0, sizeof(im_text)); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
856 |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
857 /* qq_show_packet("Extend IM text", data, len); */ |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
858 bytes = 0; |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
859 bytes += qq_get16(&(im_text.msg_seq), data + bytes); |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
860 bytes += qq_get32(&(im_text.send_time), data + bytes); |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
861 bytes += qq_get16(&(im_text.sender_icon), data + bytes); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
862 bytes += qq_get32(&(im_text.has_font_attr), data + bytes); |
24642
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
863 bytes += qq_getdata(im_text.unknown1, sizeof(im_text.unknown1), data + bytes); |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
864 bytes += qq_get8(&(im_text.fragment_count), data + bytes); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
865 bytes += qq_get8(&(im_text.fragment_index), data + bytes); |
24642
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
866 bytes += qq_get8(&(im_text.msg_id), data + bytes); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
867 bytes += 1; /* skip 0x00 */ |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
868 bytes += qq_get8(&(im_text.msg_type), data + bytes); |
24642
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
869 purple_debug_info("QQ", "IM Seq %u, id %04X, fragment %d-%d, type %d, %s\n", |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
870 im_text.msg_seq, im_text.msg_id, |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
871 im_text.fragment_count, im_text.fragment_index, |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
872 im_text.msg_type, |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
873 im_text.has_font_attr ? "exist font atrr" : ""); |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
874 |
24642
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
875 if (im_text.has_font_attr) { |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
876 fmt = qq_im_fmt_new(); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
877 tail_len = qq_get_im_tail(fmt, data + bytes, len - bytes); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
878 im_text.msg = g_strndup((gchar *)(data + bytes), len - tail_len); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
879 } else { |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
880 im_text.msg = g_strndup((gchar *)(data + bytes), len - bytes); |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
881 } |
24642
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
882 /* qq_show_packet("IM text", (guint8 *)im_text.msg , strlen(im_text.msg)); */ |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
883 |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
884 if(im_text.fragment_count == 0) im_text.fragment_count = 1; |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
885 |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
886 who = uid_to_purple_name(im_header->uid_from); |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
887 buddy = purple_find_buddy(gc->account, who); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
888 if (buddy == NULL) { |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
889 /* create no-auth buddy */ |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
890 buddy = qq_buddy_new(gc, im_header->uid_from); |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
891 } |
25874
367b3ddcf5c3
propagate from branch 'im.pidgin.pidgin' (head 81aa401ac9855c99eb55a7cf91fa221860dee220)
Richard Laager <rlaager@wiktel.com>
diff
changeset
|
892 bd = (buddy == NULL) ? NULL : purple_buddy_get_protocol_data(buddy); |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
893 if (bd != NULL) { |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
894 bd->client_tag = im_header->version_from; |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
895 bd->face = im_text.sender_icon; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
896 qq_update_buddy_icon(gc->account, who, bd->face); |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
897 } |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
898 |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
899 purple_msg_type = 0; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
900 |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
901 msg_smiley = qq_emoticon_to_purple(im_text.msg); |
24642
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
902 if (fmt != NULL) { |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
903 msg_fmt = qq_im_fmt_to_purple(fmt, msg_smiley); |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
904 msg_utf8 = qq_to_utf8(msg_fmt, QQ_CHARSET_DEFAULT); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
905 g_free(msg_fmt); |
24642
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
906 qq_im_fmt_free(fmt); |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
907 } else { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
908 msg_utf8 = qq_to_utf8(msg_smiley, QQ_CHARSET_DEFAULT); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
909 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
910 g_free(msg_smiley); |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
911 |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
912 /* send encoded to purple, note that we use im_text.send_time, |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
913 * not the time we receive the message |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
914 * as it may have been delayed when I am not online. */ |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
915 serv_got_im(gc, who, msg_utf8, purple_msg_type, (time_t) im_text.send_time); |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
916 |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
917 g_free(msg_utf8); |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
918 g_free(who); |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
919 g_free(im_text.msg); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
920 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
921 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
922 /* it is a normal IM, maybe text or video request */ |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
923 void qq_process_im(PurpleConnection *gc, guint8 *data, gint len) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
924 { |
23048 | 925 gint bytes = 0; |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
926 qq_im_header im_header; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
927 |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
928 g_return_if_fail (data != NULL && len > 0); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
929 |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
930 bytes = get_im_header(&im_header, data, len); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
931 if (bytes < 0) { |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
932 purple_debug_error("QQ", "Fail read im header, len %d\n", len); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
933 qq_show_packet ("IM Header", data, len); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
934 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
935 } |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
936 purple_debug_info("QQ", |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
937 "Got IM to %u, type: %02X from: %u ver: %s (%04X)\n", |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
938 im_header.uid_to, im_header.im_type, im_header.uid_from, |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
939 qq_get_ver_desc(im_header.version_from), im_header.version_from); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
940 |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
941 switch (im_header.im_type) { |
23048 | 942 case QQ_NORMAL_IM_TEXT: |
943 if (bytes >= len - 1) { | |
24115
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24114
diff
changeset
|
944 purple_debug_warning("QQ", "Received normal IM text is empty\n"); |
23048 | 945 return; |
946 } | |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
947 process_im_text(gc, data + bytes, len - bytes, &im_header); |
23048 | 948 break; |
949 case QQ_NORMAL_IM_FILE_REJECT_UDP: | |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
950 qq_process_recv_file_reject(data + bytes, len - bytes, im_header.uid_from, gc); |
23048 | 951 break; |
952 case QQ_NORMAL_IM_FILE_APPROVE_UDP: | |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
953 qq_process_recv_file_accept(data + bytes, len - bytes, im_header.uid_from, gc); |
23048 | 954 break; |
955 case QQ_NORMAL_IM_FILE_REQUEST_UDP: | |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
956 qq_process_recv_file_request(data + bytes, len - bytes, im_header.uid_from, gc); |
23048 | 957 break; |
958 case QQ_NORMAL_IM_FILE_CANCEL: | |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
959 qq_process_recv_file_cancel(data + bytes, len - bytes, im_header.uid_from, gc); |
23048 | 960 break; |
961 case QQ_NORMAL_IM_FILE_NOTIFY: | |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
962 qq_process_recv_file_notify(data + bytes, len - bytes, im_header.uid_from, gc); |
23048 | 963 break; |
24115
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24114
diff
changeset
|
964 case QQ_NORMAL_IM_FILE_REQUEST_TCP: |
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24114
diff
changeset
|
965 /* Check ReceivedFileIM::parseContents in eva*/ |
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24114
diff
changeset
|
966 /* some client use this function for detect invisable buddy*/ |
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24114
diff
changeset
|
967 case QQ_NORMAL_IM_FILE_APPROVE_TCP: |
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24114
diff
changeset
|
968 case QQ_NORMAL_IM_FILE_REJECT_TCP: |
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24114
diff
changeset
|
969 case QQ_NORMAL_IM_FILE_PASV: |
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24114
diff
changeset
|
970 case QQ_NORMAL_IM_FILE_EX_REQUEST_UDP: |
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24114
diff
changeset
|
971 case QQ_NORMAL_IM_FILE_EX_REQUEST_ACCEPT: |
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24114
diff
changeset
|
972 case QQ_NORMAL_IM_FILE_EX_REQUEST_CANCEL: |
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24114
diff
changeset
|
973 case QQ_NORMAL_IM_FILE_EX_NOTIFY_IP: |
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24114
diff
changeset
|
974 qq_show_packet ("Not support", data, len); |
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24114
diff
changeset
|
975 break; |
23048 | 976 default: |
977 /* a simple process here, maybe more later */ | |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
978 qq_show_packet ("Unknow", data + bytes, len - bytes); |
23048 | 979 return; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
980 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
981 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
982 |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
983 /* it is a extended IM, maybe text or video request */ |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
984 void qq_process_extend_im(PurpleConnection *gc, guint8 *data, gint len) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
985 { |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
986 gint bytes; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
987 qq_im_header im_header; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
988 |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
989 g_return_if_fail (data != NULL && len > 0); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
990 |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
991 bytes = get_im_header(&im_header, data, len); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
992 if (bytes < 0) { |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
993 purple_debug_error("QQ", "Fail read im header, len %d\n", len); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
994 qq_show_packet ("IM Header", data, len); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
995 return; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
996 } |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
997 purple_debug_info("QQ", |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
998 "Got Extend IM to %u, type: %02X from: %u ver: %s (%04X)\n", |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
999 im_header.uid_to, im_header.im_type, im_header.uid_from, |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
1000 qq_get_ver_desc(im_header.version_from), im_header.version_from); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1001 |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
1002 switch (im_header.im_type) { |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1003 case QQ_NORMAL_IM_TEXT: |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1004 process_extend_im_text(gc, data + bytes, len - bytes, &im_header); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1005 break; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1006 case QQ_NORMAL_IM_FILE_REJECT_UDP: |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1007 qq_process_recv_file_reject (data + bytes, len - bytes, im_header.uid_from, gc); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1008 break; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1009 case QQ_NORMAL_IM_FILE_APPROVE_UDP: |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1010 qq_process_recv_file_accept (data + bytes, len - bytes, im_header.uid_from, gc); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1011 break; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1012 case QQ_NORMAL_IM_FILE_REQUEST_UDP: |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1013 qq_process_recv_file_request (data + bytes, len - bytes, im_header.uid_from, gc); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1014 break; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1015 case QQ_NORMAL_IM_FILE_CANCEL: |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1016 qq_process_recv_file_cancel (data + bytes, len - bytes, im_header.uid_from, gc); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1017 break; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1018 case QQ_NORMAL_IM_FILE_NOTIFY: |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1019 qq_process_recv_file_notify (data + bytes, len - bytes, im_header.uid_from, gc); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1020 break; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1021 case QQ_NORMAL_IM_FILE_REQUEST_TCP: |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1022 /* Check ReceivedFileIM::parseContents in eva*/ |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1023 /* some client use this function for detect invisable buddy*/ |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1024 case QQ_NORMAL_IM_FILE_APPROVE_TCP: |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1025 case QQ_NORMAL_IM_FILE_REJECT_TCP: |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1026 case QQ_NORMAL_IM_FILE_PASV: |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1027 case QQ_NORMAL_IM_FILE_EX_REQUEST_UDP: |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1028 case QQ_NORMAL_IM_FILE_EX_REQUEST_ACCEPT: |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1029 case QQ_NORMAL_IM_FILE_EX_REQUEST_CANCEL: |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1030 case QQ_NORMAL_IM_FILE_EX_NOTIFY_IP: |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1031 qq_show_packet ("Not support", data, len); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1032 break; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1033 default: |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1034 /* a simple process here, maybe more later */ |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1035 qq_show_packet ("Unknow", data + bytes, len - bytes); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1036 break; |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
1037 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1038 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1039 |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
1040 /* send an IM to uid_to */ |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1041 static void request_send_im(PurpleConnection *gc, guint32 uid_to, gint type, |
24642
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
1042 qq_im_format *fmt, gchar *msg, guint8 id, guint8 frag_count, guint8 frag_index) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1043 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1044 qq_data *qd; |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1045 guint8 raw_data[MAX_PACKET_SIZE - 16]; |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
1046 guint16 im_type; |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1047 gint bytes; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1048 time_t now; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1049 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1050 qd = (qq_data *) gc->proto_data; |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
1051 im_type = QQ_NORMAL_IM_TEXT; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1052 |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1053 /* purple_debug_info("QQ", "Send IM %d-%d\n", frag_count, frag_index); */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1054 bytes = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1055 /* 000-003: receiver uid */ |
23048 | 1056 bytes += qq_put32(raw_data + bytes, qd->uid); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1057 /* 004-007: sender uid */ |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
1058 bytes += qq_put32(raw_data + bytes, uid_to); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1059 /* 008-009: sender client version */ |
24135
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
1060 bytes += qq_put16(raw_data + bytes, qd->client_tag); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1061 /* 010-013: receiver uid */ |
23048 | 1062 bytes += qq_put32(raw_data + bytes, qd->uid); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1063 /* 014-017: sender uid */ |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
1064 bytes += qq_put32(raw_data + bytes, uid_to); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1065 /* 018-033: md5 of (uid+session_key) */ |
23048 | 1066 bytes += qq_putdata(raw_data + bytes, qd->session_md5, 16); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1067 /* 034-035: message type */ |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1068 bytes += qq_put16(raw_data + bytes, QQ_NORMAL_IM_TEXT); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1069 /* 036-037: sequence number */ |
23048 | 1070 bytes += qq_put16(raw_data + bytes, qd->send_seq); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1071 /* 038-041: send time */ |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1072 now = time(NULL); |
23048 | 1073 bytes += qq_put32(raw_data + bytes, (guint32) now); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1074 /* 042-043: sender icon */ |
23048 | 1075 bytes += qq_put16(raw_data + bytes, qd->my_icon); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1076 /* 044-046: always 0x00 */ |
23048 | 1077 bytes += qq_put16(raw_data + bytes, 0x0000); |
1078 bytes += qq_put8(raw_data + bytes, 0x00); | |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1079 /* 047-047: always use font attr */ |
23048 | 1080 bytes += qq_put8(raw_data + bytes, 0x01); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1081 /* 048-051: always 0x00 */ |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1082 /* Fixme: frag_count, frag_index not working now */ |
24642
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
1083 bytes += qq_put8(raw_data + bytes, frag_count); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
1084 bytes += qq_put8(raw_data + bytes, frag_index); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
1085 bytes += qq_put8(raw_data + bytes, id); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
1086 bytes += qq_put8(raw_data + bytes, 0); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1087 /* 052-052: text message type (normal/auto-reply) */ |
23048 | 1088 bytes += qq_put8(raw_data + bytes, type); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1089 /* 053- : msg ends with 0x00 */ |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1090 bytes += qq_putdata(raw_data + bytes, (guint8 *)msg, strlen(msg)); |
24642
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
1091 if (frag_count == frag_index + 1) { |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
1092 bytes += qq_put8(raw_data + bytes, 0x20); /* add extra SPACE */ |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
1093 } |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1094 bytes += qq_put_im_tail(raw_data + bytes, fmt); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1095 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1096 /* qq_show_packet("QQ_CMD_SEND_IM", raw_data, bytes); */ |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1097 qq_send_cmd(gc, QQ_CMD_SEND_IM, raw_data, bytes); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1098 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1099 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1100 static void im_convert_and_merge(GString *dest, GString *append) |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1101 { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1102 gchar *converted; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1103 g_return_if_fail(dest != NULL && append != NULL); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1104 |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1105 if (append->str == NULL || append->len <= 0) { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1106 return; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1107 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1108 /* purple_debug_info("QQ", "Append:\n%s\n", append->str); */ |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1109 converted = utf8_to_qq(append->str, QQ_CHARSET_DEFAULT); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1110 g_string_append(dest, converted); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1111 g_string_set_size(append, 0); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1112 g_free(converted); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1113 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1114 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1115 GSList *qq_im_get_segments(gchar *msg_stripped, gboolean is_smiley_none) |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1116 { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1117 GSList *string_list = NULL; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1118 GString *new_string; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1119 GString *append_utf8; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1120 gchar *start, *p; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1121 gint count, len; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1122 qq_emoticon *emoticon; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1123 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1124 g_return_val_if_fail(msg_stripped != NULL, NULL); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1125 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1126 start = msg_stripped; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1127 count = 0; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1128 new_string = g_string_new(""); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1129 append_utf8 = g_string_new(""); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1130 while (*start) { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1131 p = start; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1132 |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1133 /* Convert emoticon */ |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1134 if (!is_smiley_none && *p == '/') { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1135 if (new_string->len + append_utf8->len + 2 > QQ_MSG_IM_MAX) { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1136 /* enough chars to send */ |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1137 im_convert_and_merge(new_string, append_utf8); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1138 string_list = g_slist_append(string_list, strdup(new_string->str)); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1139 g_string_set_size(new_string, 0); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1140 continue; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1141 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1142 emoticon = emoticon_find(p); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1143 if (emoticon != NULL) { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1144 purple_debug_info("QQ", "found emoticon %s as 0x%02X\n", |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1145 emoticon->name, emoticon->symbol); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1146 /* QQ emoticon code prevent converting from utf8 to QQ charset |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1147 * convert append_utf8 to QQ charset |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1148 * merge the result to dest |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1149 * append qq QQ emoticon code to dest */ |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1150 im_convert_and_merge(new_string, append_utf8); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1151 g_string_append_c(new_string, 0x14); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1152 g_string_append_c(new_string, emoticon->symbol); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1153 start += strlen(emoticon->name); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1154 continue; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1155 } else { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1156 purple_debug_info("QQ", "Not found emoticon %.20s\n", p); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1157 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1158 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1159 |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1160 /* Get next char */ |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1161 start = g_utf8_next_char(p); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1162 len = start - p; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1163 if (new_string->len + append_utf8->len + len > QQ_MSG_IM_MAX) { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1164 /* enough chars to send */ |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1165 im_convert_and_merge(new_string, append_utf8); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1166 string_list = g_slist_append(string_list, strdup(new_string->str)); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1167 g_string_set_size(new_string, 0); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1168 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1169 g_string_append_len(append_utf8, p, len); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1170 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1171 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1172 if (new_string->len + append_utf8->len > 0) { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1173 im_convert_and_merge(new_string, append_utf8); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1174 string_list = g_slist_append(string_list, strdup(new_string->str)); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1175 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1176 g_string_free(new_string, TRUE); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1177 g_string_free(append_utf8, TRUE); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1178 return string_list; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1179 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1180 |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1181 gboolean qq_im_smiley_none(const gchar *msg) |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1182 { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1183 const gchar *start, *end, *last; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1184 GData *attribs; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1185 gchar *tmp; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1186 gboolean ret = FALSE; |
24145
ec3f7d3e0445
2008.10.04 - lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24143
diff
changeset
|
1187 |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1188 g_return_val_if_fail(msg != NULL, TRUE); |
24145
ec3f7d3e0445
2008.10.04 - lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24143
diff
changeset
|
1189 |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1190 last = msg; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1191 while (purple_markup_find_tag("font", last, &start, &end, &attribs)) { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1192 tmp = g_datalist_get_data(&attribs, "sml"); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1193 if (tmp && strlen(tmp) > 0) { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1194 if (strcmp(tmp, "none") == 0) { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1195 ret = TRUE; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1196 break; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1197 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1198 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1199 g_datalist_clear(&attribs); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1200 last = end + 1; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1201 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1202 return ret; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1203 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1204 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1205 /* Grab custom emote icons |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1206 static GSList* qq_grab_emoticons(const char *msg, const char*username) |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1207 { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1208 GSList *list; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1209 GList *smileys; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1210 PurpleSmiley *smiley; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1211 const char *smiley_shortcut; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1212 char *ptr; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1213 int length; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1214 PurpleStoredImage *img; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1215 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1216 smileys = purple_smileys_get_all(); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1217 length = strlen(msg); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1218 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1219 for (; smileys; smileys = g_list_delete_link(smileys, smileys)) { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1220 smiley = smileys->data; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1221 smiley_shortcut = purple_smiley_get_shortcut(smiley); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1222 purple_debug_info("QQ", "Smiley shortcut [%s]\n", smiley_shortcut); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1223 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1224 ptr = g_strstr_len(msg, length, smiley_shortcut); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1225 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1226 if (!ptr) |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1227 continue; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1228 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1229 purple_debug_info("QQ", "Found Smiley shortcut [%s]\n", smiley_shortcut); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1230 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1231 img = purple_smiley_get_stored_image(smiley); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1232 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1233 emoticon = g_new0(MsnEmoticon, 1); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1234 emoticon->smile = g_strdup(purple_smiley_get_shortcut(smiley)); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1235 emoticon->obj = msn_object_new_from_image(img, |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1236 purple_imgstore_get_filename(img), |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1237 username, MSN_OBJECT_EMOTICON); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1238 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1239 purple_imgstore_unref(img); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1240 list = g_slist_prepend(list, emoticon); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1241 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1242 return list; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1243 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1244 */ |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1245 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1246 gint qq_send_im(PurpleConnection *gc, const gchar *who, const gchar *what, PurpleMessageFlags flags) |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1247 { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1248 qq_data *qd; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1249 guint32 uid_to; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1250 gint type; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1251 qq_im_format *fmt; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1252 gchar *msg_stripped, *tmp; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1253 GSList *segments, *it; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1254 gint msg_len; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1255 const gchar *start_invalid; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1256 gboolean is_smiley_none; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1257 guint8 frag_count, frag_index; |
24642
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
1258 guint8 msg_id; |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1259 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1260 g_return_val_if_fail(NULL != gc && NULL != gc->proto_data, -1); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1261 g_return_val_if_fail(who != NULL && what != NULL, -1); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1262 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1263 qd = (qq_data *) gc->proto_data; |
24719
5ec72dbdd28e
Fix warnings where size_t/gsize was used for printf with the wrong format
Paul Aurich <paul@darkrain42.org>
parents:
24653
diff
changeset
|
1264 purple_debug_info("QQ", "Send IM to %s, len %" G_GSIZE_FORMAT ":\n%s\n", who, strlen(what), what); |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1265 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1266 uid_to = purple_name_to_uid(who); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1267 if (uid_to == qd->uid) { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1268 /* if msg is to myself, bypass the network */ |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1269 serv_got_im(gc, who, what, flags, time(NULL)); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1270 return 1; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1271 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1272 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1273 type = (flags == PURPLE_MESSAGE_AUTO_RESP ? QQ_IM_AUTO_REPLY : QQ_IM_TEXT); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1274 /* qq_show_packet("IM UTF8", (guint8 *)what, strlen(what)); */ |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1275 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1276 msg_stripped = purple_markup_strip_html(what); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1277 g_return_val_if_fail(msg_stripped != NULL, -1); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1278 /* qq_show_packet("IM Stripped", (guint8 *)what, strlen(what)); */ |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1279 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1280 /* Check and valid utf8 string */ |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1281 msg_len = strlen(msg_stripped); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1282 g_return_val_if_fail(msg_len > 0, -1); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1283 if (!g_utf8_validate(msg_stripped, msg_len, &start_invalid)) { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1284 if (start_invalid > msg_stripped) { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1285 tmp = g_strndup(msg_stripped, start_invalid - msg_stripped); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1286 g_free(msg_stripped); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1287 msg_stripped = g_strconcat(tmp, _("(Invalid UTF-8 string)"), NULL); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1288 g_free(tmp); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1289 } else { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1290 g_free(msg_stripped); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1291 msg_stripped = g_strdup(_("(Invalid UTF-8 string)")); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1292 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1293 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1294 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1295 is_smiley_none = qq_im_smiley_none(what); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1296 segments = qq_im_get_segments(msg_stripped, is_smiley_none); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1297 g_free(msg_stripped); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1298 |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1299 if (segments == NULL) { |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1300 return -1; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1301 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1302 |
24642
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
1303 qd->send_im_id++; |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
1304 msg_id = (guint8)(qd->send_im_id && 0xFF); |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1305 fmt = qq_im_fmt_new_by_purple(what); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1306 frag_count = g_slist_length(segments); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1307 frag_index = 0; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1308 for (it = segments; it; it = it->next) { |
24642
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
1309 /* |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1310 request_send_im(gc, uid_to, type, fmt, (gchar *)it->data, |
24642
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
1311 msg_id, frag_count, frag_index); |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
1312 */ |
05fee0406365
Support sending long IM message
Hu Yong <ccpaging@gmail.com>
parents:
24635
diff
changeset
|
1313 request_send_im(gc, uid_to, type, fmt, (gchar *)it->data, 0, 0, 0); |
24618
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1314 g_free(it->data); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1315 frag_index++; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1316 } |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1317 g_slist_free(segments); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1318 qq_im_fmt_free(fmt); |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1319 return 1; |
682eb95a6aa7
Rewrite smiley convert function
Hu Yong <ccpaging@gmail.com>
parents:
24158
diff
changeset
|
1320 } |