Mercurial > pidgin
annotate libpurple/protocols/qq/group_im.c @ 24162:f4f29fac96c6
2008.10.20 - ccpaging <ccpaging(at)gmail.com>
* Support incoming authorization of 'buddy_adding' protocol of QQ2007/2008
author | SHiNE CsyFeK <csyfek@gmail.com> |
---|---|
date | Tue, 28 Oct 2008 16:45:10 +0000 |
parents | 7c0a56c5fea0 |
children | 4afc4a1c36d8 |
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) { |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
67 topic_utf8 = g_strdup_printf("%d %s", rmd->ext_id, rmd->notice_utf8); |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
68 purple_debug_info("QQ", "Set chat topic to %s\n", topic_utf8); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
69 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
|
70 g_free(topic_utf8); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
71 |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
72 if (rmd->is_got_buddies) |
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
73 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
|
74 else |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
75 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
|
76 return conv; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
77 } |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
78 return NULL; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
79 } |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
80 |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
81 /* 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
|
82 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
|
83 { |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
84 GList *names, *list, *flags; |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
85 qq_buddy_data *bd; |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
86 gchar *member_name, *member_uid; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
87 PurpleConversation *conv; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
88 gint flag; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
89 gboolean is_find; |
24154
237e5a94e11c
2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24149
diff
changeset
|
90 |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
91 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
|
92 |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
93 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
|
94 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
|
95 if (conv == NULL) { |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
96 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
|
97 return; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
98 } |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
99 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
|
100 |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
101 names = NULL; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
102 flags = NULL; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
103 |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
104 list = rmd->members; |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
105 while (list != NULL) { |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
106 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
|
107 |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
108 /* 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
|
109 * 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
|
110 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
|
111 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
|
112 g_strdup_printf("(%u)", bd->uid); |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
113 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
|
114 |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
115 flag = 0; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
116 /* 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
|
117 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
|
118 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
|
119 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
|
120 |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
121 is_find = TRUE; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
122 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
|
123 { |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
124 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
|
125 member_name, |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
126 flag); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
127 } 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
|
128 { |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
129 purple_conv_chat_user_set_flags(PURPLE_CONV_CHAT(conv), |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
130 member_uid, |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
131 flag); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
132 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
|
133 } else { |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
134 is_find = FALSE; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
135 } |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
136 if (!is_find) { |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
137 /* always put it even offline */ |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
138 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
|
139 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
|
140 } else { |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
141 g_free(member_name); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
142 } |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
143 g_free(member_uid); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
144 list = list->next; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
145 } |
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 if (names != NULL && flags != NULL) { |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
148 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
|
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 /* clean up names */ |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
152 while (names != NULL) { |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
153 member_name = (gchar *) names->data; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
154 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
|
155 g_free(member_name); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
156 } |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
157 g_list_free(flags); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
158 } |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
159 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
160 /* send IM to a group */ |
24159
9be95f0b9472
2008.10.10 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24158
diff
changeset
|
161 void qq_request_room_send_im(PurpleConnection *gc, guint32 room_id, const gchar *msg) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
162 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
163 gint data_len, bytes; |
23048 | 164 guint8 *raw_data, *send_im_tail; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
165 guint16 msg_len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
166 gchar *msg_filtered; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
167 |
24154
237e5a94e11c
2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24149
diff
changeset
|
168 g_return_if_fail(room_id != 0 && msg != NULL); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
169 |
15822 | 170 msg_filtered = purple_markup_strip_html(msg); |
24162
f4f29fac96c6
2008.10.20 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24161
diff
changeset
|
171 /* purple_debug_info("QQ", "Send qun mesg filterd: %s\n", msg_filtered); */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
172 msg_len = strlen(msg_filtered); |
23048 | 173 |
23695
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23638
diff
changeset
|
174 data_len = 2 + msg_len + QQ_SEND_IM_AFTER_MSG_LEN; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
175 raw_data = g_newa(guint8, data_len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
176 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
177 bytes = 0; |
23048 | 178 bytes += qq_put16(raw_data + bytes, msg_len + QQ_SEND_IM_AFTER_MSG_LEN); |
179 bytes += qq_putdata(raw_data + bytes, (guint8 *) msg_filtered, msg_len); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
180 send_im_tail = qq_get_send_im_tail(NULL, NULL, NULL, |
23048 | 181 FALSE, FALSE, FALSE, |
182 QQ_SEND_IM_AFTER_MSG_LEN); | |
183 bytes += qq_putdata(raw_data + bytes, send_im_tail, QQ_SEND_IM_AFTER_MSG_LEN); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
184 g_free(send_im_tail); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
185 g_free(msg_filtered); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
186 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
187 if (bytes == data_len) /* create OK */ |
24154
237e5a94e11c
2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24149
diff
changeset
|
188 qq_send_room_cmd(gc, QQ_ROOM_CMD_SEND_MSG, room_id, raw_data, data_len); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
189 else |
24115
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24114
diff
changeset
|
190 purple_debug_error("QQ", |
23048 | 191 "Fail creating group_im packet, expect %d bytes, build %d bytes\n", data_len, bytes); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
192 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
193 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
194 /* this is the ACK */ |
24159
9be95f0b9472
2008.10.10 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24158
diff
changeset
|
195 void qq_process_room_send_im(PurpleConnection *gc, guint8 *data, gint len) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
196 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
197 /* return should be the internal group id |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
198 * but we have nothing to do with it */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
199 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
200 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
201 |
24135
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
202 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
|
203 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
|
204 { |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
205 PurpleConversation *conv; |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
206 qq_buddy_data *bd; |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
207 qq_room_data *rmd; |
24135
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
208 gchar *from; |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
209 |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
210 g_return_if_fail(gc != NULL && room_id != 0); |
24135
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
211 |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
212 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
|
213 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
|
214 g_return_if_fail(rmd != NULL); |
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
215 |
24161
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24159
diff
changeset
|
216 if (conv == NULL && purple_prefs_get_bool("/plugins/prpl/qq/auto_popup_conversation")) { |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
217 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
|
218 } |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
219 |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
220 if (conv == NULL) { |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
221 return; |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
222 } |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
223 |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
224 if (uid_from != 0) { |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
225 |
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
226 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
|
227 if (bd == NULL || bd->nickname == NULL) |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
228 from = g_strdup_printf("%d", uid_from); |
24135
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
229 else |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
230 from = g_strdup(bd->nickname); |
24135
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
231 } else { |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
232 from = g_strdup(""); |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
233 } |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
234 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
|
235 g_free(from); |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
236 } |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
237 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
238 /* 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
|
239 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
|
240 { |
24135
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
241 gchar *msg_with_purple_smiley, *msg_utf8_encoded; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
242 qq_data *qd; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
243 gint skip_len; |
24135
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
244 gint bytes ; |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
245 struct { |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
246 guint32 ext_id; |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
247 guint8 type8; |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
248 guint32 member_uid; |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
249 guint16 unknown; |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
250 guint16 msg_seq; |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
251 time_t send_time; |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
252 guint32 unknown4; |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
253 guint16 msg_len; |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
254 gchar *msg; |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
255 guint8 *font_attr; |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
256 gint font_attr_len; |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
257 } packet; |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
258 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
259 g_return_if_fail(data != NULL && data_len > 0); |
23048 | 260 |
23051
55f986ccbb6a
patch-05-reconnect-and-code-cleanup
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23049
diff
changeset
|
261 /* FIXME: check length here */ |
23048 | 262 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
263 qd = (qq_data *) gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
264 |
24158
b6f09c1c79ce
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24157
diff
changeset
|
265 /* qq_show_packet("ROOM_IM", data, data_len); */ |
b6f09c1c79ce
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24157
diff
changeset
|
266 |
24135
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
267 memset(&packet, 0, sizeof(packet)); |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
268 bytes = 0; |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
269 bytes += qq_get32(&(packet.ext_id), data + bytes); |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
270 bytes += qq_get8(&(packet.type8), data + bytes); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
271 |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
272 if(QQ_MSG_TEMP_QUN_IM == msg_type) { |
23695
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23638
diff
changeset
|
273 bytes += qq_get32(&(id), data + bytes); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
274 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
275 |
24135
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
276 bytes += qq_get32(&(packet.member_uid), bytes + data); |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
277 bytes += qq_get16(&packet.unknown, data + bytes); /* 0x0001? */ |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
278 bytes += qq_get16(&(packet.msg_seq), data + bytes); |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
279 bytes += qq_getime(&packet.send_time, data + bytes); |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
280 bytes += qq_get32(&packet.unknown4, data + bytes); /* versionID */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
281 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
282 * length includes font_attr |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
283 * this msg_len includes msg and font_attr |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
284 **** the format is **** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
285 * length of all |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
286 * 1. unknown 10 bytes |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
287 * 2. 0-ended string |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
288 * 3. font_attr |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
289 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
290 |
24135
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
291 bytes += qq_get16(&(packet.msg_len), data + bytes); |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
292 g_return_if_fail(packet.msg_len > 0); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
293 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
294 * 10 bytes from lumaqq |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
295 * contentType = buf.getChar(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
296 * totalFragments = buf.get() & 255; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
297 * fragmentSequence = buf.get() & 255; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
298 * messageId = buf.getChar(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
299 * buf.getInt(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
300 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
301 |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
302 if(msg_type != QQ_MSG_UNKNOWN_QUN_IM) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
303 skip_len = 10; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
304 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
305 skip_len = 0; |
23048 | 306 bytes += skip_len; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
307 |
24158
b6f09c1c79ce
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24157
diff
changeset
|
308 /* qq_show_packet("Message", data + bytes, data_len - bytes); */ |
b6f09c1c79ce
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24157
diff
changeset
|
309 |
24135
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
310 packet.msg = g_strdup((gchar *) data + bytes); |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
311 bytes += strlen(packet.msg) + 1; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
312 /* there might not be any font_attr, check it */ |
24158
b6f09c1c79ce
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24157
diff
changeset
|
313 packet.font_attr_len = data_len - bytes; |
b6f09c1c79ce
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24157
diff
changeset
|
314 if (packet.font_attr_len > 0) { |
24135
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
315 packet.font_attr = g_memdup(data + bytes, packet.font_attr_len); |
24162
f4f29fac96c6
2008.10.20 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24161
diff
changeset
|
316 /* qq_show_packet("font_attr", packet.font_attr, packet.font_attr_len); */ |
24158
b6f09c1c79ce
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24157
diff
changeset
|
317 } else { |
24135
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
318 packet.font_attr = NULL; |
24158
b6f09c1c79ce
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24157
diff
changeset
|
319 } |
24159
9be95f0b9472
2008.10.10 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24158
diff
changeset
|
320 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
321 /* group im_group has no flag to indicate whether it has font_attr or not */ |
24135
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
322 msg_with_purple_smiley = qq_smiley_to_purple(packet.msg); |
24140
619ac2303c46
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24135
diff
changeset
|
323 if (packet.font_attr_len > 0) { |
24135
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
324 msg_utf8_encoded = qq_encode_to_purple(packet.font_attr, |
24140
619ac2303c46
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24135
diff
changeset
|
325 packet.font_attr_len, msg_with_purple_smiley, qd->client_version); |
619ac2303c46
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24135
diff
changeset
|
326 } else { |
15822 | 327 msg_utf8_encoded = qq_to_utf8(msg_with_purple_smiley, QQ_CHARSET_DEFAULT); |
24140
619ac2303c46
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24135
diff
changeset
|
328 } |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24155
diff
changeset
|
329 qq_room_got_chat_in(gc, id, packet.member_uid, msg_utf8_encoded, packet.send_time); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
330 |
15822 | 331 g_free(msg_with_purple_smiley); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
332 g_free(msg_utf8_encoded); |
24135
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
333 g_free(packet.msg); |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
334 g_free(packet.font_attr); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
335 } |