Fri, 01 May 2020 04:42:52 -0500
move all protocols, purple plugins, and purple tests to use purple.h instead of including files individually
|
33348
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33326
diff
changeset
|
1 | /* purple |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33326
diff
changeset
|
2 | * |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33326
diff
changeset
|
3 | * Purple is the legal property of its developers, whose names are too numerous |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33326
diff
changeset
|
4 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33326
diff
changeset
|
5 | * source distribution. |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33326
diff
changeset
|
6 | * |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33326
diff
changeset
|
7 | * Rewritten from scratch during Google Summer of Code 2012 |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33326
diff
changeset
|
8 | * by Tomek Wasilczyk (http://www.wasilczyk.pl). |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33326
diff
changeset
|
9 | * |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33326
diff
changeset
|
10 | * Previously implemented by: |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33326
diff
changeset
|
11 | * - Arkadiusz Miskiewicz <misiek@pld.org.pl> - first implementation (2001); |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33326
diff
changeset
|
12 | * - Bartosz Oler <bartosz@bzimage.us> - reimplemented during GSoC 2005; |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33326
diff
changeset
|
13 | * - Krzysztof Klinikowski <grommasher@gmail.com> - some parts (2009-2011). |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33326
diff
changeset
|
14 | * |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33326
diff
changeset
|
15 | * This program is free software; you can redistribute it and/or modify |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33326
diff
changeset
|
16 | * it under the terms of the GNU General Public License as published by |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33326
diff
changeset
|
17 | * the Free Software Foundation; either version 2 of the License, or |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33326
diff
changeset
|
18 | * (at your option) any later version. |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33326
diff
changeset
|
19 | * |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33326
diff
changeset
|
20 | * This program is distributed in the hope that it will be useful, |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33326
diff
changeset
|
21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33326
diff
changeset
|
22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33326
diff
changeset
|
23 | * GNU General Public License for more details. |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33326
diff
changeset
|
24 | * |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33326
diff
changeset
|
25 | * You should have received a copy of the GNU General Public License |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33326
diff
changeset
|
26 | * along with this program; if not, write to the Free Software |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33326
diff
changeset
|
27 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33326
diff
changeset
|
28 | */ |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33326
diff
changeset
|
29 | |
|
33314
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
30 | #include "roster.h" |
|
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
31 | |
|
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
32 | #include "gg.h" |
|
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
33 | #include "xml.h" |
|
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
34 | #include "utils.h" |
|
33317
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
35 | #include "purplew.h" |
|
33314
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
36 | |
|
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
37 | #define GGP_ROSTER_SYNC_SETT "gg-synchronized" |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
38 | #define GGP_ROSTER_DEBUG 0 |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
39 | #define GGP_ROSTER_GROUPID_DEFAULT "00000000-0000-0000-0000-000000000000" |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
40 | #define GGP_ROSTER_GROUPID_BOTS "0b345af6-0001-0000-0000-000000000004" |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
41 | |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
42 | /* TODO: ignored contacts synchronization (?) */ |
|
33314
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
43 | |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
44 | typedef struct |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
45 | { |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
46 | int version; |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
47 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
48 | PurpleXmlNode *xml; |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
49 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
50 | PurpleXmlNode *groups_node, *contacts_node; |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
51 | |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
52 | /** |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
53 | * Key: (uin_t) user identifier |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
54 | * Value: (PurpleXmlNode*) xml node for contact |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
55 | */ |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
56 | GHashTable *contact_nodes; |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
57 | |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
58 | /** |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
59 | * Key: (gchar*) group id |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
60 | * Value: (PurpleXmlNode*) xml node for group |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
61 | */ |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
62 | GHashTable *group_nodes; |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
63 | |
|
33320
f0ac6497f256
Gadu-Gadu: roster - fix synchronization for multiple gg accounts
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33319
diff
changeset
|
64 | /** |
|
f0ac6497f256
Gadu-Gadu: roster - fix synchronization for multiple gg accounts
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33319
diff
changeset
|
65 | * Key: (gchar*) group name |
|
f0ac6497f256
Gadu-Gadu: roster - fix synchronization for multiple gg accounts
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33319
diff
changeset
|
66 | * Value: (gchar*) group id |
|
f0ac6497f256
Gadu-Gadu: roster - fix synchronization for multiple gg accounts
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33319
diff
changeset
|
67 | */ |
|
f0ac6497f256
Gadu-Gadu: roster - fix synchronization for multiple gg accounts
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33319
diff
changeset
|
68 | GHashTable *group_ids; |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
69 | |
|
33320
f0ac6497f256
Gadu-Gadu: roster - fix synchronization for multiple gg accounts
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33319
diff
changeset
|
70 | /** |
|
f0ac6497f256
Gadu-Gadu: roster - fix synchronization for multiple gg accounts
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33319
diff
changeset
|
71 | * Key: (gchar*) group id |
|
f0ac6497f256
Gadu-Gadu: roster - fix synchronization for multiple gg accounts
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33319
diff
changeset
|
72 | * Value: (gchar*) group name |
|
f0ac6497f256
Gadu-Gadu: roster - fix synchronization for multiple gg accounts
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33319
diff
changeset
|
73 | */ |
|
33321
432a6a8a5ce5
Gadu-Gadu: roster - group issues, update reject handling
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33320
diff
changeset
|
74 | GHashTable *group_names; |
|
432a6a8a5ce5
Gadu-Gadu: roster - group issues, update reject handling
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33320
diff
changeset
|
75 | |
|
432a6a8a5ce5
Gadu-Gadu: roster - group issues, update reject handling
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33320
diff
changeset
|
76 | gchar *bots_group_id; |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
77 | |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
78 | gboolean needs_update; |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
79 | } ggp_roster_content; |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
80 | |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
81 | typedef struct |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
82 | { |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
83 | enum |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
84 | { |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
85 | GGP_ROSTER_CHANGE_CONTACT_UPDATE, |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
86 | GGP_ROSTER_CHANGE_CONTACT_REMOVE, |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
87 | GGP_ROSTER_CHANGE_GROUP_RENAME, |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
88 | } type; |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
89 | union |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
90 | { |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
91 | uin_t uin; |
|
33320
f0ac6497f256
Gadu-Gadu: roster - fix synchronization for multiple gg accounts
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33319
diff
changeset
|
92 | struct |
|
f0ac6497f256
Gadu-Gadu: roster - fix synchronization for multiple gg accounts
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33319
diff
changeset
|
93 | { |
|
f0ac6497f256
Gadu-Gadu: roster - fix synchronization for multiple gg accounts
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33319
diff
changeset
|
94 | gchar *old_name; |
|
f0ac6497f256
Gadu-Gadu: roster - fix synchronization for multiple gg accounts
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33319
diff
changeset
|
95 | gchar *new_name; |
|
f0ac6497f256
Gadu-Gadu: roster - fix synchronization for multiple gg accounts
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33319
diff
changeset
|
96 | } group_rename; |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
97 | } data; |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
98 | } ggp_roster_change; |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
99 | |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
100 | static inline ggp_roster_session_data * |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
101 | ggp_roster_get_rdata(PurpleConnection *gc); |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
102 | static void ggp_roster_content_free(ggp_roster_content *content); |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
103 | static void ggp_roster_change_free(gpointer change); |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
104 | static int ggp_roster_get_version(PurpleConnection *gc); |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
105 | static gboolean ggp_roster_timer_cb(gpointer _gc); |
|
33314
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
106 | #if GGP_ROSTER_DEBUG |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
107 | static void ggp_roster_dump(ggp_roster_content *content); |
|
33314
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
108 | #endif |
|
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
109 | |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
110 | /* synchronization control */ |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
111 | static gboolean ggp_roster_is_synchronized(PurpleBuddy *buddy); |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
112 | static void ggp_roster_set_synchronized(PurpleConnection *gc, |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
113 | PurpleBuddy *buddy, gboolean synchronized); |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
114 | |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
115 | /* buddy list import */ |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
116 | static gboolean ggp_roster_reply_list_read_group(PurpleXmlNode *node, |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
117 | ggp_roster_content *content); |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
118 | static gboolean ggp_roster_reply_list_read_buddy(PurpleConnection *gc, |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
119 | PurpleXmlNode *node, ggp_roster_content *content, GHashTable *remove_buddies); |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
120 | static void ggp_roster_reply_list(PurpleConnection *gc, uint32_t version, |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
121 | const char *reply); |
|
33314
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
122 | |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
123 | /* buddy list export */ |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
124 | static const gchar * ggp_roster_send_update_group_add( |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
125 | ggp_roster_content *content, PurpleGroup *group); |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
126 | static gboolean ggp_roster_send_update_contact_update(PurpleConnection *gc, |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
127 | ggp_roster_change *change); |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
128 | static gboolean ggp_roster_send_update_contact_remove(PurpleConnection *gc, |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
129 | ggp_roster_change *change); |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
130 | static gboolean ggp_roster_send_update_group_rename(PurpleConnection *gc, |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
131 | ggp_roster_change *change); |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
132 | static void ggp_roster_send_update(PurpleConnection *gc); |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
133 | static void ggp_roster_reply_ack(PurpleConnection *gc, uint32_t version); |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
134 | static void ggp_roster_reply_reject(PurpleConnection *gc, uint32_t version); |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
135 | |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
136 | /******************************************************************************/ |
|
33319
8321461fa2be
Gadu-Gadu: roster - disable, when not supported
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33318
diff
changeset
|
137 | |
|
33314
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
138 | static inline ggp_roster_session_data * |
|
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
139 | ggp_roster_get_rdata(PurpleConnection *gc) |
|
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
140 | { |
|
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
141 | GGPInfo *accdata = purple_connection_get_protocol_data(gc); |
|
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
142 | return &accdata->roster_data; |
|
35358
7beae478c905
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35356
diff
changeset
|
143 | } |
|
33314
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
144 | |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
145 | static void ggp_roster_content_free(ggp_roster_content *content) |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
146 | { |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
147 | if (content == NULL) |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
148 | return; |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
149 | if (content->xml) |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
150 | purple_xmlnode_free(content->xml); |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
151 | if (content->contact_nodes) |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
152 | g_hash_table_destroy(content->contact_nodes); |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
153 | if (content->group_nodes) |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
154 | g_hash_table_destroy(content->group_nodes); |
|
33320
f0ac6497f256
Gadu-Gadu: roster - fix synchronization for multiple gg accounts
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33319
diff
changeset
|
155 | if (content->group_ids) |
|
f0ac6497f256
Gadu-Gadu: roster - fix synchronization for multiple gg accounts
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33319
diff
changeset
|
156 | g_hash_table_destroy(content->group_ids); |
|
f0ac6497f256
Gadu-Gadu: roster - fix synchronization for multiple gg accounts
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33319
diff
changeset
|
157 | if (content->group_names) |
|
f0ac6497f256
Gadu-Gadu: roster - fix synchronization for multiple gg accounts
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33319
diff
changeset
|
158 | g_hash_table_destroy(content->group_names); |
|
37426
6fd4989b77e4
The last of the NULL-checks before free()
Michael McConville <mmcco@mykolab.com>
parents:
36068
diff
changeset
|
159 | g_free(content->bots_group_id); |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
160 | g_free(content); |
|
33314
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
161 | } |
|
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
162 | |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
163 | static void ggp_roster_change_free(gpointer _change) |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
164 | { |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
165 | ggp_roster_change *change = _change; |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
166 | |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35358
diff
changeset
|
167 | if (change->type == GGP_ROSTER_CHANGE_GROUP_RENAME) { |
|
33320
f0ac6497f256
Gadu-Gadu: roster - fix synchronization for multiple gg accounts
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33319
diff
changeset
|
168 | g_free(change->data.group_rename.old_name); |
|
f0ac6497f256
Gadu-Gadu: roster - fix synchronization for multiple gg accounts
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33319
diff
changeset
|
169 | g_free(change->data.group_rename.new_name); |
|
f0ac6497f256
Gadu-Gadu: roster - fix synchronization for multiple gg accounts
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33319
diff
changeset
|
170 | } |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
171 | |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
172 | g_free(change); |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
173 | } |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
174 | |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
175 | static int ggp_roster_get_version(PurpleConnection *gc) |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
176 | { |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
177 | ggp_roster_content *content = ggp_roster_get_rdata(gc)->content; |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
178 | if (content == NULL) |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
179 | return 0; |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
180 | return content->version; |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
181 | } |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
182 | |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
183 | static gboolean ggp_roster_timer_cb(gpointer _gc) |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
184 | { |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
185 | PurpleConnection *gc = _gc; |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
186 | |
|
36068
e9b9320a985a
Drop PURPLE_CONNECTION_IS_VALID in favor of (temporary) PURPLE_ASSERT_CONNECTION_IS_VALID
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35958
diff
changeset
|
187 | PURPLE_ASSERT_CONNECTION_IS_VALID(gc); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
188 | |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
189 | ggp_roster_send_update(gc); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
190 | |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
191 | return TRUE; |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
192 | } |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
193 | |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
194 | #if GGP_ROSTER_DEBUG |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
195 | static void ggp_roster_dump(ggp_roster_content *content) |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
196 | { |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
197 | char *str; |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
198 | int len; |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
199 | |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
200 | g_return_if_fail(content != NULL); |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
201 | g_return_if_fail(content->xml != NULL); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
202 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
203 | str = purple_xmlnode_to_formatted_str(content->xml, &len); |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
204 | purple_debug_misc("gg", "ggp_roster_dump: [%s]\n", str); |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
205 | g_free(str); |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
206 | } |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
207 | #endif |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
208 | |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
209 | /******************************************************************************* |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
210 | * Setup. |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
211 | ******************************************************************************/ |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
212 | |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
213 | gboolean ggp_roster_enabled(void) |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
214 | { |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
215 | static gboolean checked = FALSE; |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
216 | static gboolean enabled; |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
217 | |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35358
diff
changeset
|
218 | if (!checked) { |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
219 | enabled = gg_libgadu_check_feature( |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
220 | GG_LIBGADU_FEATURE_USERLIST100); |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
221 | checked = TRUE; |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
222 | } |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
223 | return enabled; |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
224 | } |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
225 | |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
226 | void ggp_roster_setup(PurpleConnection *gc) |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
227 | { |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
228 | ggp_roster_session_data *rdata = ggp_roster_get_rdata(gc); |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
229 | |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
230 | rdata->content = NULL; |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
231 | rdata->sent_updates = NULL; |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
232 | rdata->pending_updates = NULL; |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
233 | rdata->timer = 0; |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
234 | rdata->is_updating = FALSE; |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
235 | |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
236 | if (ggp_roster_enabled()) |
|
38433
361c801c4536
Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents:
37523
diff
changeset
|
237 | rdata->timer = g_timeout_add_seconds(2, |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
238 | ggp_roster_timer_cb, gc); |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
239 | } |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
240 | |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
241 | void ggp_roster_cleanup(PurpleConnection *gc) |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
242 | { |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
243 | ggp_roster_session_data *rdata = ggp_roster_get_rdata(gc); |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
244 | |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
245 | if (rdata->timer) |
|
38433
361c801c4536
Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents:
37523
diff
changeset
|
246 | g_source_remove(rdata->timer); |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
247 | ggp_roster_content_free(rdata->content); |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
248 | g_list_free_full(rdata->sent_updates, ggp_roster_change_free); |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
249 | g_list_free_full(rdata->pending_updates, ggp_roster_change_free); |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
250 | } |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
251 | |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
252 | /******************************************************************************* |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
253 | * Synchronization control. |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
254 | ******************************************************************************/ |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
255 | |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
256 | static gboolean ggp_roster_is_synchronized(PurpleBuddy *buddy) |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
257 | { |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
258 | gboolean ret = purple_blist_node_get_bool(PURPLE_BLIST_NODE(buddy), |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
259 | GGP_ROSTER_SYNC_SETT); |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
260 | return ret; |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
261 | } |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
262 | |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
263 | static void ggp_roster_set_synchronized(PurpleConnection *gc, |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
264 | PurpleBuddy *buddy, gboolean synchronized) |
|
33314
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
265 | { |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
266 | ggp_roster_session_data *rdata = ggp_roster_get_rdata(gc); |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
267 | uin_t uin = ggp_str_to_uin(purple_buddy_get_name(buddy)); |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
268 | ggp_roster_change *change; |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
269 | |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
270 | purple_blist_node_set_bool(PURPLE_BLIST_NODE(buddy), |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
271 | GGP_ROSTER_SYNC_SETT, synchronized); |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35358
diff
changeset
|
272 | if (!synchronized) { |
|
33320
f0ac6497f256
Gadu-Gadu: roster - fix synchronization for multiple gg accounts
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33319
diff
changeset
|
273 | change = g_new0(ggp_roster_change, 1); |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
274 | change->type = GGP_ROSTER_CHANGE_CONTACT_UPDATE; |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
275 | change->data.uin = uin; |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
276 | rdata->pending_updates = |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
277 | g_list_append(rdata->pending_updates, change); |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
278 | } |
|
33314
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
279 | } |
|
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
280 | |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
281 | void ggp_roster_request_update(PurpleConnection *gc) |
|
33314
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
282 | { |
|
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
283 | GGPInfo *accdata = purple_connection_get_protocol_data(gc); |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
284 | int local_version = ggp_roster_get_version(gc); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
285 | |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35358
diff
changeset
|
286 | if (!ggp_roster_enabled()) { |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
287 | purple_debug_warning("gg", "ggp_roster_request_update: " |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
288 | "feature disabled\n"); |
|
33314
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
289 | return; |
|
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
290 | } |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
291 | |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
292 | purple_debug_info("gg", "ggp_roster_request_update: local=%u\n", |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
293 | local_version); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
294 | |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
295 | gg_userlist100_request(accdata->session, GG_USERLIST100_GET, |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
296 | local_version, GG_USERLIST100_FORMAT_TYPE_GG100, NULL); |
|
33314
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
297 | } |
|
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
298 | |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
299 | /******************************************************************************* |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
300 | * Libgadu callbacks. |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
301 | ******************************************************************************/ |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
302 | |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
303 | void ggp_roster_reply(PurpleConnection *gc, |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
304 | struct gg_event_userlist100_reply *reply) |
|
33314
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
305 | { |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35358
diff
changeset
|
306 | if (GG_USERLIST100_FORMAT_TYPE_GG100 != reply->format_type) { |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
307 | purple_debug_warning("gg", "ggp_roster_reply: " |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
308 | "unsupported format type (%x)\n", reply->format_type); |
|
33314
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
309 | return; |
|
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
310 | } |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
311 | |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
312 | if (reply->type == GG_USERLIST100_REPLY_LIST) |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
313 | ggp_roster_reply_list(gc, reply->version, reply->reply); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
314 | else if (reply->type == 0x01) /* list up to date (TODO: push to libgadu) */ |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
315 | purple_debug_info("gg", "ggp_roster_reply: list up to date\n"); |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
316 | else if (reply->type == GG_USERLIST100_REPLY_ACK) |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
317 | ggp_roster_reply_ack(gc, reply->version); |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
318 | else if (reply->type == GG_USERLIST100_REPLY_REJECT) |
|
33321
432a6a8a5ce5
Gadu-Gadu: roster - group issues, update reject handling
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33320
diff
changeset
|
319 | ggp_roster_reply_reject(gc, reply->version); |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
320 | else |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
321 | purple_debug_error("gg", "ggp_roster_reply: " |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
322 | "unsupported reply (%x)\n", reply->type); |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
323 | } |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
324 | |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
325 | void ggp_roster_version(PurpleConnection *gc, |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
326 | struct gg_event_userlist100_version *version) |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
327 | { |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
328 | int local_version = ggp_roster_get_version(gc); |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
329 | int remote_version = version->version; |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
330 | |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
331 | purple_debug_info("gg", "ggp_roster_version: local=%u, remote=%u\n", |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
332 | local_version, remote_version); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
333 | |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
334 | if (local_version < remote_version) |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
335 | ggp_roster_request_update(gc); |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
336 | } |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
337 | |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
338 | /******************************************************************************* |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
339 | * Libpurple callbacks. |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
340 | ******************************************************************************/ |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
341 | |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
342 | void ggp_roster_alias_buddy(PurpleConnection *gc, const char *who, |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
343 | const char *alias) |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
344 | { |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
345 | PurpleBuddy *buddy; |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
346 | |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
347 | g_return_if_fail(who != NULL); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
348 | |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
349 | if (!ggp_roster_enabled()) |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
350 | return; |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
351 | |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
352 | purple_debug_misc("gg", "ggp_roster_alias_buddy(\"%s\", \"%s\")\n", |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
353 | who, alias); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
354 | |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34723
diff
changeset
|
355 | buddy = purple_blist_find_buddy(purple_connection_get_account(gc), who); |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
356 | g_return_if_fail(buddy != NULL); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
357 | |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
358 | ggp_roster_set_synchronized(gc, buddy, FALSE); |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
359 | } |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
360 | |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
361 | void ggp_roster_group_buddy(PurpleConnection *gc, const char *who, |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
362 | const char *old_group, const char *new_group) |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
363 | { |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
364 | ggp_roster_session_data *rdata = ggp_roster_get_rdata(gc); |
|
35629
5aecb81f23ab
Fix memory leaks in Gadu-Gadu prpl. Fixes #16129
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35361
diff
changeset
|
365 | ggp_roster_change *change; |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
366 | |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
367 | if (!ggp_roster_enabled()) |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
368 | return; |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
369 | if (rdata->is_updating) |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
370 | return; |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
371 | |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
372 | purple_debug_misc("gg", "ggp_roster_group_buddy: " |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
373 | "who=\"%s\", group=\"%s\" -> \"%s\")\n", |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
374 | who, old_group, new_group); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
375 | |
|
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
376 | /* purple_blist_find_buddy(..., who) is not accessible at this moment */ |
|
35629
5aecb81f23ab
Fix memory leaks in Gadu-Gadu prpl. Fixes #16129
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35361
diff
changeset
|
377 | change = g_new0(ggp_roster_change, 1); |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
378 | change->type = GGP_ROSTER_CHANGE_CONTACT_UPDATE; |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
379 | change->data.uin = ggp_str_to_uin(who); |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
380 | rdata->pending_updates = g_list_append(rdata->pending_updates, change); |
|
33314
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
381 | } |
|
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
382 | |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
383 | void ggp_roster_rename_group(PurpleConnection *gc, const char *old_name, |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
384 | PurpleGroup *group, GList *moved_buddies) |
|
33321
432a6a8a5ce5
Gadu-Gadu: roster - group issues, update reject handling
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33320
diff
changeset
|
385 | { |
|
432a6a8a5ce5
Gadu-Gadu: roster - group issues, update reject handling
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33320
diff
changeset
|
386 | ggp_roster_session_data *rdata = ggp_roster_get_rdata(gc); |
|
35629
5aecb81f23ab
Fix memory leaks in Gadu-Gadu prpl. Fixes #16129
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35361
diff
changeset
|
387 | ggp_roster_change *change; |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
388 | |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
389 | if (!ggp_roster_enabled()) |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
390 | return; |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
391 | |
|
35629
5aecb81f23ab
Fix memory leaks in Gadu-Gadu prpl. Fixes #16129
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35361
diff
changeset
|
392 | change = g_new0(ggp_roster_change, 1); |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
393 | change->type = GGP_ROSTER_CHANGE_GROUP_RENAME; |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
394 | change->data.group_rename.old_name = g_strdup(old_name); |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
395 | change->data.group_rename.new_name = |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
396 | g_strdup(purple_group_get_name(group)); |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
397 | rdata->pending_updates = g_list_append(rdata->pending_updates, change); |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
398 | } |
|
33321
432a6a8a5ce5
Gadu-Gadu: roster - group issues, update reject handling
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33320
diff
changeset
|
399 | |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
400 | void ggp_roster_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
401 | PurpleGroup *group, const char *message) |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
402 | { |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
403 | g_return_if_fail(gc != NULL); |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
404 | g_return_if_fail(buddy != NULL); |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
405 | |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
406 | if (!ggp_roster_enabled()) |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
407 | return; |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
408 | |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
409 | ggp_roster_set_synchronized(gc, buddy, FALSE); |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
410 | } |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
411 | |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
412 | void ggp_roster_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
413 | PurpleGroup *group) |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
414 | { |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
415 | ggp_roster_session_data *rdata = ggp_roster_get_rdata(gc); |
|
35629
5aecb81f23ab
Fix memory leaks in Gadu-Gadu prpl. Fixes #16129
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35361
diff
changeset
|
416 | ggp_roster_change *change; |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
417 | |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
418 | if (!ggp_roster_enabled()) |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
419 | return; |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
420 | |
|
35629
5aecb81f23ab
Fix memory leaks in Gadu-Gadu prpl. Fixes #16129
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35361
diff
changeset
|
421 | change = g_new0(ggp_roster_change, 1); |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
422 | change->type = GGP_ROSTER_CHANGE_CONTACT_REMOVE; |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
423 | change->data.uin = ggp_str_to_uin(purple_buddy_get_name(buddy)); |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
424 | rdata->pending_updates = g_list_append(rdata->pending_updates, change); |
|
33321
432a6a8a5ce5
Gadu-Gadu: roster - group issues, update reject handling
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33320
diff
changeset
|
425 | } |
|
432a6a8a5ce5
Gadu-Gadu: roster - group issues, update reject handling
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33320
diff
changeset
|
426 | |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
427 | /******************************************************************************* |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
428 | * Buddy list import. |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
429 | ******************************************************************************/ |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
430 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
431 | static gboolean ggp_roster_reply_list_read_group(PurpleXmlNode *node, |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
432 | ggp_roster_content *content) |
|
33317
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
433 | { |
|
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
434 | char *name, *id; |
|
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
435 | gboolean removable; |
|
33321
432a6a8a5ce5
Gadu-Gadu: roster - group issues, update reject handling
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33320
diff
changeset
|
436 | gboolean succ = TRUE, is_bot, is_default; |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
437 | |
|
33317
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
438 | succ &= ggp_xml_get_string(node, "Id", &id); |
|
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
439 | succ &= ggp_xml_get_string(node, "Name", &name); |
|
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
440 | succ &= ggp_xml_get_bool(node, "IsRemovable", &removable); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
441 | |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35358
diff
changeset
|
442 | if (!succ) { |
|
33317
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
443 | g_free(id); |
|
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
444 | g_free(name); |
|
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
445 | g_return_val_if_reached(FALSE); |
|
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
446 | } |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
447 | |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
448 | is_bot = (strcmp(id, GGP_ROSTER_GROUPID_BOTS) == 0 || |
|
33321
432a6a8a5ce5
Gadu-Gadu: roster - group issues, update reject handling
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33320
diff
changeset
|
449 | g_strcmp0(name, "Pomocnicy") == 0); |
|
432a6a8a5ce5
Gadu-Gadu: roster - group issues, update reject handling
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33320
diff
changeset
|
450 | is_default = (strcmp(id, GGP_ROSTER_GROUPID_DEFAULT) == 0 || |
|
35958
1d8446f396b6
blist: define default group better
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35758
diff
changeset
|
451 | g_strcmp0(name, PURPLE_BLIST_DEFAULT_GROUP_NAME) == 0 || |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
452 | g_strcmp0(name, "[default]") == 0); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
453 | |
|
33321
432a6a8a5ce5
Gadu-Gadu: roster - group issues, update reject handling
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33320
diff
changeset
|
454 | if (!content->bots_group_id && is_bot) |
|
432a6a8a5ce5
Gadu-Gadu: roster - group issues, update reject handling
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33320
diff
changeset
|
455 | content->bots_group_id = g_strdup(id); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
456 | |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35358
diff
changeset
|
457 | if (!removable || is_bot || is_default) { |
|
33317
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
458 | g_free(id); |
|
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
459 | g_free(name); |
|
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
460 | return TRUE; |
|
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
461 | } |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
462 | |
|
33317
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
463 | g_hash_table_insert(content->group_nodes, g_strdup(id), node); |
|
33320
f0ac6497f256
Gadu-Gadu: roster - fix synchronization for multiple gg accounts
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33319
diff
changeset
|
464 | g_hash_table_insert(content->group_ids, g_strdup(name), g_strdup(id)); |
|
f0ac6497f256
Gadu-Gadu: roster - fix synchronization for multiple gg accounts
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33319
diff
changeset
|
465 | g_hash_table_insert(content->group_names, id, name); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
466 | |
|
33317
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
467 | return TRUE; |
|
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
468 | } |
|
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
469 | |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
470 | static gboolean ggp_roster_reply_list_read_buddy(PurpleConnection *gc, |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
471 | PurpleXmlNode *node, ggp_roster_content *content, GHashTable *remove_buddies) |
|
33317
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
472 | { |
|
34377
5ba37b370be6
Initialize value
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33368
diff
changeset
|
473 | gchar *alias, *group_name = NULL; |
|
33317
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
474 | uin_t uin; |
|
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
475 | gboolean succ = TRUE; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
476 | PurpleXmlNode *group_list, *group_elem; |
|
33317
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
477 | PurpleBuddy *buddy = NULL; |
|
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
478 | PurpleGroup *group = NULL; |
|
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
479 | PurpleGroup *currentGroup; |
|
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
480 | gboolean alias_changed; |
|
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
481 | PurpleAccount *account = purple_connection_get_account(gc); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
482 | |
|
33317
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
483 | succ &= ggp_xml_get_string(node, "ShowName", &alias); |
|
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
484 | succ &= ggp_xml_get_uint(node, "GGNumber", &uin); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
485 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
486 | group_list = purple_xmlnode_get_child(node, "Groups"); |
|
33317
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
487 | succ &= (group_list != NULL); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
488 | |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35358
diff
changeset
|
489 | if (!succ) { |
|
33317
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
490 | g_free(alias); |
|
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
491 | g_return_val_if_reached(FALSE); |
|
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
492 | } |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
493 | |
|
33317
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
494 | g_hash_table_insert(content->contact_nodes, GINT_TO_POINTER(uin), node); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
495 | |
|
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
496 | /* check, if alias is set */ |
|
37523
02346b6472b3
Simplify checks for empty strings
Michael McConville <mmcconville@mykolab.com>
parents:
37426
diff
changeset
|
497 | if (*alias == '\0' || |
|
33317
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
498 | strcmp(alias, ggp_uin_to_str(uin)) == 0) |
|
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
499 | { |
|
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
500 | g_free(alias); |
|
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
501 | alias = NULL; |
|
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
502 | } |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
503 | |
|
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
504 | /* getting (eventually creating) group */ |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
505 | group_elem = purple_xmlnode_get_child(group_list, "GroupId"); |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35358
diff
changeset
|
506 | while (group_elem != NULL) { |
|
33317
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
507 | gchar *id; |
|
33321
432a6a8a5ce5
Gadu-Gadu: roster - group issues, update reject handling
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33320
diff
changeset
|
508 | gboolean isbot; |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
509 | |
|
33317
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
510 | if (!ggp_xml_get_string(group_elem, NULL, &id)) |
|
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
511 | continue; |
|
33321
432a6a8a5ce5
Gadu-Gadu: roster - group issues, update reject handling
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33320
diff
changeset
|
512 | isbot = (0 == g_strcmp0(id, content->bots_group_id)); |
|
33320
f0ac6497f256
Gadu-Gadu: roster - fix synchronization for multiple gg accounts
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33319
diff
changeset
|
513 | group_name = g_hash_table_lookup(content->group_names, id); |
|
33317
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
514 | g_free(id); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
515 | |
|
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
516 | /* we don't want to import bots; |
|
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
517 | * they are inserted to roster by default |
|
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
518 | */ |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35358
diff
changeset
|
519 | if (isbot) { |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
520 | g_free(alias); |
|
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
521 | return TRUE; |
|
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
522 | } |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
523 | |
|
33317
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
524 | if (group_name != NULL) |
|
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
525 | break; |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
526 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
527 | group_elem = purple_xmlnode_get_next_twin(group_elem); |
|
33317
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
528 | } |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35358
diff
changeset
|
529 | if (group_name) { |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34723
diff
changeset
|
530 | group = purple_blist_find_group(group_name); |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35358
diff
changeset
|
531 | if (!group) { |
|
33317
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
532 | group = purple_group_new(group_name); |
|
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
533 | purple_blist_add_group(group, NULL); |
|
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
534 | } |
|
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
535 | } |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
536 | |
|
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
537 | /* add buddy, if doesn't exists */ |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34723
diff
changeset
|
538 | buddy = purple_blist_find_buddy(account, ggp_uin_to_str(uin)); |
|
33317
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
539 | g_hash_table_remove(remove_buddies, GINT_TO_POINTER(uin)); |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35358
diff
changeset
|
540 | if (!buddy) { |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
541 | purple_debug_info("gg", "ggp_roster_reply_list_read_buddy: " |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
542 | "adding %u (%s) to buddy list\n", uin, alias); |
|
33317
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
543 | buddy = purple_buddy_new(account, ggp_uin_to_str(uin), alias); |
|
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
544 | purple_blist_add_buddy(buddy, NULL, group, NULL); |
|
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
545 | ggp_roster_set_synchronized(gc, buddy, TRUE); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
546 | |
|
33317
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
547 | g_free(alias); |
|
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
548 | return TRUE; |
|
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
549 | } |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
550 | |
|
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
551 | /* buddy exists, but is not synchronized - local list has priority */ |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35358
diff
changeset
|
552 | if (!ggp_roster_is_synchronized(buddy)) { |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
553 | purple_debug_misc("gg", "ggp_roster_reply_list_read_buddy: " |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
554 | "ignoring not synchronized %u (%s)\n", |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
555 | uin, purple_buddy_get_name(buddy)); |
|
33317
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
556 | g_free(alias); |
|
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
557 | return TRUE; |
|
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
558 | } |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
559 | |
|
33317
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
560 | currentGroup = ggp_purplew_buddy_get_group_only(buddy); |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
561 | alias_changed = |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
562 | (0 != g_strcmp0(alias, purple_buddy_get_alias_only(buddy))); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
563 | |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35358
diff
changeset
|
564 | if (currentGroup == group && !alias_changed) { |
|
33317
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
565 | g_free(alias); |
|
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
566 | return TRUE; |
|
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
567 | } |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
568 | |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
569 | purple_debug_misc("gg", "ggp_roster_reply_list_read_buddy: " |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
570 | "updating %u (%s) - alias=\"%s\"->\"%s\", group=%p->%p (%s)\n", |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
571 | uin, purple_buddy_get_name(buddy), |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
572 | purple_buddy_get_alias(buddy), alias, |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
573 | currentGroup, group, group_name); |
|
33317
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
574 | if (alias_changed) |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34723
diff
changeset
|
575 | purple_buddy_set_local_alias(buddy, alias); |
|
33317
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
576 | if (currentGroup != group) |
|
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
577 | purple_blist_add_buddy(buddy, NULL, group, NULL); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
578 | |
|
33317
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
579 | g_free(alias); |
|
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
580 | return TRUE; |
|
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
581 | } |
|
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
582 | |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
583 | static void ggp_roster_reply_list(PurpleConnection *gc, uint32_t version, |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
584 | const char *data) |
|
33314
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
585 | { |
|
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
586 | ggp_roster_session_data *rdata = ggp_roster_get_rdata(gc); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
587 | PurpleXmlNode *xml, *xml_it; |
|
33314
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
588 | PurpleAccount *account; |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
589 | GSList *local_buddies; |
|
33323
533c270f6f1d
Gadu-Gadu: roster - remove emptied groups
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33321
diff
changeset
|
590 | GHashTable *remove_buddies; |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
591 | GList *update_buddies = NULL, *local_groups, *it, *table_values; |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
592 | ggp_roster_content *content; |
|
33314
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
593 | |
|
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
594 | g_return_if_fail(gc != NULL); |
|
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
595 | g_return_if_fail(data != NULL); |
|
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
596 | |
|
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
597 | account = purple_connection_get_account(gc); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
598 | |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
599 | purple_debug_info("gg", "ggp_roster_reply_list: got list, version=%u\n", |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
600 | version); |
|
33314
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
601 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
602 | xml = purple_xmlnode_from_str(data, -1); |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35358
diff
changeset
|
603 | if (xml == NULL) { |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
604 | purple_debug_warning("gg", "ggp_roster_reply_list: " |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
605 | "invalid xml\n"); |
|
33314
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
606 | return; |
|
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
607 | } |
|
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
608 | |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
609 | ggp_roster_content_free(rdata->content); |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
610 | rdata->content = NULL; |
|
33320
f0ac6497f256
Gadu-Gadu: roster - fix synchronization for multiple gg accounts
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33319
diff
changeset
|
611 | rdata->is_updating = TRUE; |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
612 | content = g_new0(ggp_roster_content, 1); |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
613 | content->version = version; |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
614 | content->xml = xml; |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
615 | content->contact_nodes = g_hash_table_new(NULL, NULL); |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
616 | content->group_nodes = g_hash_table_new_full( |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
617 | g_str_hash, g_str_equal, g_free, NULL); |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
618 | content->group_ids = g_hash_table_new_full( |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
619 | g_str_hash, g_str_equal, g_free, g_free); |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
620 | content->group_names = g_hash_table_new_full( |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
621 | g_str_hash, g_str_equal, g_free, g_free); |
|
33314
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
622 | |
|
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
623 | #if GGP_ROSTER_DEBUG |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
624 | ggp_roster_dump(content); |
|
33314
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
625 | #endif |
|
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
626 | |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
627 | /* reading groups */ |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
628 | content->groups_node = purple_xmlnode_get_child(xml, "Groups"); |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35358
diff
changeset
|
629 | if (content->groups_node == NULL) { |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
630 | ggp_roster_content_free(content); |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
631 | g_return_if_reached(); |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
632 | } |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
633 | xml_it = purple_xmlnode_get_child(content->groups_node, "Group"); |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35358
diff
changeset
|
634 | while (xml_it != NULL) { |
|
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35358
diff
changeset
|
635 | if (!ggp_roster_reply_list_read_group(xml_it, content)) { |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
636 | ggp_roster_content_free(content); |
|
33314
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
637 | g_return_if_reached(); |
|
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
638 | } |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
639 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
640 | xml_it = purple_xmlnode_get_next_twin(xml_it); |
|
33314
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
641 | } |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
642 | |
|
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
643 | /* dumping current group list */ |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
644 | local_groups = ggp_purplew_account_get_groups(account, TRUE); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
645 | |
|
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
646 | /* dumping current buddy list |
|
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
647 | * we will: |
|
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
648 | * - remove synchronized ones, if not found in list at server |
|
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
649 | * - upload not synchronized ones |
|
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
650 | */ |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34723
diff
changeset
|
651 | local_buddies = purple_blist_find_buddies(account, NULL); |
|
33314
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
652 | remove_buddies = g_hash_table_new(g_direct_hash, g_direct_equal); |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35358
diff
changeset
|
653 | while (local_buddies) { |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
654 | PurpleBuddy *buddy = local_buddies->data; |
|
33314
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
655 | uin_t uin = ggp_str_to_uin(purple_buddy_get_name(buddy)); |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
656 | local_buddies = |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
657 | g_slist_delete_link(local_buddies, local_buddies); |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
658 | |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
659 | if (!uin) |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
660 | continue; |
|
33314
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
661 | |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
662 | if (ggp_roster_is_synchronized(buddy)) |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
663 | g_hash_table_insert(remove_buddies, |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
664 | GINT_TO_POINTER(uin), buddy); |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
665 | else |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
666 | update_buddies = g_list_append(update_buddies, buddy); |
|
33314
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
667 | } |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
668 | |
|
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
669 | /* reading buddies */ |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
670 | content->contacts_node = purple_xmlnode_get_child(xml, "Contacts"); |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35358
diff
changeset
|
671 | if (content->contacts_node == NULL) { |
|
33314
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
672 | g_hash_table_destroy(remove_buddies); |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
673 | g_list_free(update_buddies); |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
674 | ggp_roster_content_free(content); |
|
33314
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
675 | g_return_if_reached(); |
|
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
676 | } |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
677 | xml_it = purple_xmlnode_get_child(content->contacts_node, "Contact"); |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35358
diff
changeset
|
678 | while (xml_it != NULL) { |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
679 | if (!ggp_roster_reply_list_read_buddy(gc, xml_it, content, |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
680 | remove_buddies)) |
|
33314
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
681 | { |
|
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
682 | g_hash_table_destroy(remove_buddies); |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
683 | g_list_free(update_buddies); |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
684 | ggp_roster_content_free(content); |
|
33314
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
685 | g_return_if_reached(); |
|
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
686 | } |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
687 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
688 | xml_it = purple_xmlnode_get_next_twin(xml_it); |
|
33314
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
689 | } |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
690 | |
|
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
691 | /* removing buddies, which are not present in roster */ |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
692 | table_values = g_hash_table_get_values(remove_buddies); |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
693 | it = g_list_first(table_values); |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35358
diff
changeset
|
694 | while (it) { |
|
33323
533c270f6f1d
Gadu-Gadu: roster - remove emptied groups
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33321
diff
changeset
|
695 | PurpleBuddy *buddy = it->data; |
|
533c270f6f1d
Gadu-Gadu: roster - remove emptied groups
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33321
diff
changeset
|
696 | it = g_list_next(it); |
|
533c270f6f1d
Gadu-Gadu: roster - remove emptied groups
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33321
diff
changeset
|
697 | if (!ggp_roster_is_synchronized(buddy)) |
|
533c270f6f1d
Gadu-Gadu: roster - remove emptied groups
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33321
diff
changeset
|
698 | continue; |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
699 | purple_debug_info("gg", "ggp_roster_reply_list: " |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
700 | "removing %s from buddy list\n", |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
701 | purple_buddy_get_name(buddy)); |
|
33323
533c270f6f1d
Gadu-Gadu: roster - remove emptied groups
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33321
diff
changeset
|
702 | purple_blist_remove_buddy(buddy); |
|
33314
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
703 | } |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
704 | g_list_free(table_values); |
|
33314
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
705 | g_hash_table_destroy(remove_buddies); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
706 | |
|
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
707 | /* remove groups, which are empty, but had contacts before |
|
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
708 | * synchronization |
|
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
709 | */ |
|
33323
533c270f6f1d
Gadu-Gadu: roster - remove emptied groups
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33321
diff
changeset
|
710 | it = g_list_first(local_groups); |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35358
diff
changeset
|
711 | while (it) { |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
712 | PurpleGroup *group = it->data; |
|
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
713 | it = g_list_next(it); |
|
34723
b496dd569514
Refactored libpurple plugins and protocols according to the blist API changes
Ankit Vani <a@nevitus.org>
parents:
33368
diff
changeset
|
714 | if (purple_counting_node_get_total_size(PURPLE_COUNTING_NODE(group)) != 0) |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
715 | continue; |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
716 | purple_debug_info("gg", "ggp_roster_reply_list: " |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
717 | "removing group %s\n", purple_group_get_name(group)); |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
718 | purple_blist_remove_group(group); |
|
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
719 | } |
|
33323
533c270f6f1d
Gadu-Gadu: roster - remove emptied groups
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33321
diff
changeset
|
720 | g_list_free(local_groups); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
721 | |
|
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
722 | /* adding not synchronized buddies */ |
|
33323
533c270f6f1d
Gadu-Gadu: roster - remove emptied groups
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33321
diff
changeset
|
723 | it = g_list_first(update_buddies); |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35358
diff
changeset
|
724 | while (it) { |
|
33323
533c270f6f1d
Gadu-Gadu: roster - remove emptied groups
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33321
diff
changeset
|
725 | PurpleBuddy *buddy = it->data; |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
726 | uin_t uin = ggp_str_to_uin(purple_buddy_get_name(buddy)); |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
727 | ggp_roster_change *change; |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
728 | |
|
33323
533c270f6f1d
Gadu-Gadu: roster - remove emptied groups
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33321
diff
changeset
|
729 | it = g_list_next(it); |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
730 | g_assert(uin > 0); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
731 | |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
732 | purple_debug_misc("gg", "ggp_roster_reply_list: " |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
733 | "adding change of %u for roster\n", uin); |
|
33320
f0ac6497f256
Gadu-Gadu: roster - fix synchronization for multiple gg accounts
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33319
diff
changeset
|
734 | change = g_new0(ggp_roster_change, 1); |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
735 | change->type = GGP_ROSTER_CHANGE_CONTACT_UPDATE; |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
736 | change->data.uin = uin; |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
737 | rdata->pending_updates = |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
738 | g_list_append(rdata->pending_updates, change); |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
739 | } |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
740 | g_list_free(update_buddies); |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
741 | |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
742 | rdata->content = content; |
|
33320
f0ac6497f256
Gadu-Gadu: roster - fix synchronization for multiple gg accounts
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33319
diff
changeset
|
743 | rdata->is_updating = FALSE; |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
744 | purple_debug_info("gg", "ggp_roster_reply_list: " |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
745 | "import done, version=%u\n", version); |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
746 | } |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
747 | |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
748 | /******************************************************************************* |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
749 | * Buddy list export. |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
750 | ******************************************************************************/ |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
751 | |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
752 | static const gchar * ggp_roster_send_update_group_add( |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
753 | ggp_roster_content *content, PurpleGroup *group) |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
754 | { |
|
39491
0dfac00d800e
Replace g_snprintf+g_strdup by g_strdup_printf.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
755 | gchar *id; |
|
33320
f0ac6497f256
Gadu-Gadu: roster - fix synchronization for multiple gg accounts
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33319
diff
changeset
|
756 | const char *id_existing, *group_name; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
757 | PurpleXmlNode *group_node; |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
758 | gboolean succ = TRUE; |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
759 | |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35358
diff
changeset
|
760 | if (group) { |
|
33320
f0ac6497f256
Gadu-Gadu: roster - fix synchronization for multiple gg accounts
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33319
diff
changeset
|
761 | group_name = purple_group_get_name(group); |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
762 | id_existing = |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
763 | g_hash_table_lookup(content->group_ids, group_name); |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35358
diff
changeset
|
764 | } else |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
765 | id_existing = GGP_ROSTER_GROUPID_DEFAULT; |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
766 | if (id_existing) |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
767 | return id_existing; |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
768 | |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
769 | purple_debug_info("gg", "ggp_roster_send_update_group_add: adding %s\n", |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
770 | purple_group_get_name(group)); |
|
33320
f0ac6497f256
Gadu-Gadu: roster - fix synchronization for multiple gg accounts
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33319
diff
changeset
|
771 | |
|
39491
0dfac00d800e
Replace g_snprintf+g_strdup by g_strdup_printf.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
772 | id = purple_uuid_random(); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
773 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
774 | group_node = purple_xmlnode_new_child(content->groups_node, "Group"); |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
775 | succ &= ggp_xml_set_string(group_node, "Id", id); |
|
33320
f0ac6497f256
Gadu-Gadu: roster - fix synchronization for multiple gg accounts
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33319
diff
changeset
|
776 | succ &= ggp_xml_set_string(group_node, "Name", group_name); |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
777 | succ &= ggp_xml_set_string(group_node, "IsExpanded", "true"); |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
778 | succ &= ggp_xml_set_string(group_node, "IsRemovable", "true"); |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
779 | content->needs_update = TRUE; |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
780 | |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
781 | g_hash_table_insert(content->group_ids, g_strdup(group_name), |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
782 | g_strdup(id)); |
|
39491
0dfac00d800e
Replace g_snprintf+g_strdup by g_strdup_printf.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
783 | g_hash_table_replace(content->group_nodes, id, group_node); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
784 | |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
785 | g_return_val_if_fail(succ, NULL); |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
786 | |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
787 | return id; |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
788 | } |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
789 | |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
790 | static gboolean ggp_roster_send_update_contact_update(PurpleConnection *gc, |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
791 | ggp_roster_change *change) |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
792 | { |
|
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
793 | PurpleAccount *account = purple_connection_get_account(gc); |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
794 | ggp_roster_content *content = ggp_roster_get_rdata(gc)->content; |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
795 | uin_t uin = change->data.uin; |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
796 | PurpleBuddy *buddy; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
797 | PurpleXmlNode *buddy_node, *contact_groups; |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
798 | gboolean succ = TRUE; |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
799 | const char *group_id; |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
800 | |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
801 | g_return_val_if_fail(change->type == GGP_ROSTER_CHANGE_CONTACT_UPDATE, |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
802 | FALSE); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
803 | |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34723
diff
changeset
|
804 | buddy = purple_blist_find_buddy(account, ggp_uin_to_str(uin)); |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
805 | if (!buddy) |
|
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
806 | return TRUE; |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
807 | buddy_node = g_hash_table_lookup(content->contact_nodes, |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
808 | GINT_TO_POINTER(uin)); |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
809 | |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
810 | group_id = ggp_roster_send_update_group_add(content, |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
811 | ggp_purplew_buddy_get_group_only(buddy)); |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
812 | |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35358
diff
changeset
|
813 | if (buddy_node) { /* update existing */ |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
814 | purple_debug_misc("gg", "ggp_roster_send_update_contact_update:" |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
815 | " updating %u...\n", uin); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
816 | |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
817 | succ &= ggp_xml_set_string(buddy_node, "ShowName", |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
818 | purple_buddy_get_alias(buddy)); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
819 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
820 | contact_groups = purple_xmlnode_get_child(buddy_node, "Groups"); |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
821 | g_assert(contact_groups); |
|
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
822 | ggp_xmlnode_remove_children(contact_groups); |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
823 | succ &= ggp_xml_set_string(contact_groups, "GroupId", group_id); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
824 | |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
825 | g_return_val_if_fail(succ, FALSE); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
826 | |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
827 | return TRUE; |
|
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
828 | } |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
829 | |
|
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
830 | /* add new */ |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
831 | purple_debug_misc("gg", "ggp_roster_send_update_contact_update: " |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
832 | "adding %u...\n", uin); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
833 | buddy_node = purple_xmlnode_new_child(content->contacts_node, "Contact"); |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
834 | succ &= ggp_xml_set_string(buddy_node, "Guid", purple_uuid_random()); |
|
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
835 | succ &= ggp_xml_set_uint(buddy_node, "GGNumber", uin); |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
836 | succ &= ggp_xml_set_string(buddy_node, "ShowName", |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
837 | purple_buddy_get_alias(buddy)); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
838 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
839 | contact_groups = purple_xmlnode_new_child(buddy_node, "Groups"); |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
840 | g_assert(contact_groups); |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
841 | succ &= ggp_xml_set_string(contact_groups, "GroupId", group_id); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
842 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
843 | purple_xmlnode_new_child(buddy_node, "Avatars"); |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
844 | succ &= ggp_xml_set_bool(buddy_node, "FlagBuddy", TRUE); |
|
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
845 | succ &= ggp_xml_set_bool(buddy_node, "FlagNormal", TRUE); |
|
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
846 | succ &= ggp_xml_set_bool(buddy_node, "FlagFriend", TRUE); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
847 | |
|
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
848 | /* we don't use Guid, so update is not needed |
|
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
849 | * content->needs_update = TRUE; |
|
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
850 | */ |
|
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
851 | |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
852 | g_hash_table_insert(content->contact_nodes, GINT_TO_POINTER(uin), |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
853 | buddy_node); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
854 | |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
855 | g_return_val_if_fail(succ, FALSE); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
856 | |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
857 | return TRUE; |
|
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
858 | } |
|
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
859 | |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
860 | static gboolean ggp_roster_send_update_contact_remove(PurpleConnection *gc, |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
861 | ggp_roster_change *change) |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
862 | { |
|
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
863 | PurpleAccount *account = purple_connection_get_account(gc); |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
864 | ggp_roster_content *content = ggp_roster_get_rdata(gc)->content; |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
865 | uin_t uin = change->data.uin; |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
866 | PurpleBuddy *buddy; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
867 | PurpleXmlNode *buddy_node; |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
868 | |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
869 | g_return_val_if_fail(change->type == GGP_ROSTER_CHANGE_CONTACT_REMOVE, |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
870 | FALSE); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
871 | |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34723
diff
changeset
|
872 | buddy = purple_blist_find_buddy(account, ggp_uin_to_str(uin)); |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35358
diff
changeset
|
873 | if (buddy) { |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
874 | purple_debug_info("gg", "ggp_roster_send_update_contact_remove:" |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
875 | " contact %u re-added\n", uin); |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
876 | return TRUE; |
|
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
877 | } |
|
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
878 | |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
879 | buddy_node = g_hash_table_lookup(content->contact_nodes, |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
880 | GINT_TO_POINTER(uin)); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
881 | if (!buddy_node) /* already removed */ |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
882 | return TRUE; |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
883 | |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
884 | purple_debug_info("gg", "ggp_roster_send_update_contact_remove: " |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
885 | "removing %u\n", uin); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
886 | purple_xmlnode_free(buddy_node); |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
887 | g_hash_table_remove(content->contact_nodes, GINT_TO_POINTER(uin)); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
888 | |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
889 | return TRUE; |
|
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
890 | } |
|
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
891 | |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
892 | static gboolean ggp_roster_send_update_group_rename(PurpleConnection *gc, |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
893 | ggp_roster_change *change) |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
894 | { |
|
33324
103df11c3ff8
Gadu-Gadu: roster - default group rename
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33323
diff
changeset
|
895 | PurpleAccount *account = purple_connection_get_account(gc); |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
896 | ggp_roster_content *content = ggp_roster_get_rdata(gc)->content; |
|
33320
f0ac6497f256
Gadu-Gadu: roster - fix synchronization for multiple gg accounts
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33319
diff
changeset
|
897 | const char *old_name = change->data.group_rename.old_name; |
|
f0ac6497f256
Gadu-Gadu: roster - fix synchronization for multiple gg accounts
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33319
diff
changeset
|
898 | const char *new_name = change->data.group_rename.new_name; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
899 | PurpleXmlNode *group_node; |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
900 | const char *group_id; |
|
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
901 | |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
902 | g_return_val_if_fail(change->type == GGP_ROSTER_CHANGE_GROUP_RENAME, |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
903 | FALSE); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
904 | |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
905 | purple_debug_misc("gg", "ggp_roster_send_update_group_rename: " |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
906 | "\"%s\"->\"%s\"\n", old_name, new_name); |
|
33320
f0ac6497f256
Gadu-Gadu: roster - fix synchronization for multiple gg accounts
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33319
diff
changeset
|
907 | |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
908 | /* moving to or from default group instead of renaming it */ |
|
35958
1d8446f396b6
blist: define default group better
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35758
diff
changeset
|
909 | if (0 == g_strcmp0(old_name, PURPLE_BLIST_DEFAULT_GROUP_NAME) || |
|
1d8446f396b6
blist: define default group better
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35758
diff
changeset
|
910 | 0 == g_strcmp0(new_name, PURPLE_BLIST_DEFAULT_GROUP_NAME)) |
|
33320
f0ac6497f256
Gadu-Gadu: roster - fix synchronization for multiple gg accounts
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33319
diff
changeset
|
911 | { |
|
33324
103df11c3ff8
Gadu-Gadu: roster - default group rename
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33323
diff
changeset
|
912 | PurpleGroup *group; |
|
103df11c3ff8
Gadu-Gadu: roster - default group rename
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33323
diff
changeset
|
913 | GList *group_buddies; |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34723
diff
changeset
|
914 | group = purple_blist_find_group(new_name); |
|
33324
103df11c3ff8
Gadu-Gadu: roster - default group rename
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33323
diff
changeset
|
915 | if (!group) |
|
103df11c3ff8
Gadu-Gadu: roster - default group rename
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33323
diff
changeset
|
916 | return TRUE; |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
917 | purple_debug_info("gg", "ggp_roster_send_update_group_rename: " |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
918 | "invalidating buddies in default group\n"); |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
919 | group_buddies = ggp_purplew_group_get_buddies(group, account); |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35358
diff
changeset
|
920 | while (group_buddies) { |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
921 | ggp_roster_set_synchronized(gc, group_buddies->data, |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
922 | FALSE); |
|
35758
87c51487e197
Fix g_slist_remove_link misuse, remove debug printfs
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35629
diff
changeset
|
923 | group_buddies = g_list_delete_link(group_buddies, |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
924 | group_buddies); |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
925 | } |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
926 | return TRUE; |
|
33320
f0ac6497f256
Gadu-Gadu: roster - fix synchronization for multiple gg accounts
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33319
diff
changeset
|
927 | } |
|
f0ac6497f256
Gadu-Gadu: roster - fix synchronization for multiple gg accounts
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33319
diff
changeset
|
928 | group_id = g_hash_table_lookup(content->group_ids, old_name); |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35358
diff
changeset
|
929 | if (!group_id) { |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
930 | purple_debug_info("gg", "ggp_roster_send_update_group_rename: " |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
931 | "%s is not present at roster\n", old_name); |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
932 | return TRUE; |
|
33320
f0ac6497f256
Gadu-Gadu: roster - fix synchronization for multiple gg accounts
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33319
diff
changeset
|
933 | } |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
934 | |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
935 | group_node = g_hash_table_lookup(content->group_nodes, group_id); |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35358
diff
changeset
|
936 | if (!group_node) { |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
937 | purple_debug_error("gg", "ggp_roster_send_update_group_rename: " |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
938 | "node for %s not found, id=%s\n", old_name, group_id); |
|
33320
f0ac6497f256
Gadu-Gadu: roster - fix synchronization for multiple gg accounts
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33319
diff
changeset
|
939 | g_hash_table_remove(content->group_ids, old_name); |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
940 | return TRUE; |
|
33320
f0ac6497f256
Gadu-Gadu: roster - fix synchronization for multiple gg accounts
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33319
diff
changeset
|
941 | } |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
942 | |
|
33320
f0ac6497f256
Gadu-Gadu: roster - fix synchronization for multiple gg accounts
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33319
diff
changeset
|
943 | g_hash_table_remove(content->group_ids, old_name); |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
944 | g_hash_table_insert(content->group_ids, g_strdup(new_name), |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
945 | g_strdup(group_id)); |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
946 | g_hash_table_insert(content->group_nodes, g_strdup(group_id), |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
947 | group_node); |
|
33320
f0ac6497f256
Gadu-Gadu: roster - fix synchronization for multiple gg accounts
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33319
diff
changeset
|
948 | return ggp_xml_set_string(group_node, "Name", new_name); |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
949 | } |
|
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
950 | |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
951 | static void ggp_roster_send_update(PurpleConnection *gc) |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
952 | { |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
953 | GGPInfo *accdata = purple_connection_get_protocol_data(gc); |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
954 | ggp_roster_session_data *rdata = ggp_roster_get_rdata(gc); |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
955 | ggp_roster_content *content = rdata->content; |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
956 | GList *updates_it; |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
957 | gchar *str; |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
958 | int len; |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
959 | |
|
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
960 | /* an update is running now */ |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
961 | if (rdata->sent_updates) |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
962 | return; |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
963 | |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
964 | /* no pending updates found */ |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
965 | if (!rdata->pending_updates) |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
966 | return; |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
967 | |
|
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
968 | /* not initialized */ |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
969 | if (!content) |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
970 | return; |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
971 | |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
972 | purple_debug_info("gg", "ggp_roster_send_update: " |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
973 | "pending updates found\n"); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
974 | |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
975 | rdata->sent_updates = rdata->pending_updates; |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
976 | rdata->pending_updates = NULL; |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
977 | |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
978 | updates_it = g_list_first(rdata->sent_updates); |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35358
diff
changeset
|
979 | while (updates_it) { |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
980 | ggp_roster_change *change = updates_it->data; |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
981 | gboolean succ = FALSE; |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
982 | updates_it = g_list_next(updates_it); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
983 | |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
984 | if (change->type == GGP_ROSTER_CHANGE_CONTACT_UPDATE) |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
985 | succ = ggp_roster_send_update_contact_update(gc, |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
986 | change); |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
987 | else if (change->type == GGP_ROSTER_CHANGE_CONTACT_REMOVE) |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
988 | succ = ggp_roster_send_update_contact_remove(gc, |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
989 | change); |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
990 | else if (change->type == GGP_ROSTER_CHANGE_GROUP_RENAME) |
|
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
991 | succ = ggp_roster_send_update_group_rename(gc, change); |
|
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
992 | else |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
993 | purple_debug_fatal("gg", "ggp_roster_send_update: " |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
994 | "not handled\n"); |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
995 | g_return_if_fail(succ); |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
996 | } |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
997 | |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
998 | #if GGP_ROSTER_DEBUG |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
999 | ggp_roster_dump(content); |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
1000 | #endif |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
1001 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
1002 | str = purple_xmlnode_to_str(content->xml, &len); |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
1003 | gg_userlist100_request(accdata->session, GG_USERLIST100_PUT, |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
1004 | content->version, GG_USERLIST100_FORMAT_TYPE_GG100, str); |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
1005 | g_free(str); |
|
33314
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
1006 | } |
|
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
1007 | |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
1008 | static void ggp_roster_reply_ack(PurpleConnection *gc, uint32_t version) |
|
33314
57013b9e1a8e
Gadu-Gadu: roster - downloading
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
1009 | { |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
1010 | PurpleAccount *account = purple_connection_get_account(gc); |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
1011 | ggp_roster_session_data *rdata = ggp_roster_get_rdata(gc); |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
1012 | ggp_roster_content *content = rdata->content; |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
1013 | GList *updates_it; |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
1014 | |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
1015 | purple_debug_info("gg", "ggp_roster_reply_ack: version=%u\n", version); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
1016 | |
|
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
1017 | /* set synchronization flag for all buddies, that were updated at roster */ |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
1018 | updates_it = g_list_first(rdata->sent_updates); |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35358
diff
changeset
|
1019 | while (updates_it) { |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
1020 | ggp_roster_change *change = updates_it->data; |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
1021 | PurpleBuddy *buddy; |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
1022 | updates_it = g_list_next(updates_it); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
1023 | |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
1024 | if (change->type != GGP_ROSTER_CHANGE_CONTACT_UPDATE) |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
1025 | continue; |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
1026 | |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34723
diff
changeset
|
1027 | buddy = purple_blist_find_buddy(account, |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
1028 | ggp_uin_to_str(change->data.uin)); |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
1029 | if (buddy) |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
1030 | ggp_roster_set_synchronized(gc, buddy, TRUE); |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
1031 | } |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
1032 | |
|
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
1033 | /* we need to remove "synchronized" flag for all contacts, that have |
|
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
1034 | * beed modified between roster update start and now |
|
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
1035 | */ |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
1036 | updates_it = g_list_first(rdata->pending_updates); |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35358
diff
changeset
|
1037 | while (updates_it) { |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
1038 | ggp_roster_change *change = updates_it->data; |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
1039 | PurpleBuddy *buddy; |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
1040 | updates_it = g_list_next(updates_it); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
1041 | |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
1042 | if (change->type != GGP_ROSTER_CHANGE_CONTACT_UPDATE) |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
1043 | continue; |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
1044 | |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34723
diff
changeset
|
1045 | buddy = purple_blist_find_buddy(account, |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
1046 | ggp_uin_to_str(change->data.uin)); |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
1047 | if (buddy && ggp_roster_is_synchronized(buddy)) |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
1048 | ggp_roster_set_synchronized(gc, buddy, FALSE); |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
1049 | } |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
1050 | |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
1051 | g_list_free_full(rdata->sent_updates, ggp_roster_change_free); |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
1052 | rdata->sent_updates = NULL; |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
1053 | |
|
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
1054 | /* bump roster version or update it, if needed */ |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
1055 | g_return_if_fail(content != NULL); |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35358
diff
changeset
|
1056 | if (content->needs_update) { |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
1057 | ggp_roster_content_free(rdata->content); |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
1058 | rdata->content = NULL; |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
1059 | /* we have to wait for gg_event_userlist100_version |
|
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
1060 | * ggp_roster_request_update(gc); |
|
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
1061 | */ |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
1062 | } |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
1063 | else |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
1064 | content->version = version; |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
1065 | } |
|
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
1066 | |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
1067 | static void ggp_roster_reply_reject(PurpleConnection *gc, uint32_t version) |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
1068 | { |
|
33317
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
1069 | ggp_roster_session_data *rdata = ggp_roster_get_rdata(gc); |
|
ceebe795b644
Gadu-Gadu: roster - code cleanup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33316
diff
changeset
|
1070 | |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
1071 | purple_debug_info("gg", "ggp_roster_reply_reject: version=%u\n", |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
1072 | version); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
1073 | |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
1074 | g_return_if_fail(rdata->sent_updates); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
1075 | |
|
33326
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
1076 | rdata->pending_updates = g_list_concat(rdata->pending_updates, |
|
dbcdbdf2f02b
Gadu-Gadu: roster - tidying
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33325
diff
changeset
|
1077 | rdata->sent_updates); |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
1078 | rdata->sent_updates = NULL; |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34999
diff
changeset
|
1079 | |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
1080 | ggp_roster_content_free(rdata->content); |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
1081 | rdata->content = NULL; |
|
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
1082 | ggp_roster_request_update(gc); |
|
33315
42bbe5b85df8
Gadu-Gadu: roster - uploading/synchronization - part1
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33314
diff
changeset
|
1083 | } |
|
33318
636bfc28f2cf
Gadu-Gadu: roster - finally working
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33317
diff
changeset
|
1084 | |
|
33325
63bf52ec9e1e
Gadu-Gadu: roster - tidying. Fixes #9463
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33324
diff
changeset
|
1085 | /******************************************************************************/ |