Mercurial > pidgin
annotate libpurple/protocols/qq/group_im.c @ 29682:29df7408df03
Eliminate the name collisions on "Title". I have a few qualms:
* I'm only guessing that Novell and Mxit's "Title" corresponds to
the same thing as Jabber's (i.e. the vCard spec)
* I changed MySpace and MSN's tune names to be in line with XMPP's,
but they seem a bit ugly.
* See the XXX in QQ
Closes #1157, hopefully
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Sun, 04 Apr 2010 04:31:54 +0000 |
parents | 73a30365c293 |
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 group_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:
18141
diff
changeset
|
25 #include "internal.h" |
b8572b937c09
#include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <stu@nosnilmot.com>
parents:
18141
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 "notify.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
30 #include "prefs.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
31 #include "request.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 "char_conv.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
35 #include "group_internal.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
36 #include "group_info.h" |
24159
9be95f0b9472
2008.10.10 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24158
diff
changeset
|
37 #include "group_join.h" |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
38 #include "group_im.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
39 #include "group_opt.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
40 #include "im.h" |
24134
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24115
diff
changeset
|
41 #include "qq_define.h" |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
42 #include "packet_parse.h" |
23695
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23638
diff
changeset
|
43 #include "qq_network.h" |
24115
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24114
diff
changeset
|
44 #include "qq_process.h" |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
45 #include "utils.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
46 |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
47 /* show group conversation window */ |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
48 PurpleConversation *qq_room_conv_open(PurpleConnection *gc, qq_room_data *rmd) |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
49 { |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
50 PurpleConversation *conv; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
51 qq_data *qd; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
52 gchar *topic_utf8; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
53 |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
54 g_return_val_if_fail(rmd != NULL, NULL); |
27537
32d2caa6a777
Commit the QQ null chat room name crash on the *right* branch.
Paul Aurich <paul@darkrain42.org>
parents:
25232
diff
changeset
|
55 g_return_val_if_fail(rmd->title_utf8, NULL); |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
56 qd = (qq_data *) gc->proto_data; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
57 |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
58 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
59 rmd->title_utf8, purple_connection_get_account(gc)); |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
60 if (conv != NULL) { |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
61 /* show only one conversation per room */ |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
62 return conv; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
63 } |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
64 |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
65 serv_got_joined_chat(gc, rmd->id, rmd->title_utf8); |
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
66 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, rmd->title_utf8, purple_connection_get_account(gc)); |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
67 if (conv != NULL) { |
24613
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
68 if (rmd->notice_utf8 != NULL) { |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
69 topic_utf8 = g_strdup_printf("%u %s", rmd->ext_id, rmd->notice_utf8); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
70 } else { |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
71 topic_utf8 = g_strdup_printf("%u", rmd->ext_id); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
72 } |
24633 | 73 purple_debug_info("QQ", "Chat topic = %s\n", topic_utf8); |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
74 purple_conv_chat_set_topic(PURPLE_CONV_CHAT(conv), NULL, topic_utf8); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
75 g_free(topic_utf8); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
76 |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
77 if (rmd->is_got_buddies) |
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
78 qq_send_room_cmd_only(gc, QQ_ROOM_CMD_GET_ONLINES, rmd->id); |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
79 else |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
80 qq_update_room(gc, 0, rmd->id); |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
81 return conv; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
82 } |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
83 return NULL; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
84 } |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
85 |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
86 /* refresh online member in group conversation window */ |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
87 void qq_room_conv_set_onlines(PurpleConnection *gc, qq_room_data *rmd) |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
88 { |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
89 GList *names, *list, *flags; |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
90 qq_buddy_data *bd; |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
91 gchar *member_name, *member_uid; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
92 PurpleConversation *conv; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
93 gint flag; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
94 gboolean is_find; |
24154
237e5a94e11c
2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24149
diff
changeset
|
95 |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
96 g_return_if_fail(rmd != NULL); |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
97 |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
98 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
99 rmd->title_utf8, purple_connection_get_account(gc)); |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
100 if (conv == NULL) { |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
101 purple_debug_warning("QQ", "Conversation \"%s\" is not opened\n", rmd->title_utf8); |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
102 return; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
103 } |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
104 g_return_if_fail(rmd->members != NULL); |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
105 |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
106 names = NULL; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
107 flags = NULL; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
108 |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
109 list = rmd->members; |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
110 while (list != NULL) { |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
111 bd = (qq_buddy_data *) list->data; |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
112 |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
113 /* we need unique identifiers for everyone in the chat or else we'll |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
114 * run into problems with functions like get_cb_real_name from qq.c */ |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
115 member_name = (bd->nickname != NULL && *(bd->nickname) != '\0') ? |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
116 g_strdup_printf("%s (%u)", bd->nickname, bd->uid) : |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
117 g_strdup_printf("(%u)", bd->uid); |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
118 member_uid = g_strdup_printf("(%u)", bd->uid); |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
119 |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
120 flag = 0; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
121 /* TYPING to put online above OP and FOUNDER */ |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
122 if (is_online(bd->status)) flag |= (PURPLE_CBFLAGS_TYPING | PURPLE_CBFLAGS_VOICE); |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
123 if(1 == (bd->role & 1)) flag |= PURPLE_CBFLAGS_OP; |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
124 if(bd->uid == rmd->creator_uid) flag |= PURPLE_CBFLAGS_FOUNDER; |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
125 |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
126 is_find = TRUE; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
127 if (purple_conv_chat_find_user(PURPLE_CONV_CHAT(conv), member_name)) |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
128 { |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
129 purple_conv_chat_user_set_flags(PURPLE_CONV_CHAT(conv), |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
130 member_name, |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
131 flag); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
132 } else if (purple_conv_chat_find_user(PURPLE_CONV_CHAT(conv), member_uid)) |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
133 { |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
134 purple_conv_chat_user_set_flags(PURPLE_CONV_CHAT(conv), |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
135 member_uid, |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
136 flag); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
137 purple_conv_chat_rename_user(PURPLE_CONV_CHAT(conv), member_uid, member_name); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
138 } else { |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
139 is_find = FALSE; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
140 } |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
141 if (!is_find) { |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
142 /* always put it even offline */ |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
143 names = g_list_append(names, member_name); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
144 flags = g_list_append(flags, GINT_TO_POINTER(flag)); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
145 } else { |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
146 g_free(member_name); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
147 } |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
148 g_free(member_uid); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
149 list = list->next; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
150 } |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
151 |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
152 if (names != NULL && flags != NULL) { |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
153 purple_conv_chat_add_users(PURPLE_CONV_CHAT(conv), names, NULL, flags, FALSE); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
154 } |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
155 |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
156 /* clean up names */ |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
157 while (names != NULL) { |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
158 member_name = (gchar *) names->data; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
159 names = g_list_remove(names, member_name); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
160 g_free(member_name); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
161 } |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
162 g_list_free(flags); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
163 } |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
164 |
24135
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
165 void qq_room_got_chat_in(PurpleConnection *gc, |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
166 guint32 room_id, guint32 uid_from, const gchar *msg, time_t in_time) |
24135
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
167 { |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
168 PurpleConversation *conv; |
25232
effbf24b39b1
2009.02.08 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24719
diff
changeset
|
169 qq_data *qd; |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
170 qq_buddy_data *bd; |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
171 qq_room_data *rmd; |
24135
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
172 gchar *from; |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
173 |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
174 g_return_if_fail(gc != NULL && room_id != 0); |
24613
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
175 g_return_if_fail(msg != NULL); |
24135
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
176 |
25232
effbf24b39b1
2009.02.08 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24719
diff
changeset
|
177 qd = (qq_data *)gc->proto_data; |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
178 conv = purple_find_chat(gc, room_id); |
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
179 rmd = qq_room_data_find(gc, room_id); |
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
180 g_return_if_fail(rmd != NULL); |
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
181 |
25232
effbf24b39b1
2009.02.08 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24719
diff
changeset
|
182 purple_debug_info("QQ", "is_show_chat:%d\n", qd->is_show_chat); |
effbf24b39b1
2009.02.08 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24719
diff
changeset
|
183 if (NULL == conv && qd->is_show_chat) { |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
184 conv = qq_room_conv_open(gc, rmd); |
24135
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
185 } |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
186 |
25232
effbf24b39b1
2009.02.08 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24719
diff
changeset
|
187 if (NULL == conv) { |
28212
73a30365c293
Add newline at end of debug messages.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27537
diff
changeset
|
188 purple_debug_info("QQ", "Conversion of %u is not open, missing from %d:/n%s/v\n", |
24603 | 189 room_id, uid_from, msg); |
24135
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
190 return; |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
191 } |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
192 |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
193 if (uid_from != 0) { |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
194 |
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
195 bd = qq_room_buddy_find(rmd, uid_from); |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
196 if (bd == NULL || bd->nickname == NULL) |
24613
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
197 from = g_strdup_printf("%u", uid_from); |
24135
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
198 else |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
199 from = g_strdup(bd->nickname); |
24135
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
200 } else { |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
201 from = g_strdup(""); |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
202 } |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
203 serv_got_chat_in(gc, room_id, from, 0, msg, in_time); |
24135
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
204 g_free(from); |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
205 } |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
206 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
207 /* recv an IM from a group chat */ |
24159
9be95f0b9472
2008.10.10 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24158
diff
changeset
|
208 void qq_process_room_im(guint8 *data, gint data_len, guint32 id, PurpleConnection *gc, guint16 msg_type) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
209 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
210 qq_data *qd; |
24613
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
211 gchar *msg_smiley, *msg_fmt, *msg_utf8; |
24640 | 212 gint bytes, tail_len; |
24135
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
213 struct { |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
214 guint32 ext_id; |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
215 guint8 type8; |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
216 guint32 member_uid; |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
217 guint16 unknown; |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
218 guint16 msg_seq; |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
219 time_t send_time; |
24640 | 220 guint32 version; |
24135
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
221 guint16 msg_len; |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
222 gchar *msg; |
24613
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
223 } im_text; |
24640 | 224 guint32 temp_id; |
225 guint16 content_type; | |
226 guint8 frag_count, frag_index; | |
227 guint16 msg_id; | |
228 qq_im_format *fmt = NULL; | |
24135
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
229 |
24640 | 230 /* at least include im_text.msg_len */ |
231 g_return_if_fail(data != NULL && data_len > 23); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
232 qd = (qq_data *) gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
233 |
24158
b6f09c1c79ce
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24157
diff
changeset
|
234 /* qq_show_packet("ROOM_IM", data, data_len); */ |
24613
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
235 memset(&im_text, 0, sizeof(im_text)); |
24135
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
236 bytes = 0; |
24613
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
237 bytes += qq_get32(&(im_text.ext_id), data + bytes); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
238 bytes += qq_get8(&(im_text.type8), data + bytes); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
239 |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
240 if(QQ_MSG_TEMP_QUN_IM == msg_type) { |
24640 | 241 bytes += qq_get32(&temp_id, data + bytes); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
242 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
243 |
24613
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
244 bytes += qq_get32(&(im_text.member_uid), bytes + data); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
245 bytes += qq_get16(&im_text.unknown, data + bytes); /* 0x0001? */ |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
246 bytes += qq_get16(&(im_text.msg_seq), data + bytes); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
247 bytes += qq_getime(&im_text.send_time, data + bytes); |
24640 | 248 bytes += qq_get32(&im_text.version, data + bytes); |
249 bytes += qq_get16(&(im_text.msg_len), data + bytes); | |
250 purple_debug_info("QQ", "Room IM, ext id %u, seq %u, version 0x%04X, len %u\n", | |
251 im_text.ext_id, im_text.msg_seq, im_text.version, im_text.msg_len); | |
252 | |
253 if (im_text.msg_len != data_len - bytes) { | |
254 purple_debug_warning("QQ", "Room IM length %d should be %d\n", | |
255 im_text.msg_len, data_len - bytes); | |
256 im_text.msg_len = data_len - bytes; | |
257 } | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
258 |
24640 | 259 g_return_if_fail(im_text.msg_len > 0 && bytes + im_text.msg_len <= data_len); |
260 if(msg_type != QQ_MSG_QUN_IM_UNKNOWN) { | |
261 g_return_if_fail(im_text.msg_len >= 10); | |
262 | |
263 bytes += qq_get16(&content_type, data + bytes); | |
264 bytes += qq_get8(&frag_count, data + bytes); | |
265 bytes += qq_get8(&frag_index, data + bytes); | |
266 bytes += qq_get16(&msg_id, data + bytes); | |
267 bytes += 4; /* skip 0x(00 00 00 00) */ | |
268 purple_debug_info("QQ", "Room IM, content %d, frag %d-%d, msg id %u\n", | |
269 content_type, frag_count, frag_index, msg_id); | |
270 im_text.msg_len -= 10; | |
271 } | |
24613
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
272 g_return_if_fail(im_text.msg_len > 0); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
273 |
24158
b6f09c1c79ce
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24157
diff
changeset
|
274 /* qq_show_packet("Message", data + bytes, data_len - bytes); */ |
24640 | 275 if (frag_count <= 1 || frag_count == frag_index + 1) { |
276 fmt = qq_im_fmt_new(); | |
277 tail_len = qq_get_im_tail(fmt, data + bytes, data_len - bytes); | |
278 im_text.msg = g_strndup((gchar *)(data + bytes), data_len - tail_len); | |
24158
b6f09c1c79ce
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24157
diff
changeset
|
279 } else { |
24640 | 280 im_text.msg = g_strndup((gchar *)(data + bytes), data_len - bytes); |
24158
b6f09c1c79ce
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24157
diff
changeset
|
281 } |
24159
9be95f0b9472
2008.10.10 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24158
diff
changeset
|
282 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
283 /* group im_group has no flag to indicate whether it has font_attr or not */ |
24613
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
284 msg_smiley = qq_emoticon_to_purple(im_text.msg); |
24640 | 285 if (fmt != NULL) { |
286 msg_fmt = qq_im_fmt_to_purple(fmt, msg_smiley); | |
24613
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
287 msg_utf8 = qq_to_utf8(msg_fmt, QQ_CHARSET_DEFAULT); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
288 g_free(msg_fmt); |
24640 | 289 qq_im_fmt_free(fmt); |
24140
619ac2303c46
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24135
diff
changeset
|
290 } else { |
24613
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
291 msg_utf8 = qq_to_utf8(msg_smiley, QQ_CHARSET_DEFAULT); |
24140
619ac2303c46
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24135
diff
changeset
|
292 } |
24613
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
293 g_free(msg_smiley); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
294 |
24640 | 295 purple_debug_info("QQ", "Room (%u) IM from %u: %s\n", |
296 im_text.ext_id, im_text.member_uid, msg_utf8); | |
24613
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
297 qq_room_got_chat_in(gc, id, im_text.member_uid, msg_utf8, im_text.send_time); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
298 |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
299 g_free(msg_utf8); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
300 g_free(im_text.msg); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
301 } |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
302 |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
303 /* send IM to a group */ |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
304 static void request_room_send_im(PurpleConnection *gc, guint32 room_id, qq_im_format *fmt, const gchar *msg) |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
305 { |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
306 guint8 raw_data[MAX_PACKET_SIZE - 16]; |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
307 gint bytes; |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
308 |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
309 g_return_if_fail(room_id != 0 && msg != NULL); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
310 |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
311 bytes = 0; |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
312 bytes += qq_put16(raw_data + bytes, 0); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
313 bytes += qq_putdata(raw_data + bytes, (guint8 *)msg, strlen(msg)); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
314 bytes += qq_put_im_tail(raw_data + bytes, fmt); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
315 /* reset first two bytes */ |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
316 qq_put16(raw_data, bytes - 2); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
317 |
24640 | 318 qq_send_room_cmd(gc, QQ_ROOM_CMD_SEND_IM, room_id, raw_data, bytes); |
24613
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
319 } |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
320 |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
321 /* this is the ACK */ |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
322 void qq_process_room_send_im(PurpleConnection *gc, guint8 *data, gint len) |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
323 { |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
324 /* return should be the internal group id |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
325 * but we have nothing to do with it */ |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
326 return; |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
327 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
328 |
24640 | 329 void qq_process_room_send_im_ex(PurpleConnection *gc, guint8 *data, gint len) |
330 { | |
331 /* return should be the internal group id | |
332 * but we have nothing to do with it */ | |
333 return; | |
334 } | |
335 | |
24657
59aae7636111
#if 0 out an unused function to suppress a compiler warning.
Richard Laager <rlaager@wiktel.com>
parents:
24651
diff
changeset
|
336 #if 0 |
24640 | 337 static void request_room_send_im_ex(PurpleConnection *gc, guint32 room_id, |
338 qq_im_format *fmt, gchar *msg, guint16 msg_id, guint8 frag_count, guint8 frag_index) | |
339 { | |
340 guint8 raw_data[MAX_PACKET_SIZE - 16]; | |
341 gint bytes; | |
342 | |
343 | |
344 g_return_if_fail(room_id != 0 && msg != NULL); | |
345 | |
346 bytes = 0; | |
347 bytes += qq_put16(raw_data + bytes, 0); /* packet len */ | |
348 /* type 0x0001, text only; 0x0002, with custom emoticon */ | |
349 bytes += qq_put16(raw_data + bytes, 0x0001); | |
350 bytes += qq_put8(raw_data + bytes, frag_count); | |
351 bytes += qq_put8(raw_data + bytes, frag_index); | |
352 bytes += qq_put16(raw_data + bytes, msg_id); | |
353 bytes += qq_put32(raw_data + bytes, 0); /* unknow 4 bytes */ | |
354 bytes += qq_putdata(raw_data + bytes, (guint8 *)msg, strlen(msg)); | |
355 if (frag_count == frag_index + 1) { | |
356 bytes += qq_put8(raw_data + bytes, 0x20); /* add extra SPACE */ | |
357 bytes += qq_put_im_tail(raw_data + bytes, fmt); | |
358 } | |
359 | |
360 /* reset first two bytes as length */ | |
361 qq_put16(raw_data, bytes - 2); | |
24651 | 362 |
24640 | 363 /*qq_show_packet("QQ_ROOM_CMD_SEND_IM_EX", raw_data, bytes); */ |
364 qq_send_room_cmd(gc, QQ_ROOM_CMD_SEND_IM_EX, room_id, raw_data, bytes); | |
365 } | |
24657
59aae7636111
#if 0 out an unused function to suppress a compiler warning.
Richard Laager <rlaager@wiktel.com>
parents:
24651
diff
changeset
|
366 #endif |
24640 | 367 |
24613
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
368 /* send a chat msg to a QQ Qun |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
369 * called by purple */ |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
370 int qq_chat_send(PurpleConnection *gc, int id, const char *what, PurpleMessageFlags flags) |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
371 { |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
372 qq_data *qd; |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
373 qq_im_format *fmt; |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
374 gchar *msg_stripped, *tmp; |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
375 GSList *segments, *it; |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
376 gint msg_len; |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
377 const gchar *start_invalid; |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
378 gboolean is_smiley_none; |
24640 | 379 guint8 frag_count, frag_index; |
24613
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
380 |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
381 g_return_val_if_fail(NULL != gc && NULL != gc->proto_data, -1); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
382 g_return_val_if_fail(id != 0 && what != NULL, -1); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
383 |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
384 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:
24657
diff
changeset
|
385 purple_debug_info("QQ", "Send chat IM to %u, len %" G_GSIZE_FORMAT ":\n%s\n", id, strlen(what), what); |
24613
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
386 |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
387 /* qq_show_packet("chat IM UTF8", (guint8 *)what, strlen(what)); */ |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
388 |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
389 fmt = qq_im_fmt_new_by_purple(what); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
390 is_smiley_none = qq_im_smiley_none(what); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
391 |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
392 msg_stripped = purple_markup_strip_html(what); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
393 g_return_val_if_fail(msg_stripped != NULL, -1); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
394 /* qq_show_packet("IM Stripped", (guint8 *)what, strlen(what)); */ |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
395 |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
396 /* Check and valid utf8 string */ |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
397 msg_len = strlen(msg_stripped); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
398 if (!g_utf8_validate(msg_stripped, msg_len, &start_invalid)) { |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
399 if (start_invalid > msg_stripped) { |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
400 tmp = g_strndup(msg_stripped, start_invalid - msg_stripped); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
401 g_free(msg_stripped); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
402 msg_stripped = g_strconcat(tmp, _("(Invalid UTF-8 string)"), NULL); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
403 g_free(tmp); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
404 } else { |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
405 g_free(msg_stripped); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
406 msg_stripped = g_strdup(_("(Invalid UTF-8 string)")); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
407 } |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
408 } |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
409 |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
410 is_smiley_none = qq_im_smiley_none(what); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
411 segments = qq_im_get_segments(msg_stripped, is_smiley_none); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
412 g_free(msg_stripped); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
413 |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
414 if (segments == NULL) { |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
415 return -1; |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
416 } |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
417 |
24640 | 418 qd->send_im_id++; |
24613
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
419 fmt = qq_im_fmt_new_by_purple(what); |
24640 | 420 frag_count = g_slist_length(segments); |
421 frag_index = 0; | |
24651 | 422 /* |
24640 | 423 if (frag_count <= 1) { |
424 */ | |
425 for (it = segments; it; it = it->next) { | |
426 request_room_send_im(gc, id, fmt, (gchar *)it->data); | |
427 g_free(it->data); | |
428 } | |
429 /* | |
430 } else { | |
431 for (it = segments; it; it = it->next) { | |
432 request_room_send_im_ex(gc, id, fmt, (gchar *)it->data, | |
433 qd->send_im_id, frag_count, frag_index); | |
434 g_free(it->data); | |
435 frag_index++; | |
436 } | |
24613
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
437 } |
24640 | 438 */ |
24613
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
439 qq_im_fmt_free(fmt); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
440 g_slist_free(segments); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
441 return 1; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
442 } |