annotate libpurple/protocols/qq/buddy_memo.c @ 28768:3f2a74bf3b9b

Restore ChangeLog entry from 466c48e63... that was lost in 1bcd0bb175....
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Fri, 16 Oct 2009 20:45:02 +0000
parents c6e2af2208ad
children dba5d0f7bb39
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
25153
b16a35e21a3d 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25150
diff changeset
1 /**
b16a35e21a3d 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25150
diff changeset
2 * @file buddy_memo.c
b16a35e21a3d 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25150
diff changeset
3 *
b16a35e21a3d 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25150
diff changeset
4 * purple
b16a35e21a3d 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25150
diff changeset
5 *
b16a35e21a3d 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25150
diff changeset
6 * Purple is the legal property of its developers, whose names are too numerous
b16a35e21a3d 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25150
diff changeset
7 * to list here. Please refer to the COPYRIGHT file distributed with this
b16a35e21a3d 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25150
diff changeset
8 * source distribution.
b16a35e21a3d 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25150
diff changeset
9 *
b16a35e21a3d 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25150
diff changeset
10 * This program is free software; you can redistribute it and/or modify
b16a35e21a3d 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25150
diff changeset
11 * it under the terms of the GNU General Public License as published by
b16a35e21a3d 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25150
diff changeset
12 * the Free Software Foundation; either version 2 of the License, or
b16a35e21a3d 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25150
diff changeset
13 * (at your option) any later version.
b16a35e21a3d 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25150
diff changeset
14 *
b16a35e21a3d 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25150
diff changeset
15 * This program is distributed in the hope that it will be useful,
b16a35e21a3d 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25150
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b16a35e21a3d 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25150
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b16a35e21a3d 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25150
diff changeset
18 * GNU General Public License for more details.
b16a35e21a3d 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25150
diff changeset
19 *
b16a35e21a3d 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25150
diff changeset
20 * You should have received a copy of the GNU General Public License
b16a35e21a3d 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25150
diff changeset
21 * along with this program; if not, write to the Free Software
b16a35e21a3d 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25150
diff changeset
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
b16a35e21a3d 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25150
diff changeset
23 */
b16a35e21a3d 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25150
diff changeset
24
25146
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
25 #include "internal.h"
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
26 #include "debug.h"
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
27 #include "notify.h"
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
28 #include "request.h"
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
29
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
30 #include "buddy_memo.h"
25146
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
31 #include "utils.h"
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
32 #include "packet_parse.h"
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
33 #include "buddy_list.h"
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
34 #include "buddy_info.h"
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
35 #include "char_conv.h"
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
36 #include "im.h"
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
37 #include "qq_define.h"
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
38 #include "qq_base.h"
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
39 #include "qq_network.h"
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
40 #include "qq.h"
25146
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
41
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
42
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
43 #include <string.h>
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
44 #include <stdlib.h>
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
45 #include <stdio.h>
25146
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
46
25147
8bc9f89f305e 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25146
diff changeset
47 #include <stdlib.h>
8bc9f89f305e 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25146
diff changeset
48 #include <stdio.h>
25146
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
49
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
50 /* memo index */
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
51 enum {
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
52 QQ_MEMO_ALIAS = 0,
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
53 QQ_MEMO_MOBILD,
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
54 QQ_MEMO_TELEPHONE,
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
55 QQ_MEMO_ADDRESS,
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
56 QQ_MEMO_EMAIL,
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
57 QQ_MEMO_ZIPCODE,
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
58 QQ_MEMO_NOTE,
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
59 QQ_MEMO_SIZE
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
60 };
25146
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
61
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
62 /* memo id */
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
63 static const gchar *memo_id[] = {
25150
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
64 "mm_alias",
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
65 "mm_mobile",
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
66 "mm_telephone",
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
67 "mm_address",
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
68 "mm_email",
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
69 "mm_zipcode",
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
70 "mm_note"
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
71 };
25146
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
72
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
73 /* memo text */
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
74 static const gchar *memo_txt[] = {
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
75 N_("Alias"),
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
76 N_("Mobile"),
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
77 N_("Telephone"),
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
78 N_("Address"),
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
79 N_("Email"),
25154
c6e2af2208ad 2009.02.25 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25153
diff changeset
80 N_("Postal Code"),
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
81 N_("Note")
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
82 };
25146
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
83
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
84 typedef struct _modify_memo_request {
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
85 PurpleConnection *gc;
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
86 guint32 bd_uid;
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
87 gchar **segments;
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
88 } modify_memo_request;
25146
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
89
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
90
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
91 static void memo_debug(gchar **segments)
25146
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
92 {
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
93 gint index;
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
94 g_return_if_fail(NULL != segments);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
95 for (index = 0; index < QQ_MEMO_SIZE; index++) {
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
96 purple_debug_info("QQ","memo[%i]=%s\n", index, segments[index]);
25146
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
97 }
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
98 }
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
99
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
100 static void memo_free(gchar **segments)
25146
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
101 {
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
102 gint index;
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
103 g_return_if_fail(NULL != segments);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
104 for (index = 0; index < QQ_MEMO_SIZE; index++) {
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
105 g_free(segments[index]);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
106 }
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
107 purple_debug_info("QQ", "memo freed\n");
25146
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
108 }
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
109
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
110 static void update_buddy_memo(PurpleConnection *gc, guint32 bd_uid, gchar *alias)
25146
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
111 {
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
112 PurpleAccount *account;
25146
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
113 PurpleBuddy *buddy;
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
114 gchar *who;
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
115 g_return_if_fail(NULL != gc && NULL != alias);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
116
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
117 account = (PurpleAccount *)gc->account;
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
118 g_return_if_fail(NULL != account);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
119
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
120 who = uid_to_purple_name(bd_uid);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
121 buddy = purple_find_buddy(account, who);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
122 if (buddy == NULL || buddy->proto_data == NULL) {
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
123 g_free(who);
25150
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
124 purple_debug_info("QQ", "Error...Can NOT find %d!\n", bd_uid);
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
125 return;
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
126 }
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
127 purple_blist_alias_buddy(buddy, (const char*)alias);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
128 }
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
129
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
130 static void request_change_memo(PurpleConnection *gc, guint32 bd_uid, gchar **segments)
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
131 {
25147
8bc9f89f305e 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25146
diff changeset
132 gint bytes;
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
133 /* Attention, length of each segment must be guint8(0~255),
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
134 * so length of memo string is limited.
25150
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
135 * convert it to guint8 first before putting data */
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
136 guint seg_len;
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
137 gint index;
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
138 guint8 raw_data[MAX_PACKET_SIZE - 16] = {0};
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
139
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
140 purple_debug_info( "QQ", "request_change_memo\n" );
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
141 g_return_if_fail(NULL != gc && NULL != segments);
25146
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
142
25147
8bc9f89f305e 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25146
diff changeset
143 bytes = 0;
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
144 bytes += qq_put8(raw_data+bytes, QQ_BUDDY_MEMO_MODIFY);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
145 bytes += qq_put8(raw_data+bytes, 0x00);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
146 bytes += qq_put32(raw_data+bytes, (guint32)bd_uid);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
147 bytes += qq_put8(raw_data+bytes, 0x00);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
148 for (index = 0; index < QQ_MEMO_SIZE; index++) {
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
149 seg_len = strlen(segments[index]);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
150 seg_len = seg_len & 0xff;
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
151 bytes += qq_put8(raw_data+bytes, (guint8)seg_len);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
152 bytes += qq_putdata(raw_data+bytes, (const guint8 *)segments[index], (guint8)seg_len);
25146
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
153 }
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
154
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
155 /* debug */
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
156 /*
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
157 qq_show_packet("MEMO MODIFY", raw_data, bytes);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
158 */
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
159
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
160 qq_send_cmd(gc, QQ_CMD_BUDDY_MEMO, raw_data, bytes);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
161 }
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
162
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
163 static void memo_modify_cancle_cb(modify_memo_request *memo_request, PurpleRequestFields *fields)
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
164 {
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
165 memo_free(memo_request->segments);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
166 g_free(memo_request);
25146
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
167 }
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
168
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
169 /* prepare segments to be sent, string all convert to qq charset */
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
170 static void memo_modify_ok_cb(modify_memo_request *memo_request, PurpleRequestFields *fields)
25146
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
171 {
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
172 PurpleConnection *gc;
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
173 guint32 bd_uid;
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
174 gchar **segments;
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
175 const gchar *utf8_str;
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
176 gchar *value = NULL;
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
177 gint index;
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
178
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
179 g_return_if_fail(NULL != memo_request);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
180 gc = (PurpleConnection *)memo_request->gc;
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
181 segments = (gchar **)memo_request->segments;
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
182 g_return_if_fail(NULL != gc && NULL != segments);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
183 bd_uid = (guint32)memo_request->bd_uid;
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
184
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
185
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
186 for (index = 0; index < QQ_MEMO_SIZE; index++) {
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
187 utf8_str = purple_request_fields_get_string(fields, memo_id[index]);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
188 /* update alias */
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
189 if (QQ_MEMO_ALIAS == index) {
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
190 update_buddy_memo(gc, bd_uid, segments[QQ_MEMO_ALIAS]);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
191 }
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
192 if (NULL == utf8_str) {
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
193 value = g_strdup("");
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
194 }
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
195 else {
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
196 value = utf8_to_qq(utf8_str, QQ_CHARSET_DEFAULT);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
197 /* Warnning: value will be string "(NULL)" instead of NULL */
25149
7da3cf2530b7 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25148
diff changeset
198 if (!qq_strcmp("(NULL)", value)) {
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
199 value = g_strdup("");
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
200 }
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
201 }
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
202 g_free(segments[index]);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
203 segments[index] = value;
25146
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
204 }
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
205
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
206 memo_debug(segments);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
207 /* send segments */
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
208 request_change_memo(gc, bd_uid, segments);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
209
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
210 /* free segments */
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
211 memo_free(segments);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
212 g_free(memo_request);
25146
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
213 }
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
214
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
215 /* memo modify dialogue */
25150
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
216 static void memo_modify_dialogue(PurpleConnection *gc, guint32 bd_uid, gchar **segments, guint32 action)
25146
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
217 {
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
218 modify_memo_request *memo_request;
25146
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
219 PurpleRequestField *field;
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
220 PurpleRequestFields *fields;
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
221 PurpleRequestFieldGroup *group;
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
222 int index;
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
223 gchar *utf8_title;
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
224 gchar *utf8_primary;
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
225
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
226 g_return_if_fail(NULL != gc && NULL != segments);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
227
25150
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
228 switch (action) {
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
229 case QQ_BUDDY_MEMO_GET:
25150
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
230 memo_free(segments);
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
231 break;
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
232 case QQ_BUDDY_MEMO_MODIFY:
25150
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
233 /* keep one dialog once a time */
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
234 purple_request_close_with_handle(gc);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
235 /* show dialog */
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
236 fields = purple_request_fields_new();
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
237 group = purple_request_field_group_new(NULL);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
238 purple_request_fields_add_group(fields, group);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
239
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
240 for(index = 0; index < QQ_MEMO_SIZE; index++) {
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
241 /*
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
242 purple_debug_info("QQ", "id:%s txt:%s segment:%s\n",
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
243 memo_id[index], memo_txt[index], segments[index]);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
244 */
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
245 field = purple_request_field_string_new(memo_id[index], memo_txt[index],
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
246 segments[index], FALSE);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
247 purple_request_field_group_add_field(group, field);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
248 }
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
249
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
250 /* for upload cb */
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
251 memo_request = g_new0(modify_memo_request, 1);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
252 memo_request->gc = gc;
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
253 memo_request->bd_uid = bd_uid;
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
254 memo_request->segments = segments;
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
255 /* callback */
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
256 utf8_title = g_strdup(_("Buddy Memo"));
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
257 utf8_primary = g_strdup(_("Change his/her memo as you like"));
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
258
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
259 purple_request_fields(gc, utf8_title, utf8_primary, NULL,
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
260 fields,
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
261 _("_Modify"), G_CALLBACK(memo_modify_ok_cb),
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
262 _("_Cancel"), G_CALLBACK(memo_modify_cancle_cb),
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
263 purple_connection_get_account(gc), NULL, NULL,
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
264 memo_request);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
265
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
266 g_free(utf8_title);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
267 g_free(utf8_primary);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
268 break;
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
269 default:
25150
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
270 purple_debug_info("QQ", "Error...unknown memo action, please tell us\n");
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
271 break;
25146
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
272 }
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
273 }
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
274
25150
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
275 static void qq_create_buddy_memo(PurpleConnection *gc, guint32 bd_uid, guint32 action)
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
276 {
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
277 gchar **segments;
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
278 gint index;
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
279 g_return_if_fail(NULL != gc);
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
280
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
281 segments = g_new0(gchar*, QQ_MEMO_SIZE);
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
282 for (index = 0; index < QQ_MEMO_SIZE; index++) {
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
283 segments[index] = g_strdup("");;
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
284 }
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
285 memo_modify_dialogue(gc, bd_uid, segments, action);
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
286 }
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
287
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
288 /* process reply to get_memo packet */
25150
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
289 void qq_process_get_buddy_memo(PurpleConnection *gc, guint8* data, gint data_len,
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
290 guint32 update_class, guint32 action)
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
291 {
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
292 gchar **segments;
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
293 gint bytes;
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
294 gint index;
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
295 guint8 rcv_cmd;
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
296 guint32 rcv_uid;
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
297 guint8 unk1_8;
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
298 guint8 is_success;
25146
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
299
25150
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
300 g_return_if_fail(NULL != gc && NULL != data && 0 != data_len);
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
301 /*
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
302 qq_show_packet("MEMO REACH", data, data_len);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
303 */
25150
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
304 purple_debug_info("QQ", "action=0x%02X\n", action);
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
305
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
306 bytes = 0;
25146
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
307
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
308 /* TX looks a bit clever than before... :) */
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
309 bytes += qq_get8(&rcv_cmd, data+bytes);
25150
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
310 purple_debug_info("QQ", "rcv_cmd=0x%02X\n", rcv_cmd);
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
311
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
312 /* it's possible that packet contains no buddy uid and no memo!!!
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
313 * go to next step according to previous action sent */
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
314 if (1 == data_len) { /* only one byte */
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
315 purple_debug_info("QQ", "memo packet contains no buddy uid and memo...\n");
25150
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
316 if (QQ_BUDDY_MEMO_MODIFY == action) {
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
317 qq_create_buddy_memo(gc, (guint32)update_class, QQ_BUDDY_MEMO_MODIFY);
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
318 return;
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
319 }
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
320 return;
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
321 }
25146
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
322
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
323 switch (rcv_cmd) {
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
324 case QQ_BUDDY_MEMO_MODIFY:
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
325 case QQ_BUDDY_MEMO_REMOVE:
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
326 bytes += qq_get8(&is_success, data+bytes);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
327 if (QQ_BUDDY_MEMO_REQUEST_SUCCESS == is_success) {
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
328 purple_notify_message(gc, PURPLE_NOTIFY_MSG_INFO,
25150
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
329 _("Memo Modify"), _("Server says:"),
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
330 _("Your request was accepted."),
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
331 NULL, NULL);
25150
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
332 purple_debug_info("QQ", "memo change succeessfully!\n");
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
333 }
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
334 else {
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
335 purple_notify_message(gc, PURPLE_NOTIFY_MSG_INFO,
25150
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
336 _("Memo Modify"), _("Server says:"),
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
337 _("Your request was rejected."),
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
338 NULL, NULL);
25150
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
339 purple_debug_info("QQ", "memo change failed\n");
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
340 }
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
341 break;
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
342 case QQ_BUDDY_MEMO_GET:
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
343 bytes += qq_get32(&rcv_uid, data+bytes);
25150
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
344 purple_debug_info("QQ", "rcv_uid=%u\n", rcv_uid);
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
345 bytes += qq_get8(&unk1_8, data+bytes);
25150
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
346 purple_debug_info("QQ", "unk1_8=0x%02X\n", unk1_8);
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
347 segments = g_new0(gchar*, QQ_MEMO_SIZE);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
348 for (index = 0; index < QQ_MEMO_SIZE; index++) {
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
349 /* get utf8 string */
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
350 bytes += qq_get_vstr(&segments[index], QQ_CHARSET_DEFAULT, data+bytes);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
351 /*
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
352 purple_debug_info("QQ", "bytes:%d, seg:%s\n", bytes, segments[index]);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
353 */
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
354 }
25146
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
355
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
356 /* common action, update buddy memo */
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
357 update_buddy_memo(gc, rcv_uid, segments[QQ_MEMO_ALIAS]);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
358
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
359 /* memo is thing that we regard our buddy as, so we need one more buddy_uid */
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
360 memo_modify_dialogue(gc, rcv_uid, segments, action);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
361 break;
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
362 default:
25150
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
363 purple_debug_info("QQ", "received an UNKNOWN memo cmd!!!\n");
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
364 break;
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
365 }
25146
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
366 }
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
367
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
368 /* request buddy memo */
25150
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
369 void qq_request_buddy_memo(PurpleConnection *gc, guint32 bd_uid, guint32 update_class, guint32 action)
25146
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
370 {
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
371 guint8 raw_data[16] = {0};
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
372 gint bytes;
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
373
25150
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
374 purple_debug_info("QQ", "qq_request_buddy_memo, buddy uid=%u, update_class=%u\n",
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25149
diff changeset
375 bd_uid, update_class);
25148
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
376 g_return_if_fail(NULL != gc);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
377 /* '0' is ok
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
378 g_return_if_fail(uid != 0);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
379 */
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
380 bytes = 0;
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
381 bytes += qq_put8(raw_data+bytes, QQ_BUDDY_MEMO_GET);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
382 bytes += qq_put32(raw_data+bytes, bd_uid);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
383 /*
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
384 qq_show_packet("MEMO REQUEST", raw_data, bytes);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
385 */
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
386
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
387 qq_send_cmd_mess(gc, QQ_CMD_BUDDY_MEMO, (guint8*)raw_data, bytes, update_class, action);
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
388 }
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
389
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25147
diff changeset
390