Mercurial > pidgin.yaz
annotate libpurple/protocols/qq/group_im.c @ 24605:59aae7636111
#if 0 out an unused function to suppress a compiler warning.
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Thu, 11 Dec 2008 04:32:01 +0000 |
parents | 2df1d0449ba6 |
children | 5ec72dbdd28e |
rev | line source |
---|---|
15374
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 * |
15823 | 4 * purple |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
5 * |
15823 | 6 * Purple is the legal property of its developers, whose names are too numerous |
15374
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 |
19680
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 |
15374
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 |
15374
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" |
24090
9be95f0b9472
2008.10.10 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24089
diff
changeset
|
37 #include "group_join.h" |
15374
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" |
24065
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
41 #include "qq_define.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
42 #include "packet_parse.h" |
23753
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23683
diff
changeset
|
43 #include "qq_network.h" |
24046
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24045
diff
changeset
|
44 #include "qq_process.h" |
15374
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 |
24079
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
47 /* show group conversation window */ |
24088
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
48 PurpleConversation *qq_room_conv_open(PurpleConnection *gc, qq_room_data *rmd) |
24079
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
49 { |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
50 PurpleConversation *conv; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
51 qq_data *qd; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
52 gchar *topic_utf8; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
53 |
24088
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
54 g_return_val_if_fail(rmd != NULL, NULL); |
24079
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
55 qd = (qq_data *) gc->proto_data; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
56 |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
57 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, |
24088
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
58 rmd->title_utf8, purple_connection_get_account(gc)); |
24079
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
59 if (conv != NULL) { |
24088
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
60 /* show only one conversation per room */ |
24079
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
61 return conv; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
62 } |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
63 |
24088
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
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:
24086
diff
changeset
|
65 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, rmd->title_utf8, purple_connection_get_account(gc)); |
24079
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
66 if (conv != NULL) { |
24561
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
67 if (rmd->notice_utf8 != NULL) { |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
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:
24551
diff
changeset
|
69 } else { |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
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:
24551
diff
changeset
|
71 } |
24581 | 72 purple_debug_info("QQ", "Chat topic = %s\n", topic_utf8); |
24079
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
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:
24077
diff
changeset
|
74 g_free(topic_utf8); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
75 |
24088
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
76 if (rmd->is_got_buddies) |
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
77 qq_send_room_cmd_only(gc, QQ_ROOM_CMD_GET_ONLINES, rmd->id); |
24079
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
78 else |
24088
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
79 qq_update_room(gc, 0, rmd->id); |
24079
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
80 return conv; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
81 } |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
82 return NULL; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
83 } |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
84 |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
85 /* refresh online member in group conversation window */ |
24088
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
86 void qq_room_conv_set_onlines(PurpleConnection *gc, qq_room_data *rmd) |
24079
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
87 { |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
88 GList *names, *list, *flags; |
24080
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24079
diff
changeset
|
89 qq_buddy_data *bd; |
24079
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
90 gchar *member_name, *member_uid; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
91 PurpleConversation *conv; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
92 gint flag; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
93 gboolean is_find; |
24085
237e5a94e11c
2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24080
diff
changeset
|
94 |
24088
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
95 g_return_if_fail(rmd != NULL); |
24079
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
96 |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
97 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, |
24088
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
98 rmd->title_utf8, purple_connection_get_account(gc)); |
24079
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
99 if (conv == NULL) { |
24088
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
100 purple_debug_warning("QQ", "Conversation \"%s\" is not opened\n", rmd->title_utf8); |
24079
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
101 return; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
102 } |
24088
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
103 g_return_if_fail(rmd->members != NULL); |
24079
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
104 |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
105 names = NULL; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
106 flags = NULL; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
107 |
24088
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
108 list = rmd->members; |
24079
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
109 while (list != NULL) { |
24080
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24079
diff
changeset
|
110 bd = (qq_buddy_data *) list->data; |
24079
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
111 |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
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:
24077
diff
changeset
|
113 * run into problems with functions like get_cb_real_name from qq.c */ |
24080
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24079
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:
24079
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:
24079
diff
changeset
|
116 g_strdup_printf("(%u)", bd->uid); |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24079
diff
changeset
|
117 member_uid = g_strdup_printf("(%u)", bd->uid); |
24079
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
118 |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
119 flag = 0; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
120 /* TYPING to put online above OP and FOUNDER */ |
24080
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24079
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:
24079
diff
changeset
|
122 if(1 == (bd->role & 1)) flag |= PURPLE_CBFLAGS_OP; |
24088
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
123 if(bd->uid == rmd->creator_uid) flag |= PURPLE_CBFLAGS_FOUNDER; |
24079
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
124 |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
125 is_find = TRUE; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
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:
24077
diff
changeset
|
127 { |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
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:
24077
diff
changeset
|
129 member_name, |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
130 flag); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
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:
24077
diff
changeset
|
132 { |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
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:
24077
diff
changeset
|
134 member_uid, |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
135 flag); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
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:
24077
diff
changeset
|
137 } else { |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
138 is_find = FALSE; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
139 } |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
140 if (!is_find) { |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
141 /* always put it even offline */ |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
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:
24077
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:
24077
diff
changeset
|
144 } else { |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
145 g_free(member_name); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
146 } |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
147 g_free(member_uid); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
148 list = list->next; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
149 } |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
150 |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
151 if (names != NULL && flags != NULL) { |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
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:
24077
diff
changeset
|
153 } |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
154 |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
155 /* clean up names */ |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
156 while (names != NULL) { |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
157 member_name = (gchar *) names->data; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
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:
24077
diff
changeset
|
159 g_free(member_name); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
160 } |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
161 g_list_free(flags); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
162 } |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
163 |
24066
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
164 void qq_room_got_chat_in(PurpleConnection *gc, |
24088
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
165 guint32 room_id, guint32 uid_from, const gchar *msg, time_t in_time) |
24066
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
166 { |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
167 PurpleConversation *conv; |
24080
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24079
diff
changeset
|
168 qq_buddy_data *bd; |
24088
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
169 qq_room_data *rmd; |
24066
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
170 gchar *from; |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
171 |
24088
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
172 g_return_if_fail(gc != NULL && room_id != 0); |
24561
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
173 g_return_if_fail(msg != NULL); |
24066
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
174 |
24088
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
175 conv = purple_find_chat(gc, room_id); |
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
176 rmd = qq_room_data_find(gc, room_id); |
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
177 g_return_if_fail(rmd != NULL); |
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
178 |
24092
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24090
diff
changeset
|
179 if (conv == NULL && purple_prefs_get_bool("/plugins/prpl/qq/auto_popup_conversation")) { |
24088
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
180 conv = qq_room_conv_open(gc, rmd); |
24066
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
181 } |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
182 |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
183 if (conv == NULL) { |
24561
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
184 purple_debug_info("QQ", "Conversion of %u is not open, missing from %d:/n%s/v", |
24551 | 185 room_id, uid_from, msg); |
24066
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
186 return; |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
187 } |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
188 |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
189 if (uid_from != 0) { |
24088
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
190 |
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
191 bd = qq_room_buddy_find(rmd, uid_from); |
24080
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24079
diff
changeset
|
192 if (bd == NULL || bd->nickname == NULL) |
24561
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
193 from = g_strdup_printf("%u", uid_from); |
24066
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
194 else |
24080
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24079
diff
changeset
|
195 from = g_strdup(bd->nickname); |
24066
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
196 } else { |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
197 from = g_strdup(""); |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
198 } |
24088
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
199 serv_got_chat_in(gc, room_id, from, 0, msg, in_time); |
24066
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
200 g_free(from); |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
201 } |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
202 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
203 /* recv an IM from a group chat */ |
24090
9be95f0b9472
2008.10.10 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24089
diff
changeset
|
204 void qq_process_room_im(guint8 *data, gint data_len, guint32 id, PurpleConnection *gc, guint16 msg_type) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
205 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
206 qq_data *qd; |
24561
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
207 gchar *msg_smiley, *msg_fmt, *msg_utf8; |
24588 | 208 gint bytes, tail_len; |
24066
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
209 struct { |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
210 guint32 ext_id; |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
211 guint8 type8; |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
212 guint32 member_uid; |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
213 guint16 unknown; |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
214 guint16 msg_seq; |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
215 time_t send_time; |
24588 | 216 guint32 version; |
24066
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
217 guint16 msg_len; |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
218 gchar *msg; |
24561
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
219 } im_text; |
24588 | 220 guint32 temp_id; |
221 guint16 content_type; | |
222 guint8 frag_count, frag_index; | |
223 guint16 msg_id; | |
224 qq_im_format *fmt = NULL; | |
24066
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
225 |
24588 | 226 /* at least include im_text.msg_len */ |
227 g_return_if_fail(data != NULL && data_len > 23); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
228 qd = (qq_data *) gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
229 |
24089
b6f09c1c79ce
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24088
diff
changeset
|
230 /* qq_show_packet("ROOM_IM", data, data_len); */ |
24561
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
231 memset(&im_text, 0, sizeof(im_text)); |
24066
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
232 bytes = 0; |
24561
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
233 bytes += qq_get32(&(im_text.ext_id), data + bytes); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
234 bytes += qq_get8(&(im_text.type8), data + bytes); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
235 |
24077
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
236 if(QQ_MSG_TEMP_QUN_IM == msg_type) { |
24588 | 237 bytes += qq_get32(&temp_id, data + bytes); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
238 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
239 |
24561
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
240 bytes += qq_get32(&(im_text.member_uid), bytes + data); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
241 bytes += qq_get16(&im_text.unknown, data + bytes); /* 0x0001? */ |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
242 bytes += qq_get16(&(im_text.msg_seq), data + bytes); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
243 bytes += qq_getime(&im_text.send_time, data + bytes); |
24588 | 244 bytes += qq_get32(&im_text.version, data + bytes); |
245 bytes += qq_get16(&(im_text.msg_len), data + bytes); | |
246 purple_debug_info("QQ", "Room IM, ext id %u, seq %u, version 0x%04X, len %u\n", | |
247 im_text.ext_id, im_text.msg_seq, im_text.version, im_text.msg_len); | |
248 | |
249 if (im_text.msg_len != data_len - bytes) { | |
250 purple_debug_warning("QQ", "Room IM length %d should be %d\n", | |
251 im_text.msg_len, data_len - bytes); | |
252 im_text.msg_len = data_len - bytes; | |
253 } | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
254 |
24588 | 255 g_return_if_fail(im_text.msg_len > 0 && bytes + im_text.msg_len <= data_len); |
256 if(msg_type != QQ_MSG_QUN_IM_UNKNOWN) { | |
257 g_return_if_fail(im_text.msg_len >= 10); | |
258 | |
259 bytes += qq_get16(&content_type, data + bytes); | |
260 bytes += qq_get8(&frag_count, data + bytes); | |
261 bytes += qq_get8(&frag_index, data + bytes); | |
262 bytes += qq_get16(&msg_id, data + bytes); | |
263 bytes += 4; /* skip 0x(00 00 00 00) */ | |
264 purple_debug_info("QQ", "Room IM, content %d, frag %d-%d, msg id %u\n", | |
265 content_type, frag_count, frag_index, msg_id); | |
266 im_text.msg_len -= 10; | |
267 } | |
24561
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
268 g_return_if_fail(im_text.msg_len > 0); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
269 |
24089
b6f09c1c79ce
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24088
diff
changeset
|
270 /* qq_show_packet("Message", data + bytes, data_len - bytes); */ |
24588 | 271 if (frag_count <= 1 || frag_count == frag_index + 1) { |
272 fmt = qq_im_fmt_new(); | |
273 tail_len = qq_get_im_tail(fmt, data + bytes, data_len - bytes); | |
274 im_text.msg = g_strndup((gchar *)(data + bytes), data_len - tail_len); | |
24089
b6f09c1c79ce
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24088
diff
changeset
|
275 } else { |
24588 | 276 im_text.msg = g_strndup((gchar *)(data + bytes), data_len - bytes); |
24089
b6f09c1c79ce
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24088
diff
changeset
|
277 } |
24090
9be95f0b9472
2008.10.10 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24089
diff
changeset
|
278 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
279 /* group im_group has no flag to indicate whether it has font_attr or not */ |
24561
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
280 msg_smiley = qq_emoticon_to_purple(im_text.msg); |
24588 | 281 if (fmt != NULL) { |
282 msg_fmt = qq_im_fmt_to_purple(fmt, msg_smiley); | |
24561
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
283 msg_utf8 = qq_to_utf8(msg_fmt, QQ_CHARSET_DEFAULT); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
284 g_free(msg_fmt); |
24588 | 285 qq_im_fmt_free(fmt); |
24071
619ac2303c46
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24066
diff
changeset
|
286 } else { |
24561
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
287 msg_utf8 = qq_to_utf8(msg_smiley, QQ_CHARSET_DEFAULT); |
24071
619ac2303c46
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24066
diff
changeset
|
288 } |
24561
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
289 g_free(msg_smiley); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
290 |
24588 | 291 purple_debug_info("QQ", "Room (%u) IM from %u: %s\n", |
292 im_text.ext_id, im_text.member_uid, msg_utf8); | |
24561
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
293 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:
24551
diff
changeset
|
294 |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
295 g_free(msg_utf8); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
296 g_free(im_text.msg); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
297 } |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
298 |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
299 /* send IM to a group */ |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
300 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:
24551
diff
changeset
|
301 { |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
302 guint8 raw_data[MAX_PACKET_SIZE - 16]; |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
303 gint bytes; |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
304 |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
305 g_return_if_fail(room_id != 0 && msg != NULL); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
306 |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
307 bytes = 0; |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
308 bytes += qq_put16(raw_data + bytes, 0); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
309 bytes += qq_putdata(raw_data + bytes, (guint8 *)msg, strlen(msg)); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
310 bytes += qq_put_im_tail(raw_data + bytes, fmt); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
311 /* reset first two bytes */ |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
312 qq_put16(raw_data, bytes - 2); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
313 |
24588 | 314 qq_send_room_cmd(gc, QQ_ROOM_CMD_SEND_IM, room_id, raw_data, bytes); |
24561
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
315 } |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
316 |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
317 /* this is the ACK */ |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
318 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:
24551
diff
changeset
|
319 { |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
320 /* return should be the internal group id |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
321 * but we have nothing to do with it */ |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
322 return; |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
323 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
324 |
24588 | 325 void qq_process_room_send_im_ex(PurpleConnection *gc, guint8 *data, gint len) |
326 { | |
327 /* return should be the internal group id | |
328 * but we have nothing to do with it */ | |
329 return; | |
330 } | |
331 | |
24605
59aae7636111
#if 0 out an unused function to suppress a compiler warning.
Richard Laager <rlaager@wiktel.com>
parents:
24599
diff
changeset
|
332 #if 0 |
24588 | 333 static void request_room_send_im_ex(PurpleConnection *gc, guint32 room_id, |
334 qq_im_format *fmt, gchar *msg, guint16 msg_id, guint8 frag_count, guint8 frag_index) | |
335 { | |
336 guint8 raw_data[MAX_PACKET_SIZE - 16]; | |
337 gint bytes; | |
338 | |
339 | |
340 g_return_if_fail(room_id != 0 && msg != NULL); | |
341 | |
342 bytes = 0; | |
343 bytes += qq_put16(raw_data + bytes, 0); /* packet len */ | |
344 /* type 0x0001, text only; 0x0002, with custom emoticon */ | |
345 bytes += qq_put16(raw_data + bytes, 0x0001); | |
346 bytes += qq_put8(raw_data + bytes, frag_count); | |
347 bytes += qq_put8(raw_data + bytes, frag_index); | |
348 bytes += qq_put16(raw_data + bytes, msg_id); | |
349 bytes += qq_put32(raw_data + bytes, 0); /* unknow 4 bytes */ | |
350 bytes += qq_putdata(raw_data + bytes, (guint8 *)msg, strlen(msg)); | |
351 if (frag_count == frag_index + 1) { | |
352 bytes += qq_put8(raw_data + bytes, 0x20); /* add extra SPACE */ | |
353 bytes += qq_put_im_tail(raw_data + bytes, fmt); | |
354 } | |
355 | |
356 /* reset first two bytes as length */ | |
357 qq_put16(raw_data, bytes - 2); | |
24599 | 358 |
24588 | 359 /*qq_show_packet("QQ_ROOM_CMD_SEND_IM_EX", raw_data, bytes); */ |
360 qq_send_room_cmd(gc, QQ_ROOM_CMD_SEND_IM_EX, room_id, raw_data, bytes); | |
361 } | |
24605
59aae7636111
#if 0 out an unused function to suppress a compiler warning.
Richard Laager <rlaager@wiktel.com>
parents:
24599
diff
changeset
|
362 #endif |
24588 | 363 |
24561
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
364 /* send a chat msg to a QQ Qun |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
365 * called by purple */ |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
366 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:
24551
diff
changeset
|
367 { |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
368 qq_data *qd; |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
369 qq_im_format *fmt; |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
370 gchar *msg_stripped, *tmp; |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
371 GSList *segments, *it; |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
372 gint msg_len; |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
373 const gchar *start_invalid; |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
374 gboolean is_smiley_none; |
24588 | 375 guint8 frag_count, frag_index; |
24561
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
376 |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
377 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:
24551
diff
changeset
|
378 g_return_val_if_fail(id != 0 && what != NULL, -1); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
379 |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
380 qd = (qq_data *) gc->proto_data; |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
381 purple_debug_info("QQ", "Send chat IM to %u, len %d:\n%s\n", id, strlen(what), what); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
382 |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
383 /* qq_show_packet("chat IM UTF8", (guint8 *)what, strlen(what)); */ |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
384 |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
385 fmt = qq_im_fmt_new_by_purple(what); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
386 is_smiley_none = qq_im_smiley_none(what); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
387 |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
388 msg_stripped = purple_markup_strip_html(what); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
389 g_return_val_if_fail(msg_stripped != NULL, -1); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
390 /* qq_show_packet("IM Stripped", (guint8 *)what, strlen(what)); */ |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
391 |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
392 /* Check and valid utf8 string */ |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
393 msg_len = strlen(msg_stripped); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
394 if (!g_utf8_validate(msg_stripped, msg_len, &start_invalid)) { |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
395 if (start_invalid > msg_stripped) { |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
396 tmp = g_strndup(msg_stripped, start_invalid - msg_stripped); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
397 g_free(msg_stripped); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
398 msg_stripped = g_strconcat(tmp, _("(Invalid UTF-8 string)"), NULL); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
399 g_free(tmp); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
400 } else { |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
401 g_free(msg_stripped); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
402 msg_stripped = g_strdup(_("(Invalid UTF-8 string)")); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
403 } |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
404 } |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
405 |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
406 is_smiley_none = qq_im_smiley_none(what); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
407 segments = qq_im_get_segments(msg_stripped, is_smiley_none); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
408 g_free(msg_stripped); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
409 |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
410 if (segments == NULL) { |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
411 return -1; |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
412 } |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
413 |
24588 | 414 qd->send_im_id++; |
24561
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
415 fmt = qq_im_fmt_new_by_purple(what); |
24588 | 416 frag_count = g_slist_length(segments); |
417 frag_index = 0; | |
24599 | 418 /* |
24588 | 419 if (frag_count <= 1) { |
420 */ | |
421 for (it = segments; it; it = it->next) { | |
422 request_room_send_im(gc, id, fmt, (gchar *)it->data); | |
423 g_free(it->data); | |
424 } | |
425 /* | |
426 } else { | |
427 for (it = segments; it; it = it->next) { | |
428 request_room_send_im_ex(gc, id, fmt, (gchar *)it->data, | |
429 qd->send_im_id, frag_count, frag_index); | |
430 g_free(it->data); | |
431 frag_index++; | |
432 } | |
24561
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
433 } |
24588 | 434 */ |
24561
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
435 qq_im_fmt_free(fmt); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
436 g_slist_free(segments); |
6607ebd41053
Change Qun number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24551
diff
changeset
|
437 return 1; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
438 } |