Mercurial > pidgin
annotate libpurple/protocols/qq/group_im.c @ 25584:53ea8bed8e18
Update the version in configure.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Wed, 29 Apr 2009 18:45:54 +0000 |
parents | effbf24b39b1 |
children | 32d2caa6a777 |
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); |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
55 qd = (qq_data *) gc->proto_data; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
56 |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
57 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
|
58 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
|
59 if (conv != NULL) { |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
60 /* 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
|
61 return conv; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
62 } |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
63 |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
64 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
|
65 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
|
66 if (conv != NULL) { |
24613
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
67 if (rmd->notice_utf8 != NULL) { |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
68 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
|
69 } else { |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
70 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
|
71 } |
24633 | 72 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
|
73 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
|
74 g_free(topic_utf8); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
75 |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
76 if (rmd->is_got_buddies) |
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
77 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
|
78 else |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
79 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
|
80 return conv; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
81 } |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
82 return NULL; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
83 } |
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 /* 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
|
86 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
|
87 { |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
88 GList *names, *list, *flags; |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
89 qq_buddy_data *bd; |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
90 gchar *member_name, *member_uid; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
91 PurpleConversation *conv; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
92 gint flag; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
93 gboolean is_find; |
24154
237e5a94e11c
2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24149
diff
changeset
|
94 |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
95 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
|
96 |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
97 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
|
98 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
|
99 if (conv == NULL) { |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
100 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
|
101 return; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
102 } |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
103 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
|
104 |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
105 names = NULL; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
106 flags = NULL; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
107 |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
108 list = rmd->members; |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
109 while (list != NULL) { |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
110 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
|
111 |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
112 /* 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
|
113 * 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
|
114 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
|
115 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
|
116 g_strdup_printf("(%u)", bd->uid); |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
117 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
|
118 |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
119 flag = 0; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
120 /* 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
|
121 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
|
122 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
|
123 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
|
124 |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
125 is_find = TRUE; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
126 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
|
127 { |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
128 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
|
129 member_name, |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
130 flag); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
131 } 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
|
132 { |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
133 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
|
134 member_uid, |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
135 flag); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
136 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
|
137 } else { |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
138 is_find = FALSE; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
139 } |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
140 if (!is_find) { |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
141 /* always put it even offline */ |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
142 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
|
143 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
|
144 } else { |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
145 g_free(member_name); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
146 } |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
147 g_free(member_uid); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
148 list = list->next; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
149 } |
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 if (names != NULL && flags != NULL) { |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
152 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
|
153 } |
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 /* clean up names */ |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
156 while (names != NULL) { |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
157 member_name = (gchar *) names->data; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
158 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
|
159 g_free(member_name); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
160 } |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
161 g_list_free(flags); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
162 } |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
163 |
24135
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
164 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
|
165 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
|
166 { |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
167 PurpleConversation *conv; |
25232
effbf24b39b1
2009.02.08 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24719
diff
changeset
|
168 qq_data *qd; |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
169 qq_buddy_data *bd; |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
170 qq_room_data *rmd; |
24135
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
171 gchar *from; |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
172 |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
173 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
|
174 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
|
175 |
25232
effbf24b39b1
2009.02.08 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24719
diff
changeset
|
176 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
|
177 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
|
178 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
|
179 g_return_if_fail(rmd != NULL); |
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
180 |
25232
effbf24b39b1
2009.02.08 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24719
diff
changeset
|
181 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
|
182 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
|
183 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
|
184 } |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
185 |
25232
effbf24b39b1
2009.02.08 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24719
diff
changeset
|
186 if (NULL == conv) { |
24613
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
187 purple_debug_info("QQ", "Conversion of %u is not open, missing from %d:/n%s/v", |
24603 | 188 room_id, uid_from, msg); |
24135
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
189 return; |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
190 } |
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 if (uid_from != 0) { |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
193 |
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
194 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
|
195 if (bd == NULL || bd->nickname == NULL) |
24613
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
196 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
|
197 else |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
198 from = g_strdup(bd->nickname); |
24135
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
199 } else { |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
200 from = g_strdup(""); |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
201 } |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
202 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
|
203 g_free(from); |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
204 } |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
205 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
206 /* 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
|
207 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
|
208 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
209 qq_data *qd; |
24613
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
210 gchar *msg_smiley, *msg_fmt, *msg_utf8; |
24640 | 211 gint bytes, tail_len; |
24135
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
212 struct { |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
213 guint32 ext_id; |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
214 guint8 type8; |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
215 guint32 member_uid; |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
216 guint16 unknown; |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
217 guint16 msg_seq; |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
218 time_t send_time; |
24640 | 219 guint32 version; |
24135
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
220 guint16 msg_len; |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
221 gchar *msg; |
24613
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
222 } im_text; |
24640 | 223 guint32 temp_id; |
224 guint16 content_type; | |
225 guint8 frag_count, frag_index; | |
226 guint16 msg_id; | |
227 qq_im_format *fmt = NULL; | |
24135
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
228 |
24640 | 229 /* at least include im_text.msg_len */ |
230 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
|
231 qd = (qq_data *) gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
232 |
24158
b6f09c1c79ce
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24157
diff
changeset
|
233 /* 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
|
234 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
|
235 bytes = 0; |
24613
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
236 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
|
237 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
|
238 |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
239 if(QQ_MSG_TEMP_QUN_IM == msg_type) { |
24640 | 240 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
|
241 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
242 |
24613
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
243 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
|
244 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
|
245 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
|
246 bytes += qq_getime(&im_text.send_time, data + bytes); |
24640 | 247 bytes += qq_get32(&im_text.version, data + bytes); |
248 bytes += qq_get16(&(im_text.msg_len), data + bytes); | |
249 purple_debug_info("QQ", "Room IM, ext id %u, seq %u, version 0x%04X, len %u\n", | |
250 im_text.ext_id, im_text.msg_seq, im_text.version, im_text.msg_len); | |
251 | |
252 if (im_text.msg_len != data_len - bytes) { | |
253 purple_debug_warning("QQ", "Room IM length %d should be %d\n", | |
254 im_text.msg_len, data_len - bytes); | |
255 im_text.msg_len = data_len - bytes; | |
256 } | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
257 |
24640 | 258 g_return_if_fail(im_text.msg_len > 0 && bytes + im_text.msg_len <= data_len); |
259 if(msg_type != QQ_MSG_QUN_IM_UNKNOWN) { | |
260 g_return_if_fail(im_text.msg_len >= 10); | |
261 | |
262 bytes += qq_get16(&content_type, data + bytes); | |
263 bytes += qq_get8(&frag_count, data + bytes); | |
264 bytes += qq_get8(&frag_index, data + bytes); | |
265 bytes += qq_get16(&msg_id, data + bytes); | |
266 bytes += 4; /* skip 0x(00 00 00 00) */ | |
267 purple_debug_info("QQ", "Room IM, content %d, frag %d-%d, msg id %u\n", | |
268 content_type, frag_count, frag_index, msg_id); | |
269 im_text.msg_len -= 10; | |
270 } | |
24613
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
271 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
|
272 |
24158
b6f09c1c79ce
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24157
diff
changeset
|
273 /* qq_show_packet("Message", data + bytes, data_len - bytes); */ |
24640 | 274 if (frag_count <= 1 || frag_count == frag_index + 1) { |
275 fmt = qq_im_fmt_new(); | |
276 tail_len = qq_get_im_tail(fmt, data + bytes, data_len - bytes); | |
277 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
|
278 } else { |
24640 | 279 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
|
280 } |
24159
9be95f0b9472
2008.10.10 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24158
diff
changeset
|
281 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
282 /* 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
|
283 msg_smiley = qq_emoticon_to_purple(im_text.msg); |
24640 | 284 if (fmt != NULL) { |
285 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
|
286 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
|
287 g_free(msg_fmt); |
24640 | 288 qq_im_fmt_free(fmt); |
24140
619ac2303c46
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24135
diff
changeset
|
289 } else { |
24613
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
290 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
|
291 } |
24613
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
292 g_free(msg_smiley); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
293 |
24640 | 294 purple_debug_info("QQ", "Room (%u) IM from %u: %s\n", |
295 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
|
296 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
|
297 |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
298 g_free(msg_utf8); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
299 g_free(im_text.msg); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
300 } |
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 /* send IM to a group */ |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
303 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
|
304 { |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
305 guint8 raw_data[MAX_PACKET_SIZE - 16]; |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
306 gint bytes; |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
307 |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
308 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
|
309 |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
310 bytes = 0; |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
311 bytes += qq_put16(raw_data + bytes, 0); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
312 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
|
313 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
|
314 /* reset first two bytes */ |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
315 qq_put16(raw_data, bytes - 2); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
316 |
24640 | 317 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
|
318 } |
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 /* this is the ACK */ |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
321 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
|
322 { |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
323 /* return should be the internal group id |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
324 * but we have nothing to do with it */ |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
325 return; |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
326 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
327 |
24640 | 328 void qq_process_room_send_im_ex(PurpleConnection *gc, guint8 *data, gint len) |
329 { | |
330 /* return should be the internal group id | |
331 * but we have nothing to do with it */ | |
332 return; | |
333 } | |
334 | |
24657
59aae7636111
#if 0 out an unused function to suppress a compiler warning.
Richard Laager <rlaager@wiktel.com>
parents:
24651
diff
changeset
|
335 #if 0 |
24640 | 336 static void request_room_send_im_ex(PurpleConnection *gc, guint32 room_id, |
337 qq_im_format *fmt, gchar *msg, guint16 msg_id, guint8 frag_count, guint8 frag_index) | |
338 { | |
339 guint8 raw_data[MAX_PACKET_SIZE - 16]; | |
340 gint bytes; | |
341 | |
342 | |
343 g_return_if_fail(room_id != 0 && msg != NULL); | |
344 | |
345 bytes = 0; | |
346 bytes += qq_put16(raw_data + bytes, 0); /* packet len */ | |
347 /* type 0x0001, text only; 0x0002, with custom emoticon */ | |
348 bytes += qq_put16(raw_data + bytes, 0x0001); | |
349 bytes += qq_put8(raw_data + bytes, frag_count); | |
350 bytes += qq_put8(raw_data + bytes, frag_index); | |
351 bytes += qq_put16(raw_data + bytes, msg_id); | |
352 bytes += qq_put32(raw_data + bytes, 0); /* unknow 4 bytes */ | |
353 bytes += qq_putdata(raw_data + bytes, (guint8 *)msg, strlen(msg)); | |
354 if (frag_count == frag_index + 1) { | |
355 bytes += qq_put8(raw_data + bytes, 0x20); /* add extra SPACE */ | |
356 bytes += qq_put_im_tail(raw_data + bytes, fmt); | |
357 } | |
358 | |
359 /* reset first two bytes as length */ | |
360 qq_put16(raw_data, bytes - 2); | |
24651 | 361 |
24640 | 362 /*qq_show_packet("QQ_ROOM_CMD_SEND_IM_EX", raw_data, bytes); */ |
363 qq_send_room_cmd(gc, QQ_ROOM_CMD_SEND_IM_EX, room_id, raw_data, bytes); | |
364 } | |
24657
59aae7636111
#if 0 out an unused function to suppress a compiler warning.
Richard Laager <rlaager@wiktel.com>
parents:
24651
diff
changeset
|
365 #endif |
24640 | 366 |
24613
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
367 /* send a chat msg to a QQ Qun |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
368 * called by purple */ |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
369 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
|
370 { |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
371 qq_data *qd; |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
372 qq_im_format *fmt; |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
373 gchar *msg_stripped, *tmp; |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
374 GSList *segments, *it; |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
375 gint msg_len; |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
376 const gchar *start_invalid; |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
377 gboolean is_smiley_none; |
24640 | 378 guint8 frag_count, frag_index; |
24613
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
379 |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
380 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
|
381 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
|
382 |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
383 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
|
384 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
|
385 |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
386 /* 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
|
387 |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
388 fmt = qq_im_fmt_new_by_purple(what); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
389 is_smiley_none = qq_im_smiley_none(what); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
390 |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
391 msg_stripped = purple_markup_strip_html(what); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
392 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
|
393 /* 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
|
394 |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
395 /* Check and valid utf8 string */ |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
396 msg_len = strlen(msg_stripped); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
397 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
|
398 if (start_invalid > msg_stripped) { |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
399 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
|
400 g_free(msg_stripped); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
401 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
|
402 g_free(tmp); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
403 } else { |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
404 g_free(msg_stripped); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
405 msg_stripped = g_strdup(_("(Invalid UTF-8 string)")); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
406 } |
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 is_smiley_none = qq_im_smiley_none(what); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
410 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
|
411 g_free(msg_stripped); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
412 |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
413 if (segments == NULL) { |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
414 return -1; |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
415 } |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
416 |
24640 | 417 qd->send_im_id++; |
24613
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
418 fmt = qq_im_fmt_new_by_purple(what); |
24640 | 419 frag_count = g_slist_length(segments); |
420 frag_index = 0; | |
24651 | 421 /* |
24640 | 422 if (frag_count <= 1) { |
423 */ | |
424 for (it = segments; it; it = it->next) { | |
425 request_room_send_im(gc, id, fmt, (gchar *)it->data); | |
426 g_free(it->data); | |
427 } | |
428 /* | |
429 } else { | |
430 for (it = segments; it; it = it->next) { | |
431 request_room_send_im_ex(gc, id, fmt, (gchar *)it->data, | |
432 qd->send_im_id, frag_count, frag_index); | |
433 g_free(it->data); | |
434 frag_index++; | |
435 } | |
24613
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
436 } |
24640 | 437 */ |
24613
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
438 qq_im_fmt_free(fmt); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
439 g_slist_free(segments); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24603
diff
changeset
|
440 return 1; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
441 } |