Mercurial > pidgin
annotate libpurple/protocols/oscar/family_feedbag.c @ 32389:fac08a235b68
Make the oscar cleanlist function ensure that buddy comments and aliases
are valid utf8. If they're not, then we use purple_utf8_salvage()
to fix them and save the result in our server list.
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 12 Dec 2011 09:01:21 +0000 |
parents | 3a4fc19e168e |
children | 28b741b2fc1d |
rev | line source |
---|---|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 /* |
15822 | 2 * Purple's oscar protocol plugin |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3 * This file is the legal property of its developers. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
4 * Please see the AUTHORS file distributed alongside this file. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
5 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
6 * This library is free software; you can redistribute it and/or |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
7 * modify it under the terms of the GNU Lesser General Public |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
8 * License as published by the Free Software Foundation; either |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
9 * version 2 of the License, or (at your option) any later version. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
10 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
11 * This library is distributed in the hope that it will be useful, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
14 * Lesser General Public License for more details. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
15 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
16 * You should have received a copy of the GNU Lesser General Public |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
17 * License along with this library; if not, write to the Free Software |
19681
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19650
diff
changeset
|
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
19 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
20 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
21 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
22 * Family 0x0013 - Server-Side/Stored Information. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
23 * |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
24 * Deals with storing certain types of information, such as a user's buddy |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
25 * list, permit/deny list, and permit/deny preferences, on the server, so |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
26 * that they can be accessed from any client. |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
27 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
28 * We keep 2 copies of SSI data: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
29 * 1) An exact copy of what is stored on the AIM servers. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
30 * 2) A local copy that we make changes to, and then send diffs |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
31 * between this and the exact copy to keep them in sync. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
32 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
33 * All the "aim_ssi_itemlist_bleh" functions near the top just modify the list |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
34 * that is given to them (i.e. they don't send SNACs). |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
35 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
36 * The SNAC sending and receiving functions are lower down in the file, and |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
37 * they're simpler. They are in the order of the subtypes they deal with, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
38 * starting with the request rights function (subtype 0x0002), then parse |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
39 * rights (subtype 0x0003), then--well, you get the idea. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
40 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
41 * This is entirely too complicated. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
42 * You don't know the half of it. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
43 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
44 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
45 #include "oscar.h" |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
46 #include "oscarcommon.h" |
31154
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
47 #include "debug.h" |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
48 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
49 static int aim_ssi_addmoddel(OscarData *od); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
50 |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
51 static void aim_ssi_item_free(struct aim_ssi_item *item) |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
52 { |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
53 g_free(item->name); |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
54 aim_tlvlist_free(item->data); |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
55 g_free(item); |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
56 } |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
57 |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
58 static void aim_ssi_item_set_name(struct aim_ssi_itemlist *list, struct aim_ssi_item *item, const char *name) |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
59 { |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
60 gchar key[3000]; |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
61 |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
62 if (item->name) { |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
63 /* Remove old name from hash table */ |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
64 snprintf(key, sizeof(key), "%hx%s", item->type, oscar_normalize(NULL, item->name)); |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
65 g_hash_table_remove(list->idx_all_named_items, key); |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
66 } |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
67 |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
68 g_free(item->name); |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
69 item->name = g_strdup(name); |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
70 |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
71 if (name) { |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
72 /* Add new name to hash table */ |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
73 snprintf(key, sizeof(key), "%hx%s", item->type, oscar_normalize(NULL, item->name)); |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
74 g_hash_table_insert(list->idx_all_named_items, g_strdup(key), item); |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
75 } |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
76 } |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
77 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
78 /** |
31154
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
79 * List types based on http://dev.aol.com/aim/oscar/#FEEDBAG (archive.org) |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
80 * and http://iserverd.khstu.ru/oscar/ssi_item.html |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
81 * |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
82 * @param type The type of a list item as integer number, as provided by an aim_ssi_item struct. |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
83 * @return Returns the name of the item type as a character string. |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
84 */ |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
85 static const gchar* |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
86 aim_ssi_type_to_string(guint16 type) |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
87 { |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
88 struct TypeStringPair |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
89 { |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
90 guint16 type; |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
91 const gchar *string; |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
92 }; |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
93 static const struct TypeStringPair type_strings[] = { |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
94 { 0x0000, "Buddy" }, |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
95 { 0x0001, "Group" }, |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
96 { 0x0002, "Permit/Visible" }, |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
97 { 0x0003, "Deny/Invisible" }, |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
98 { 0x0004, "PDInfo" }, |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
99 { 0x0005, "PresencePrefs" }, |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
100 { 0x0006, "Non-Buddy Info" }, |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
101 { 0x0009, "ClientPrefs" }, |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
102 { 0x000e, "ICQDeny/Ignore" }, |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
103 { 0x0014, "Buddy Icon" }, |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
104 { 0x0015, "Recent Buddies" }, |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
105 { 0x0019, "Non-Buddy" }, |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
106 { 0x001d, "Vanity Info" }, |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
107 { 0x0020, "ICQ-MDir" }, |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
108 { 0x0029, "Facebook" }, |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
109 }; |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
110 int i; |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
111 for (i = 0; i < G_N_ELEMENTS(type_strings); i++) { |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
112 if (type_strings[i].type == type) { |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
113 return type_strings[i].string; |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
114 } |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
115 } |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
116 return "unknown"; |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
117 } |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
118 |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
119 /** For debug log output: Appends a line containing information about a given list item to a string. |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
120 * |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
121 * @param str String to which the line will be appended. |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
122 * @param prefix A string which will be prepended to the line. |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
123 * @param item List item from which information is extracted. |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
124 */ |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
125 static void |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
126 aim_ssi_item_debug_append(GString *str, char *prefix, struct aim_ssi_item *item) |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
127 { |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
128 g_string_append_printf(str, |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
129 "%s gid=0x%04hx, bid=0x%04hx, list_type=0x%04hx [%s], name=%s.\n", |
31667
17f7badf147e
oscar: Avoid a few printf("%s", NULL)s
Paul Aurich <paul@darkrain42.org>
parents:
31401
diff
changeset
|
130 prefix, item->gid, item->bid, item->type, aim_ssi_type_to_string(item->type), |
17f7badf147e
oscar: Avoid a few printf("%s", NULL)s
Paul Aurich <paul@darkrain42.org>
parents:
31401
diff
changeset
|
131 item->name ? item->name : "(null)"); |
31154
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
132 } |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
133 |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
134 /** |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
135 * Locally rebuild the 0x00c8 TLV in the additional data of the given group. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
136 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
137 * @param list A pointer to a pointer to the current list of items. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
138 * @param name A null terminated string containing the group name, or NULL |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
139 * if you want to modify the master group. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
140 * @return Return a pointer to the modified item. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
141 */ |
16279 | 142 static void |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
143 aim_ssi_itemlist_rebuildgroup(struct aim_ssi_itemlist *list, const char *name) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
144 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
145 int newlen; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
146 struct aim_ssi_item *cur, *group; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
147 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
148 /* Find the group */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
149 if (!(group = aim_ssi_itemlist_finditem(list, name, NULL, AIM_SSI_TYPE_GROUP))) |
16279 | 150 return; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
151 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
152 /* Find the length for the new additional data */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
153 newlen = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
154 if (group->gid == 0x0000) { |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
155 for (cur=list->data; cur; cur=cur->next) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
156 if ((cur->type == AIM_SSI_TYPE_GROUP) && (cur->gid != 0x0000)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
157 newlen += 2; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
158 } else { |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
159 for (cur=list->data; cur; cur=cur->next) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
160 if ((cur->gid == group->gid) && (cur->type == AIM_SSI_TYPE_BUDDY)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
161 newlen += 2; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
162 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
163 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
164 /* Build the new TLV list */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
165 if (newlen > 0) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
166 guint8 *newdata; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
167 |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
168 newdata = g_new(guint8, newlen); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
169 newlen = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
170 if (group->gid == 0x0000) { |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
171 for (cur=list->data; cur; cur=cur->next) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
172 if ((cur->type == AIM_SSI_TYPE_GROUP) && (cur->gid != 0x0000)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
173 newlen += aimutil_put16(newdata+newlen, cur->gid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
174 } else { |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
175 for (cur=list->data; cur; cur=cur->next) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
176 if ((cur->gid == group->gid) && (cur->type == AIM_SSI_TYPE_BUDDY)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
177 newlen += aimutil_put16(newdata+newlen, cur->bid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
178 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
179 aim_tlvlist_replace_raw(&group->data, 0x00c8, newlen, newdata); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
180 |
17191
1927f4ead3ca
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
16885
diff
changeset
|
181 g_free(newdata); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
182 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
183 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
184 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
185 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
186 * Locally add a new item to the given item list. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
187 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
188 * @param list A pointer to a pointer to the current list of items. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
189 * @param name A null terminated string of the name of the new item, or NULL if the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
190 * item should have no name. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
191 * @param gid The group ID# you want the new item to have, or 0xFFFF if we should pick something. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
192 * @param bid The buddy ID# you want the new item to have, or 0xFFFF if we should pick something. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
193 * @param type The type of the item, 0x0000 for a contact, 0x0001 for a group, etc. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
194 * @param data The additional data for the new item. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
195 * @return A pointer to the newly created item. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
196 */ |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
197 static struct aim_ssi_item *aim_ssi_itemlist_add(struct aim_ssi_itemlist *list, const char *name, guint16 gid, guint16 bid, guint16 type, GSList *data) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
198 { |
16468
79c5daa011a2
Clean up a wee bit of oscar code. No functionality change.
Mark Doliner <mark@kingant.net>
parents:
16307
diff
changeset
|
199 gboolean exists; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
200 struct aim_ssi_item *cur, *new; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
201 |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
202 new = g_new0(struct aim_ssi_item, 1); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
203 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
204 /* Set the group ID# and buddy ID# */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
205 new->gid = gid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
206 new->bid = bid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
207 if (type == AIM_SSI_TYPE_GROUP) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
208 if ((new->gid == 0xFFFF) && name) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
209 do { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
210 new->gid += 0x0001; |
16468
79c5daa011a2
Clean up a wee bit of oscar code. No functionality change.
Mark Doliner <mark@kingant.net>
parents:
16307
diff
changeset
|
211 exists = FALSE; |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
212 for (cur = list->data; cur != NULL; cur = cur->next) |
16307
9326d4cf5497
If anyone sees the "Unable to add buddy 1" message after
Mark Doliner <mark@kingant.net>
parents:
16306
diff
changeset
|
213 if ((cur->type == AIM_SSI_TYPE_GROUP) && (cur->gid == new->gid)) { |
16468
79c5daa011a2
Clean up a wee bit of oscar code. No functionality change.
Mark Doliner <mark@kingant.net>
parents:
16307
diff
changeset
|
214 exists = TRUE; |
16307
9326d4cf5497
If anyone sees the "Unable to add buddy 1" message after
Mark Doliner <mark@kingant.net>
parents:
16306
diff
changeset
|
215 break; |
9326d4cf5497
If anyone sees the "Unable to add buddy 1" message after
Mark Doliner <mark@kingant.net>
parents:
16306
diff
changeset
|
216 } |
16468
79c5daa011a2
Clean up a wee bit of oscar code. No functionality change.
Mark Doliner <mark@kingant.net>
parents:
16307
diff
changeset
|
217 } while (exists); |
16307
9326d4cf5497
If anyone sees the "Unable to add buddy 1" message after
Mark Doliner <mark@kingant.net>
parents:
16306
diff
changeset
|
218 } |
28290
c9d3bda6ef81
Fix some problems adding "stuff" to oscar buddy lists, where "stuff" is
Mark Doliner <mark@kingant.net>
parents:
28289
diff
changeset
|
219 } else if (new->gid == 0x0000) { |
c9d3bda6ef81
Fix some problems adding "stuff" to oscar buddy lists, where "stuff" is
Mark Doliner <mark@kingant.net>
parents:
28289
diff
changeset
|
220 /* |
c9d3bda6ef81
Fix some problems adding "stuff" to oscar buddy lists, where "stuff" is
Mark Doliner <mark@kingant.net>
parents:
28289
diff
changeset
|
221 * This is weird, but apparently items in the root group can't |
c9d3bda6ef81
Fix some problems adding "stuff" to oscar buddy lists, where "stuff" is
Mark Doliner <mark@kingant.net>
parents:
28289
diff
changeset
|
222 * have a buddy ID equal to any group ID. You'll get error |
c9d3bda6ef81
Fix some problems adding "stuff" to oscar buddy lists, where "stuff" is
Mark Doliner <mark@kingant.net>
parents:
28289
diff
changeset
|
223 * 0x0003 when trying to add, which is "item already exists" |
c9d3bda6ef81
Fix some problems adding "stuff" to oscar buddy lists, where "stuff" is
Mark Doliner <mark@kingant.net>
parents:
28289
diff
changeset
|
224 */ |
16307
9326d4cf5497
If anyone sees the "Unable to add buddy 1" message after
Mark Doliner <mark@kingant.net>
parents:
16306
diff
changeset
|
225 if (new->bid == 0xFFFF) { |
9326d4cf5497
If anyone sees the "Unable to add buddy 1" message after
Mark Doliner <mark@kingant.net>
parents:
16306
diff
changeset
|
226 do { |
9326d4cf5497
If anyone sees the "Unable to add buddy 1" message after
Mark Doliner <mark@kingant.net>
parents:
16306
diff
changeset
|
227 new->bid += 0x0001; |
16468
79c5daa011a2
Clean up a wee bit of oscar code. No functionality change.
Mark Doliner <mark@kingant.net>
parents:
16307
diff
changeset
|
228 exists = FALSE; |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
229 for (cur = list->data; cur != NULL; cur = cur->next) |
28290
c9d3bda6ef81
Fix some problems adding "stuff" to oscar buddy lists, where "stuff" is
Mark Doliner <mark@kingant.net>
parents:
28289
diff
changeset
|
230 if (cur->bid == new->bid || cur->gid == new->bid) { |
16468
79c5daa011a2
Clean up a wee bit of oscar code. No functionality change.
Mark Doliner <mark@kingant.net>
parents:
16307
diff
changeset
|
231 exists = TRUE; |
16307
9326d4cf5497
If anyone sees the "Unable to add buddy 1" message after
Mark Doliner <mark@kingant.net>
parents:
16306
diff
changeset
|
232 break; |
9326d4cf5497
If anyone sees the "Unable to add buddy 1" message after
Mark Doliner <mark@kingant.net>
parents:
16306
diff
changeset
|
233 } |
16468
79c5daa011a2
Clean up a wee bit of oscar code. No functionality change.
Mark Doliner <mark@kingant.net>
parents:
16307
diff
changeset
|
234 } while (exists); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
235 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
236 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
237 if (new->bid == 0xFFFF) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
238 do { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
239 new->bid += 0x0001; |
16468
79c5daa011a2
Clean up a wee bit of oscar code. No functionality change.
Mark Doliner <mark@kingant.net>
parents:
16307
diff
changeset
|
240 exists = FALSE; |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
241 for (cur = list->data; cur != NULL; cur = cur->next) |
28290
c9d3bda6ef81
Fix some problems adding "stuff" to oscar buddy lists, where "stuff" is
Mark Doliner <mark@kingant.net>
parents:
28289
diff
changeset
|
242 if (cur->bid == new->bid && cur->gid == new->gid) { |
16468
79c5daa011a2
Clean up a wee bit of oscar code. No functionality change.
Mark Doliner <mark@kingant.net>
parents:
16307
diff
changeset
|
243 exists = TRUE; |
16307
9326d4cf5497
If anyone sees the "Unable to add buddy 1" message after
Mark Doliner <mark@kingant.net>
parents:
16306
diff
changeset
|
244 break; |
9326d4cf5497
If anyone sees the "Unable to add buddy 1" message after
Mark Doliner <mark@kingant.net>
parents:
16306
diff
changeset
|
245 } |
16468
79c5daa011a2
Clean up a wee bit of oscar code. No functionality change.
Mark Doliner <mark@kingant.net>
parents:
16307
diff
changeset
|
246 } while (exists); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
247 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
248 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
249 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
250 /* Set the type */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
251 new->type = type; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
252 |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
253 /* Add it to the gid+bid hashtable */ |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
254 g_hash_table_insert(list->idx_gid_bid, GINT_TO_POINTER((new->gid << 16) + new->bid), new); |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
255 |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
256 /* Set the name - do this *AFTER* setting the type because type is used for the key */ |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
257 aim_ssi_item_set_name(list, new, name); |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
258 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
259 /* Set the TLV list */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
260 new->data = aim_tlvlist_copy(data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
261 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
262 /* Add the item to the list in the correct numerical position. Fancy, eh? */ |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
263 if (list->data) { |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
264 if ((new->gid < list->data->gid) || ((new->gid == list->data->gid) && (new->bid < list->data->bid))) { |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
265 new->next = list->data; |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
266 list->data = new; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
267 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
268 struct aim_ssi_item *prev; |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
269 for ((prev=list->data, cur=list->data->next); (cur && ((new->gid > cur->gid) || ((new->gid == cur->gid) && (new->bid > cur->bid)))); prev=cur, cur=cur->next); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
270 new->next = prev->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
271 prev->next = new; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
272 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
273 } else { |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
274 new->next = list->data; |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
275 list->data = new; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
276 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
277 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
278 return new; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
279 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
280 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
281 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
282 * Locally delete an item from the given item list. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
283 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
284 * @param list A pointer to a pointer to the current list of items. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
285 * @param del A pointer to the item you want to remove from the list. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
286 * @return Return 0 if no errors, otherwise return the error number. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
287 */ |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
288 static int aim_ssi_itemlist_del(struct aim_ssi_itemlist *list, struct aim_ssi_item *del) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
289 { |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
290 gchar key[3000]; |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
291 |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
292 if (!(list->data) || !del) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
293 return -EINVAL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
294 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
295 /* Remove the item from the list */ |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
296 if (list->data == del) { |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
297 list->data = list->data->next; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
298 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
299 struct aim_ssi_item *cur; |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
300 for (cur=list->data; (cur->next && (cur->next!=del)); cur=cur->next); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
301 if (cur->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
302 cur->next = del->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
303 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
304 |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
305 /* Remove from the hashtables */ |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
306 g_hash_table_remove(list->idx_gid_bid, GINT_TO_POINTER((del->gid << 16) + del->bid)); |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
307 |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
308 snprintf(key, sizeof(key), "%hx%s", del->type, oscar_normalize(NULL, del->name)); |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
309 g_hash_table_remove(list->idx_all_named_items, key); |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
310 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
311 /* Free the removed item */ |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
312 aim_ssi_item_free(del); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
313 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
314 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
315 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
316 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
317 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
318 * Compare two items to see if they have the same data. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
319 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
320 * @param cur1 A pointer to a pointer to the first item. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
321 * @param cur2 A pointer to a pointer to the second item. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
322 * @return Return 0 if no differences, or a number if there are differences. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
323 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
324 static int aim_ssi_itemlist_cmp(struct aim_ssi_item *cur1, struct aim_ssi_item *cur2) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
325 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
326 if (!cur1 || !cur2) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
327 return 1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
328 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
329 if (cur1->data && !cur2->data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
330 return 2; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
331 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
332 if (!cur1->data && cur2->data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
333 return 3; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
334 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
335 if ((cur1->data && cur2->data) && (aim_tlvlist_cmp(cur1->data, cur2->data))) |
16279 | 336 return 4; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
337 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
338 if (cur1->name && !cur2->name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
339 return 5; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
340 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
341 if (!cur1->name && cur2->name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
342 return 6; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
343 |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
344 if (cur1->name && cur2->name && oscar_util_name_compare(cur1->name, cur2->name)) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
345 return 7; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
346 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
347 if (cur1->gid != cur2->gid) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
348 return 8; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
349 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
350 if (cur1->bid != cur2->bid) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
351 return 9; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
352 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
353 if (cur1->type != cur2->type) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
354 return 10; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
355 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
356 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
357 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
358 |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
359 static gboolean aim_ssi_itemlist_valid(struct aim_ssi_itemlist *list, struct aim_ssi_item *item) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
360 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
361 struct aim_ssi_item *cur; |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
362 for (cur=list->data; cur; cur=cur->next) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
363 if (cur == item) |
16279 | 364 return TRUE; |
365 return FALSE; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
366 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
367 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
368 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
369 * Locally find an item given a group ID# and a buddy ID#. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
370 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
371 * @param list A pointer to the current list of items. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
372 * @param gid The group ID# of the desired item. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
373 * @param bid The buddy ID# of the desired item. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
374 * @return Return a pointer to the item if found, else return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
375 */ |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
376 struct aim_ssi_item *aim_ssi_itemlist_find(struct aim_ssi_itemlist *list, guint16 gid, guint16 bid) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
377 { |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
378 guint32 id_key = (gid << 16) + bid; |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
379 return g_hash_table_lookup(list->idx_gid_bid, GINT_TO_POINTER(id_key)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
380 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
381 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
382 /** |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
383 * Locally find an item given a group name, buddy name, and type. If group name |
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
384 * and buddy name are null, then just return the first item of the given type. |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
385 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
386 * @param list A pointer to the current list of items. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
387 * @param gn The group name of the desired item. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
388 * @param bn The buddy name of the desired item. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
389 * @param type The type of the desired item. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
390 * @return Return a pointer to the item if found, else return NULL. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
391 */ |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
392 struct aim_ssi_item *aim_ssi_itemlist_finditem(struct aim_ssi_itemlist *list, const char *gn, const char *bn, guint16 type) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
393 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
394 struct aim_ssi_item *cur; |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
395 gchar key[3000]; |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
396 |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
397 if (!list->data) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
398 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
399 |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
400 if (gn && bn) { /* For finding buddies in groups */ |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
401 g_return_val_if_fail(type == AIM_SSI_TYPE_BUDDY, NULL); |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
402 for (cur=list->data; cur; cur=cur->next) |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
403 if ((cur->type == type) && (cur->name) && !(oscar_util_name_compare(cur->name, bn))) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
404 struct aim_ssi_item *curg; |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
405 for (curg=list->data; curg; curg=curg->next) |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
406 if ((curg->type == AIM_SSI_TYPE_GROUP) && (curg->gid == cur->gid) && (curg->name) && !(oscar_util_name_compare(curg->name, gn))) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
407 return cur; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
408 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
409 |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
410 } else if (gn || bn) { /* For finding groups, permits, denies and ignores */ |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
411 snprintf(key, sizeof(key), "%hx%s", type, oscar_normalize(NULL, gn ? gn : bn)); |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
412 return g_hash_table_lookup(list->idx_all_named_items, key); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
413 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
414 /* For stuff without names--permit deny setting, visibility mask, etc. */ |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
415 } else for (cur=list->data; cur; cur=cur->next) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
416 if ((cur->type == type) && (!cur->name)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
417 return cur; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
418 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
419 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
420 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
421 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
422 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
423 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
424 * Check if the given buddy exists in any group in the buddy list. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
425 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
426 * @param list A pointer to the current list of items. |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
427 * @param bn The group name of the desired item. |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
428 * @return Return a pointer to the name of the item if found, else return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
429 */ |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
430 struct aim_ssi_item *aim_ssi_itemlist_exists(struct aim_ssi_itemlist *list, const char *bn) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
431 { |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
432 if (!bn) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
433 return NULL; |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
434 return aim_ssi_itemlist_finditem(list, NULL, bn, AIM_SSI_TYPE_BUDDY); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
435 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
436 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
437 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
438 * Locally find the parent item of the given buddy name. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
439 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
440 * @param list A pointer to the current list of items. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
441 * @param bn The buddy name of the desired item. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
442 * @return Return a pointer to the name of the item if found, else return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
443 */ |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
444 char *aim_ssi_itemlist_findparentname(struct aim_ssi_itemlist *list, const char *bn) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
445 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
446 struct aim_ssi_item *cur, *curg; |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
447 if (!list->data || !bn) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
448 return NULL; |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
449 if (!(cur = aim_ssi_itemlist_exists(list, bn))) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
450 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
451 if (!(curg = aim_ssi_itemlist_find(list, cur->gid, 0x0000))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
452 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
453 return curg->name; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
454 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
455 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
456 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
457 * Locally find the permit/deny setting item, and return the setting. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
458 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
459 * @param list A pointer to the current list of items. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
460 * @return Return the current SSI permit deny setting, or 0 if no setting was found. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
461 */ |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
462 int aim_ssi_getpermdeny(struct aim_ssi_itemlist *list) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
463 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
464 struct aim_ssi_item *cur = aim_ssi_itemlist_finditem(list, NULL, NULL, AIM_SSI_TYPE_PDINFO); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
465 if (cur) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
466 aim_tlv_t *tlv = aim_tlv_gettlv(cur->data, 0x00ca, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
467 if (tlv && tlv->value) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
468 return aimutil_get8(tlv->value); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
469 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
470 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
471 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
472 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
473 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
474 * Locally find the presence flag item, and return the setting. The returned setting is a |
28496
4bcf2acb90bd
oscar: The 0x00c9 TLV seems to be buddy preferences, not limited to visibility.
Paul Aurich <paul@darkrain42.org>
parents:
28495
diff
changeset
|
475 * bitmask of the preferences. See the AIM_SSI_PRESENCE_FLAG_* #defines in oscar.h. |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
476 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
477 * @param list A pointer to the current list of items. |
28496
4bcf2acb90bd
oscar: The 0x00c9 TLV seems to be buddy preferences, not limited to visibility.
Paul Aurich <paul@darkrain42.org>
parents:
28495
diff
changeset
|
478 * @return Return the current set of preferences. |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
479 */ |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
480 guint32 aim_ssi_getpresence(struct aim_ssi_itemlist *list) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
481 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
482 struct aim_ssi_item *cur = aim_ssi_itemlist_finditem(list, NULL, NULL, AIM_SSI_TYPE_PRESENCEPREFS); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
483 if (cur) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
484 aim_tlv_t *tlv = aim_tlv_gettlv(cur->data, 0x00c9, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
485 if (tlv && tlv->length) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
486 return aimutil_get32(tlv->value); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
487 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
488 return 0xFFFFFFFF; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
489 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
490 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
491 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
492 * Locally find the alias of the given buddy. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
493 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
494 * @param list A pointer to the current list of items. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
495 * @param gn The group of the buddy. |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
496 * @param bn The name of the buddy. |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
497 * @return A pointer to a NULL terminated string that is the buddy's |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
498 * alias, or NULL if the buddy has no alias. You should free |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
499 * this returned value! |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
500 */ |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
501 char *aim_ssi_getalias(struct aim_ssi_itemlist *list, const char *gn, const char *bn) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
502 { |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
503 struct aim_ssi_item *item = aim_ssi_itemlist_finditem(list, gn, bn, AIM_SSI_TYPE_BUDDY); |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
504 if (item) { |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
505 return aim_ssi_getalias_from_item(item); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
506 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
507 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
508 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
509 |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
510 char *aim_ssi_getalias_from_item(struct aim_ssi_item *item) |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
511 { |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
512 aim_tlv_t *tlv = aim_tlv_gettlv(item->data, 0x0131, 1); |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
513 if (tlv && tlv->length) |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
514 return g_strndup((const gchar *)tlv->value, tlv->length); |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
515 return NULL; |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
516 } |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
517 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
518 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
519 * Locally find the comment of the given buddy. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
520 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
521 * @param list A pointer to the current list of items. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
522 * @param gn The group of the buddy. |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
523 * @param bn The name of the buddy. |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
524 * @return A pointer to a NULL terminated string that is the buddy's |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
525 * comment, or NULL if the buddy has no comment. You should free |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
526 * this returned value! |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
527 */ |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
528 char *aim_ssi_getcomment(struct aim_ssi_itemlist *list, const char *gn, const char *bn) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
529 { |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
530 struct aim_ssi_item *cur = aim_ssi_itemlist_finditem(list, gn, bn, AIM_SSI_TYPE_BUDDY); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
531 if (cur) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
532 aim_tlv_t *tlv = aim_tlv_gettlv(cur->data, 0x013c, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
533 if (tlv && tlv->length) { |
16279 | 534 return g_strndup((const gchar *)tlv->value, tlv->length); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
535 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
536 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
537 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
538 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
539 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
540 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
541 * Locally find if you are waiting for authorization for a buddy. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
542 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
543 * @param list A pointer to the current list of items. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
544 * @param gn The group of the buddy. |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
545 * @param bn The name of the buddy. |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
546 * @return 1 if you are waiting for authorization; 0 if you are not |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
547 */ |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
548 gboolean aim_ssi_waitingforauth(struct aim_ssi_itemlist *list, const char *gn, const char *bn) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
549 { |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
550 struct aim_ssi_item *cur = aim_ssi_itemlist_finditem(list, gn, bn, AIM_SSI_TYPE_BUDDY); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
551 if (cur) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
552 if (aim_tlv_gettlv(cur->data, 0x0066, 1)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
553 return TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
554 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
555 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
556 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
557 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
558 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
559 * If there are changes, then create temporary items and |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
560 * call addmoddel. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
561 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
562 * @param od The oscar session. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
563 * @return Return 0 if no errors, otherwise return the error number. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
564 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
565 static int aim_ssi_sync(OscarData *od) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
566 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
567 struct aim_ssi_item *cur1, *cur2; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
568 struct aim_ssi_tmp *cur, *new; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
569 int n = 0; |
31154
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
570 GString *debugstr = g_string_new(""); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
571 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
572 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
573 * The variable "n" is used to limit the number of addmoddel's that |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
574 * are performed in a single SNAC. It will hopefully keep the size |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
575 * of the SNAC below the maximum SNAC size. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
576 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
577 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
578 if (!od) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
579 return -EINVAL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
580 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
581 /* If we're waiting for an ack, we shouldn't do anything else */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
582 if (od->ssi.waiting_for_ack) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
583 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
584 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
585 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
586 * Compare the 2 lists and create an aim_ssi_tmp for each difference. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
587 * We should only send either additions, modifications, or deletions |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
588 * before waiting for an acknowledgement. So first do deletions, then |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
589 * additions, then modifications. Also, both the official and the local |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
590 * list should be in ascending numerical order for the group ID#s and the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
591 * buddy ID#s, which makes things more efficient. I think. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
592 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
593 |
19650
c6f1f9971c4a
When doing oscar server-side list management, do deletions before
Mark Doliner <mark@kingant.net>
parents:
18755
diff
changeset
|
594 /* Deletions */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
595 if (!od->ssi.pending) { |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
596 for (cur1=od->ssi.official.data; cur1 && (n < 15); cur1=cur1->next) { |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
597 if (!aim_ssi_itemlist_find(&od->ssi.local, cur1->gid, cur1->bid)) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
598 n++; |
21742
98514870b73c
g_strdup() is awesome. 11 insertions(+), 35 deletions(-)
Mark Doliner <mark@kingant.net>
parents:
20229
diff
changeset
|
599 new = g_new(struct aim_ssi_tmp, 1); |
19650
c6f1f9971c4a
When doing oscar server-side list management, do deletions before
Mark Doliner <mark@kingant.net>
parents:
18755
diff
changeset
|
600 new->action = SNAC_SUBTYPE_FEEDBAG_DEL; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
601 new->ack = 0xffff; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
602 new->name = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
603 new->item = cur1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
604 new->next = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
605 if (od->ssi.pending) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
606 for (cur=od->ssi.pending; cur->next; cur=cur->next); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
607 cur->next = new; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
608 } else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
609 od->ssi.pending = new; |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
610 aim_ssi_item_debug_append(debugstr, "Deleting item ", cur1); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
611 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
612 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
613 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
614 |
19650
c6f1f9971c4a
When doing oscar server-side list management, do deletions before
Mark Doliner <mark@kingant.net>
parents:
18755
diff
changeset
|
615 /* Additions */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
616 if (!od->ssi.pending) { |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
617 for (cur1=od->ssi.local.data; cur1 && (n < 15); cur1=cur1->next) { |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
618 if (!aim_ssi_itemlist_find(&od->ssi.official, cur1->gid, cur1->bid)) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
619 n++; |
21742
98514870b73c
g_strdup() is awesome. 11 insertions(+), 35 deletions(-)
Mark Doliner <mark@kingant.net>
parents:
20229
diff
changeset
|
620 new = g_new(struct aim_ssi_tmp, 1); |
19650
c6f1f9971c4a
When doing oscar server-side list management, do deletions before
Mark Doliner <mark@kingant.net>
parents:
18755
diff
changeset
|
621 new->action = SNAC_SUBTYPE_FEEDBAG_ADD; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
622 new->ack = 0xffff; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
623 new->name = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
624 new->item = cur1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
625 new->next = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
626 if (od->ssi.pending) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
627 for (cur=od->ssi.pending; cur->next; cur=cur->next); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
628 cur->next = new; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
629 } else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
630 od->ssi.pending = new; |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
631 aim_ssi_item_debug_append(debugstr, "Adding item ", cur1); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
632 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
633 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
634 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
635 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
636 /* Modifications */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
637 if (!od->ssi.pending) { |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
638 for (cur1=od->ssi.local.data; cur1 && (n < 15); cur1=cur1->next) { |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
639 cur2 = aim_ssi_itemlist_find(&od->ssi.official, cur1->gid, cur1->bid); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
640 if (cur2 && (aim_ssi_itemlist_cmp(cur1, cur2))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
641 n++; |
21742
98514870b73c
g_strdup() is awesome. 11 insertions(+), 35 deletions(-)
Mark Doliner <mark@kingant.net>
parents:
20229
diff
changeset
|
642 new = g_new(struct aim_ssi_tmp, 1); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
643 new->action = SNAC_SUBTYPE_FEEDBAG_MOD; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
644 new->ack = 0xffff; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
645 new->name = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
646 new->item = cur1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
647 new->next = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
648 if (od->ssi.pending) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
649 for (cur=od->ssi.pending; cur->next; cur=cur->next); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
650 cur->next = new; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
651 } else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
652 od->ssi.pending = new; |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
653 aim_ssi_item_debug_append(debugstr, "Modifying item ", cur1); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
654 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
655 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
656 } |
31154
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
657 if (debugstr->len > 0) { |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
658 purple_debug_info("oscar", "%s", debugstr->str); |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
659 if (purple_debug_is_verbose()) { |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
660 g_string_truncate(debugstr, 0); |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
661 for (cur1 = od->ssi.local.data; cur1; cur1 = cur1->next) |
31154
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
662 aim_ssi_item_debug_append(debugstr, "\t", cur1); |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
663 purple_debug_misc("oscar", "Dumping item list of account %s:\n%s", |
32245
f75041cb3fec
Convert libpurple and protocol prpl's to use the purple_account_* accessor functions.
andrew.victor@mxit.com
parents:
31905
diff
changeset
|
664 purple_account_get_username(purple_connection_get_account(od->gc)), debugstr->str); |
31154
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
665 } |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
666 } |
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
667 g_string_free(debugstr, TRUE); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
668 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
669 /* We're out of stuff to do, so tell the AIM servers we're done and exit */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
670 if (!od->ssi.pending) { |
16306
6a974950d2a8
Don't send a "transaction end" if we haven't sent a "transaction begin"
Mark Doliner <mark@kingant.net>
parents:
16297
diff
changeset
|
671 if (od->ssi.in_transaction) { |
6a974950d2a8
Don't send a "transaction end" if we haven't sent a "transaction begin"
Mark Doliner <mark@kingant.net>
parents:
16297
diff
changeset
|
672 aim_ssi_modend(od); |
6a974950d2a8
Don't send a "transaction end" if we haven't sent a "transaction begin"
Mark Doliner <mark@kingant.net>
parents:
16297
diff
changeset
|
673 od->ssi.in_transaction = FALSE; |
6a974950d2a8
Don't send a "transaction end" if we haven't sent a "transaction begin"
Mark Doliner <mark@kingant.net>
parents:
16297
diff
changeset
|
674 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
675 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
676 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
677 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
678 /* If this is the first in a series of add/mod/del |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
679 * requests then send the "begin transaction" message. */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
680 if (!od->ssi.in_transaction) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
681 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
682 aim_ssi_modbegin(od); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
683 od->ssi.in_transaction = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
684 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
685 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
686 /* Make sure we don't send anything else between now |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
687 * and when we receive the ack for the following operation */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
688 od->ssi.waiting_for_ack = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
689 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
690 /* Now go mail off our data and wait 4 to 6 weeks */ |
16885
0a3ae69a25ea
Similarly, aim_ssi_sync() should return the success value of its determining function, aim_ssi_addmoddel()
Evan Schoenberg <evan.s@dreskin.net>
parents:
16884
diff
changeset
|
691 return aim_ssi_addmoddel(od);; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
692 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
693 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
694 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
695 * Free all SSI data. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
696 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
697 * This doesn't remove it from the server, that's different. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
698 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
699 * @param od The oscar odion. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
700 * @return Return 0 if no errors, otherwise return the error number. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
701 */ |
16279 | 702 static void |
703 aim_ssi_freelist(OscarData *od) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
704 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
705 struct aim_ssi_item *cur, *del; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
706 struct aim_ssi_tmp *curtmp, *deltmp; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
707 |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
708 cur = od->ssi.official.data; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
709 while (cur) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
710 del = cur; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
711 cur = cur->next; |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
712 aim_ssi_item_free(del); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
713 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
714 |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
715 cur = od->ssi.local.data; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
716 while (cur) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
717 del = cur; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
718 cur = cur->next; |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
719 aim_ssi_item_free(del); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
720 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
721 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
722 curtmp = od->ssi.pending; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
723 while (curtmp) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
724 deltmp = curtmp; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
725 curtmp = curtmp->next; |
17191
1927f4ead3ca
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
16885
diff
changeset
|
726 g_free(deltmp); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
727 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
728 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
729 od->ssi.numitems = 0; |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
730 od->ssi.official.data = NULL; |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
731 od->ssi.local.data = NULL; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
732 od->ssi.pending = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
733 od->ssi.timestamp = (time_t)0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
734 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
735 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
736 /** |
32389
fac08a235b68
Make the oscar cleanlist function ensure that buddy comments and aliases
Mark Doliner <mark@kingant.net>
parents:
32388
diff
changeset
|
737 * Look up the given TLV type in the item's data. If the value of |
fac08a235b68
Make the oscar cleanlist function ensure that buddy comments and aliases
Mark Doliner <mark@kingant.net>
parents:
32388
diff
changeset
|
738 * the TLV is not a valid UTF-8 string then use purple_utf8_salvage() |
fac08a235b68
Make the oscar cleanlist function ensure that buddy comments and aliases
Mark Doliner <mark@kingant.net>
parents:
32388
diff
changeset
|
739 * to replace invalid bytes with question marks. |
fac08a235b68
Make the oscar cleanlist function ensure that buddy comments and aliases
Mark Doliner <mark@kingant.net>
parents:
32388
diff
changeset
|
740 */ |
fac08a235b68
Make the oscar cleanlist function ensure that buddy comments and aliases
Mark Doliner <mark@kingant.net>
parents:
32388
diff
changeset
|
741 static void cleanlist_ensure_utf8_data(struct aim_ssi_item *item, guint16 tlvtype) |
fac08a235b68
Make the oscar cleanlist function ensure that buddy comments and aliases
Mark Doliner <mark@kingant.net>
parents:
32388
diff
changeset
|
742 { |
fac08a235b68
Make the oscar cleanlist function ensure that buddy comments and aliases
Mark Doliner <mark@kingant.net>
parents:
32388
diff
changeset
|
743 aim_tlv_t *tlv; |
fac08a235b68
Make the oscar cleanlist function ensure that buddy comments and aliases
Mark Doliner <mark@kingant.net>
parents:
32388
diff
changeset
|
744 gchar *value, *salvaged; |
fac08a235b68
Make the oscar cleanlist function ensure that buddy comments and aliases
Mark Doliner <mark@kingant.net>
parents:
32388
diff
changeset
|
745 |
fac08a235b68
Make the oscar cleanlist function ensure that buddy comments and aliases
Mark Doliner <mark@kingant.net>
parents:
32388
diff
changeset
|
746 tlv = aim_tlv_gettlv(item->data, tlvtype, 1); |
fac08a235b68
Make the oscar cleanlist function ensure that buddy comments and aliases
Mark Doliner <mark@kingant.net>
parents:
32388
diff
changeset
|
747 if (tlv && tlv->length && !g_utf8_validate((const gchar *)tlv->value, tlv->length, NULL)) { |
fac08a235b68
Make the oscar cleanlist function ensure that buddy comments and aliases
Mark Doliner <mark@kingant.net>
parents:
32388
diff
changeset
|
748 purple_debug_warning("oscar", "cleanlist found invalid UTF-8 " |
fac08a235b68
Make the oscar cleanlist function ensure that buddy comments and aliases
Mark Doliner <mark@kingant.net>
parents:
32388
diff
changeset
|
749 "for 0x%04hx field of 0x%04hx item with name %s. " |
fac08a235b68
Make the oscar cleanlist function ensure that buddy comments and aliases
Mark Doliner <mark@kingant.net>
parents:
32388
diff
changeset
|
750 "Attempting to repair.\n", |
fac08a235b68
Make the oscar cleanlist function ensure that buddy comments and aliases
Mark Doliner <mark@kingant.net>
parents:
32388
diff
changeset
|
751 tlvtype, item->type, item->name ? item->name : "(null)"); |
fac08a235b68
Make the oscar cleanlist function ensure that buddy comments and aliases
Mark Doliner <mark@kingant.net>
parents:
32388
diff
changeset
|
752 value = g_strndup((const gchar *)tlv->value, tlv->length); |
fac08a235b68
Make the oscar cleanlist function ensure that buddy comments and aliases
Mark Doliner <mark@kingant.net>
parents:
32388
diff
changeset
|
753 salvaged = purple_utf8_salvage(value); |
fac08a235b68
Make the oscar cleanlist function ensure that buddy comments and aliases
Mark Doliner <mark@kingant.net>
parents:
32388
diff
changeset
|
754 g_free(value); |
fac08a235b68
Make the oscar cleanlist function ensure that buddy comments and aliases
Mark Doliner <mark@kingant.net>
parents:
32388
diff
changeset
|
755 if (*salvaged) |
fac08a235b68
Make the oscar cleanlist function ensure that buddy comments and aliases
Mark Doliner <mark@kingant.net>
parents:
32388
diff
changeset
|
756 aim_tlvlist_replace_str(&item->data, tlvtype, salvaged); |
fac08a235b68
Make the oscar cleanlist function ensure that buddy comments and aliases
Mark Doliner <mark@kingant.net>
parents:
32388
diff
changeset
|
757 else |
fac08a235b68
Make the oscar cleanlist function ensure that buddy comments and aliases
Mark Doliner <mark@kingant.net>
parents:
32388
diff
changeset
|
758 aim_tlvlist_remove(&item->data, tlvtype); |
fac08a235b68
Make the oscar cleanlist function ensure that buddy comments and aliases
Mark Doliner <mark@kingant.net>
parents:
32388
diff
changeset
|
759 g_free(salvaged); |
fac08a235b68
Make the oscar cleanlist function ensure that buddy comments and aliases
Mark Doliner <mark@kingant.net>
parents:
32388
diff
changeset
|
760 } |
fac08a235b68
Make the oscar cleanlist function ensure that buddy comments and aliases
Mark Doliner <mark@kingant.net>
parents:
32388
diff
changeset
|
761 } |
fac08a235b68
Make the oscar cleanlist function ensure that buddy comments and aliases
Mark Doliner <mark@kingant.net>
parents:
32388
diff
changeset
|
762 |
fac08a235b68
Make the oscar cleanlist function ensure that buddy comments and aliases
Mark Doliner <mark@kingant.net>
parents:
32388
diff
changeset
|
763 /** |
fac08a235b68
Make the oscar cleanlist function ensure that buddy comments and aliases
Mark Doliner <mark@kingant.net>
parents:
32388
diff
changeset
|
764 * This "cleans" the ssi list. It does things like: |
fac08a235b68
Make the oscar cleanlist function ensure that buddy comments and aliases
Mark Doliner <mark@kingant.net>
parents:
32388
diff
changeset
|
765 * - Makes sure all buddies, permits, and denies have names |
fac08a235b68
Make the oscar cleanlist function ensure that buddy comments and aliases
Mark Doliner <mark@kingant.net>
parents:
32388
diff
changeset
|
766 * - Makes sure all buddies are in a group that exist |
fac08a235b68
Make the oscar cleanlist function ensure that buddy comments and aliases
Mark Doliner <mark@kingant.net>
parents:
32388
diff
changeset
|
767 * - Makes sure strings are valid UTF-8 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
768 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
769 * @param od The oscar odion. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
770 * @return Return 0 if no errors, otherwise return the error number. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
771 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
772 int aim_ssi_cleanlist(OscarData *od) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
773 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
774 struct aim_ssi_item *cur, *next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
775 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
776 if (!od) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
777 return -EINVAL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
778 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
779 /* Delete any buddies, permits, or denies with empty names. */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
780 /* If there are any buddies directly in the master group, add them to a real group. */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
781 /* DESTROY any buddies that are directly in the master group. */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
782 /* Do the same for buddies that are in a non-existant group. */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
783 /* This will kind of mess up if you hit the item limit, but this function isn't too critical */ |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
784 cur = od->ssi.local.data; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
785 while (cur) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
786 next = cur->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
787 if (!cur->name) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
788 if (cur->type == AIM_SSI_TYPE_BUDDY) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
789 aim_ssi_delbuddy(od, NULL, NULL); |
30372
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
30367
diff
changeset
|
790 else if (cur->type == AIM_SSI_TYPE_PERMIT || cur->type == AIM_SSI_TYPE_DENY || cur->type == AIM_SSI_TYPE_ICQDENY) |
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
30367
diff
changeset
|
791 aim_ssi_del_from_private_list(od, NULL, cur->type); |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
792 } else if ((cur->type == AIM_SSI_TYPE_BUDDY) && ((cur->gid == 0x0000) || (!aim_ssi_itemlist_find(&od->ssi.local, cur->gid, 0x0000)))) { |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
793 char *alias = aim_ssi_getalias(&od->ssi.local, NULL, cur->name); |
32387
d0dba386ca0a
If we encounter a buddy not in a group, or in a group with an invalid
Mark Doliner <mark@kingant.net>
parents:
32384
diff
changeset
|
794 aim_ssi_addbuddy(od, cur->name, _("Buddies"), NULL, alias, NULL, NULL, FALSE); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
795 aim_ssi_delbuddy(od, cur->name, NULL); |
17191
1927f4ead3ca
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
16885
diff
changeset
|
796 g_free(alias); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
797 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
798 cur = next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
799 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
800 |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
801 cur = od->ssi.local.data; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
802 while (cur) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
803 if ((cur->type == AIM_SSI_TYPE_BUDDY) || (cur->type == AIM_SSI_TYPE_PERMIT) || (cur->type == AIM_SSI_TYPE_DENY)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
804 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
805 struct aim_ssi_item *cur2, *next2; |
32388
3a4fc19e168e
Cleanup the formatting of this code a little. No functionality change.
Mark Doliner <mark@kingant.net>
parents:
32387
diff
changeset
|
806 |
3a4fc19e168e
Cleanup the formatting of this code a little. No functionality change.
Mark Doliner <mark@kingant.net>
parents:
32387
diff
changeset
|
807 /* Make sure there aren't any duplicate permits or denies, or |
3a4fc19e168e
Cleanup the formatting of this code a little. No functionality change.
Mark Doliner <mark@kingant.net>
parents:
32387
diff
changeset
|
808 duplicate buddies within a group */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
809 cur2 = cur->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
810 while (cur2) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
811 next2 = cur2->next; |
32388
3a4fc19e168e
Cleanup the formatting of this code a little. No functionality change.
Mark Doliner <mark@kingant.net>
parents:
32387
diff
changeset
|
812 if (cur->type == cur2->type |
3a4fc19e168e
Cleanup the formatting of this code a little. No functionality change.
Mark Doliner <mark@kingant.net>
parents:
32387
diff
changeset
|
813 && cur->gid == cur2->gid |
3a4fc19e168e
Cleanup the formatting of this code a little. No functionality change.
Mark Doliner <mark@kingant.net>
parents:
32387
diff
changeset
|
814 && cur->name |
3a4fc19e168e
Cleanup the formatting of this code a little. No functionality change.
Mark Doliner <mark@kingant.net>
parents:
32387
diff
changeset
|
815 && cur2->name |
3a4fc19e168e
Cleanup the formatting of this code a little. No functionality change.
Mark Doliner <mark@kingant.net>
parents:
32387
diff
changeset
|
816 && !oscar_util_name_compare(cur->name, cur2->name)) |
3a4fc19e168e
Cleanup the formatting of this code a little. No functionality change.
Mark Doliner <mark@kingant.net>
parents:
32387
diff
changeset
|
817 { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
818 aim_ssi_itemlist_del(&od->ssi.local, cur2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
819 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
820 cur2 = next2; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
821 } |
32389
fac08a235b68
Make the oscar cleanlist function ensure that buddy comments and aliases
Mark Doliner <mark@kingant.net>
parents:
32388
diff
changeset
|
822 |
fac08a235b68
Make the oscar cleanlist function ensure that buddy comments and aliases
Mark Doliner <mark@kingant.net>
parents:
32388
diff
changeset
|
823 /* Make sure alias is valid UTF-8 */ |
fac08a235b68
Make the oscar cleanlist function ensure that buddy comments and aliases
Mark Doliner <mark@kingant.net>
parents:
32388
diff
changeset
|
824 cleanlist_ensure_utf8_data(cur, 0x0131); |
fac08a235b68
Make the oscar cleanlist function ensure that buddy comments and aliases
Mark Doliner <mark@kingant.net>
parents:
32388
diff
changeset
|
825 |
fac08a235b68
Make the oscar cleanlist function ensure that buddy comments and aliases
Mark Doliner <mark@kingant.net>
parents:
32388
diff
changeset
|
826 /* Make sure comment is valid UTF-8 */ |
fac08a235b68
Make the oscar cleanlist function ensure that buddy comments and aliases
Mark Doliner <mark@kingant.net>
parents:
32388
diff
changeset
|
827 cleanlist_ensure_utf8_data(cur, 0x013c); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
828 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
829 cur = cur->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
830 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
831 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
832 /* If we've made any changes then sync our list with the server's */ |
16884
58f58027608e
It is more useful for these aim_ssi methods to return a real value (the result of aim_ssi_sync()) than to always return 0 regardless of their success or failure
Evan Schoenberg <evan.s@dreskin.net>
parents:
16807
diff
changeset
|
833 return aim_ssi_sync(od); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
834 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
835 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
836 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
837 * Add a buddy to the list. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
838 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
839 * @param od The oscar odion. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
840 * @param name The name of the item. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
841 * @param group The group of the item. |
17370
0db74191adbb
Clean up some other ssi-related things. This commit and my last one
Mark Doliner <mark@kingant.net>
parents:
17369
diff
changeset
|
842 * @param data A TLV list to use as the additional data for this item. |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
843 * @param alias The alias/nickname of the item, or NULL. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
844 * @param comment The buddy comment for the item, or NULL. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
845 * @param smsnum The locally assigned SMS number, or NULL. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
846 * @return Return 0 if no errors, otherwise return the error number. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
847 */ |
17370
0db74191adbb
Clean up some other ssi-related things. This commit and my last one
Mark Doliner <mark@kingant.net>
parents:
17369
diff
changeset
|
848 int aim_ssi_addbuddy(OscarData *od, const char *name, const char *group, GSList *data, const char *alias, const char *comment, const char *smsnum, gboolean needauth) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
849 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
850 struct aim_ssi_item *parent; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
851 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
852 if (!od || !name || !group) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
853 return -EINVAL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
854 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
855 /* Find the parent */ |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
856 if (!(parent = aim_ssi_itemlist_finditem(&od->ssi.local, group, NULL, AIM_SSI_TYPE_GROUP))) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
857 /* Find the parent's parent (the master group) */ |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
858 if (aim_ssi_itemlist_find(&od->ssi.local, 0x0000, 0x0000) == NULL) |
16278
70a368273778
Fix that pesky ICQ "Unable to add buddy 1" error. Basically we were
Mark Doliner <mark@kingant.net>
parents:
15822
diff
changeset
|
859 aim_ssi_itemlist_add(&od->ssi.local, NULL, 0x0000, 0x0000, AIM_SSI_TYPE_GROUP, NULL); |
70a368273778
Fix that pesky ICQ "Unable to add buddy 1" error. Basically we were
Mark Doliner <mark@kingant.net>
parents:
15822
diff
changeset
|
860 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
861 /* Add the parent */ |
16279 | 862 parent = aim_ssi_itemlist_add(&od->ssi.local, group, 0xFFFF, 0x0000, AIM_SSI_TYPE_GROUP, NULL); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
863 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
864 /* Modify the parent's parent (the master group) */ |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
865 aim_ssi_itemlist_rebuildgroup(&od->ssi.local, NULL); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
866 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
867 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
868 /* Create a TLV list for the new buddy */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
869 if (needauth) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
870 aim_tlvlist_add_noval(&data, 0x0066); |
17370
0db74191adbb
Clean up some other ssi-related things. This commit and my last one
Mark Doliner <mark@kingant.net>
parents:
17369
diff
changeset
|
871 if (alias != NULL) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
872 aim_tlvlist_add_str(&data, 0x0131, alias); |
17370
0db74191adbb
Clean up some other ssi-related things. This commit and my last one
Mark Doliner <mark@kingant.net>
parents:
17369
diff
changeset
|
873 if (smsnum != NULL) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
874 aim_tlvlist_add_str(&data, 0x013a, smsnum); |
17370
0db74191adbb
Clean up some other ssi-related things. This commit and my last one
Mark Doliner <mark@kingant.net>
parents:
17369
diff
changeset
|
875 if (comment != NULL) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
876 aim_tlvlist_add_str(&data, 0x013c, comment); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
877 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
878 /* Add that bad boy */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
879 aim_ssi_itemlist_add(&od->ssi.local, name, parent->gid, 0xFFFF, AIM_SSI_TYPE_BUDDY, data); |
17369
f80f7e1047be
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents:
17191
diff
changeset
|
880 aim_tlvlist_free(data); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
881 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
882 /* Modify the parent group */ |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
883 aim_ssi_itemlist_rebuildgroup(&od->ssi.local, group); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
884 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
885 /* Sync our local list with the server list */ |
16884
58f58027608e
It is more useful for these aim_ssi methods to return a real value (the result of aim_ssi_sync()) than to always return 0 regardless of their success or failure
Evan Schoenberg <evan.s@dreskin.net>
parents:
16807
diff
changeset
|
886 return aim_ssi_sync(od); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
887 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
888 |
30372
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
30367
diff
changeset
|
889 int |
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
30367
diff
changeset
|
890 aim_ssi_add_to_private_list(OscarData *od, const char* name, guint16 list_type) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
891 { |
16307
9326d4cf5497
If anyone sees the "Unable to add buddy 1" message after
Mark Doliner <mark@kingant.net>
parents:
16306
diff
changeset
|
892 if (!od || !name || !od->ssi.received_data) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
893 return -EINVAL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
894 |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
895 if (aim_ssi_itemlist_find(&od->ssi.local, 0x0000, 0x0000) == NULL) |
31243
e5cd15ee3e5d
I think this was accidentally changed in revision
Mark Doliner <mark@kingant.net>
parents:
31154
diff
changeset
|
896 aim_ssi_itemlist_add(&od->ssi.local, NULL, 0x0000, 0x0000, AIM_SSI_TYPE_GROUP, NULL); |
16278
70a368273778
Fix that pesky ICQ "Unable to add buddy 1" error. Basically we were
Mark Doliner <mark@kingant.net>
parents:
15822
diff
changeset
|
897 |
30372
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
30367
diff
changeset
|
898 aim_ssi_itemlist_add(&od->ssi.local, name, 0x0000, 0xFFFF, list_type, NULL); |
16884
58f58027608e
It is more useful for these aim_ssi methods to return a real value (the result of aim_ssi_sync()) than to always return 0 regardless of their success or failure
Evan Schoenberg <evan.s@dreskin.net>
parents:
16807
diff
changeset
|
899 return aim_ssi_sync(od); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
900 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
901 |
30372
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
30367
diff
changeset
|
902 int |
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
30367
diff
changeset
|
903 aim_ssi_del_from_private_list(OscarData* od, const char* name, guint16 list_type) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
904 { |
30372
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
30367
diff
changeset
|
905 struct aim_ssi_item *del; |
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
30367
diff
changeset
|
906 |
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
30367
diff
changeset
|
907 if (!od) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
908 return -EINVAL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
909 |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
910 if (!(del = aim_ssi_itemlist_finditem(&od->ssi.local, NULL, name, list_type))) |
30372
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
30367
diff
changeset
|
911 return -EINVAL; |
16278
70a368273778
Fix that pesky ICQ "Unable to add buddy 1" error. Basically we were
Mark Doliner <mark@kingant.net>
parents:
15822
diff
changeset
|
912 |
30372
5bfef3338383
Added a way to add a user to the (In)Visible list via the context menu.
ivan.komarov@soc.pidgin.im
parents:
30367
diff
changeset
|
913 aim_ssi_itemlist_del(&od->ssi.local, del); |
16884
58f58027608e
It is more useful for these aim_ssi methods to return a real value (the result of aim_ssi_sync()) than to always return 0 regardless of their success or failure
Evan Schoenberg <evan.s@dreskin.net>
parents:
16807
diff
changeset
|
914 return aim_ssi_sync(od); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
915 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
916 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
917 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
918 * Deletes a buddy from the list. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
919 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
920 * @param od The oscar odion. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
921 * @param name The name of the item, or NULL. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
922 * @param group The group of the item, or NULL. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
923 * @return Return 0 if no errors, otherwise return the error number. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
924 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
925 int aim_ssi_delbuddy(OscarData *od, const char *name, const char *group) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
926 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
927 struct aim_ssi_item *del; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
928 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
929 if (!od) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
930 return -EINVAL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
931 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
932 /* Find the buddy */ |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
933 if (!(del = aim_ssi_itemlist_finditem(&od->ssi.local, group, name, AIM_SSI_TYPE_BUDDY))) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
934 return -EINVAL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
935 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
936 /* Remove the item from the list */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
937 aim_ssi_itemlist_del(&od->ssi.local, del); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
938 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
939 /* Modify the parent group */ |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
940 aim_ssi_itemlist_rebuildgroup(&od->ssi.local, group); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
941 |
18755
84d53c3c699d
Some changes from Matthew Goldstein and I to not automatically remove
Mark Doliner <mark@kingant.net>
parents:
17370
diff
changeset
|
942 /* Sync our local list with the server list */ |
84d53c3c699d
Some changes from Matthew Goldstein and I to not automatically remove
Mark Doliner <mark@kingant.net>
parents:
17370
diff
changeset
|
943 return aim_ssi_sync(od); |
84d53c3c699d
Some changes from Matthew Goldstein and I to not automatically remove
Mark Doliner <mark@kingant.net>
parents:
17370
diff
changeset
|
944 } |
84d53c3c699d
Some changes from Matthew Goldstein and I to not automatically remove
Mark Doliner <mark@kingant.net>
parents:
17370
diff
changeset
|
945 |
84d53c3c699d
Some changes from Matthew Goldstein and I to not automatically remove
Mark Doliner <mark@kingant.net>
parents:
17370
diff
changeset
|
946 /** |
84d53c3c699d
Some changes from Matthew Goldstein and I to not automatically remove
Mark Doliner <mark@kingant.net>
parents:
17370
diff
changeset
|
947 * Deletes a group from the list. |
84d53c3c699d
Some changes from Matthew Goldstein and I to not automatically remove
Mark Doliner <mark@kingant.net>
parents:
17370
diff
changeset
|
948 * |
84d53c3c699d
Some changes from Matthew Goldstein and I to not automatically remove
Mark Doliner <mark@kingant.net>
parents:
17370
diff
changeset
|
949 * @param od The oscar odion. |
84d53c3c699d
Some changes from Matthew Goldstein and I to not automatically remove
Mark Doliner <mark@kingant.net>
parents:
17370
diff
changeset
|
950 * @param group The name of the group. |
84d53c3c699d
Some changes from Matthew Goldstein and I to not automatically remove
Mark Doliner <mark@kingant.net>
parents:
17370
diff
changeset
|
951 * @return Return 0 if no errors, otherwise return the error number. |
84d53c3c699d
Some changes from Matthew Goldstein and I to not automatically remove
Mark Doliner <mark@kingant.net>
parents:
17370
diff
changeset
|
952 */ |
84d53c3c699d
Some changes from Matthew Goldstein and I to not automatically remove
Mark Doliner <mark@kingant.net>
parents:
17370
diff
changeset
|
953 int aim_ssi_delgroup(OscarData *od, const char *group) |
84d53c3c699d
Some changes from Matthew Goldstein and I to not automatically remove
Mark Doliner <mark@kingant.net>
parents:
17370
diff
changeset
|
954 { |
84d53c3c699d
Some changes from Matthew Goldstein and I to not automatically remove
Mark Doliner <mark@kingant.net>
parents:
17370
diff
changeset
|
955 struct aim_ssi_item *del; |
84d53c3c699d
Some changes from Matthew Goldstein and I to not automatically remove
Mark Doliner <mark@kingant.net>
parents:
17370
diff
changeset
|
956 aim_tlv_t *tlv; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
957 |
18755
84d53c3c699d
Some changes from Matthew Goldstein and I to not automatically remove
Mark Doliner <mark@kingant.net>
parents:
17370
diff
changeset
|
958 if (!od) |
84d53c3c699d
Some changes from Matthew Goldstein and I to not automatically remove
Mark Doliner <mark@kingant.net>
parents:
17370
diff
changeset
|
959 return -EINVAL; |
84d53c3c699d
Some changes from Matthew Goldstein and I to not automatically remove
Mark Doliner <mark@kingant.net>
parents:
17370
diff
changeset
|
960 |
84d53c3c699d
Some changes from Matthew Goldstein and I to not automatically remove
Mark Doliner <mark@kingant.net>
parents:
17370
diff
changeset
|
961 /* Find the group */ |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
962 if (!(del = aim_ssi_itemlist_finditem(&od->ssi.local, group, NULL, AIM_SSI_TYPE_GROUP))) |
18755
84d53c3c699d
Some changes from Matthew Goldstein and I to not automatically remove
Mark Doliner <mark@kingant.net>
parents:
17370
diff
changeset
|
963 return -EINVAL; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
964 |
18755
84d53c3c699d
Some changes from Matthew Goldstein and I to not automatically remove
Mark Doliner <mark@kingant.net>
parents:
17370
diff
changeset
|
965 /* Don't delete the group if it's not empty */ |
84d53c3c699d
Some changes from Matthew Goldstein and I to not automatically remove
Mark Doliner <mark@kingant.net>
parents:
17370
diff
changeset
|
966 tlv = aim_tlv_gettlv(del->data, 0x00c8, 1); |
84d53c3c699d
Some changes from Matthew Goldstein and I to not automatically remove
Mark Doliner <mark@kingant.net>
parents:
17370
diff
changeset
|
967 if (tlv && tlv->length > 0) |
84d53c3c699d
Some changes from Matthew Goldstein and I to not automatically remove
Mark Doliner <mark@kingant.net>
parents:
17370
diff
changeset
|
968 return -EINVAL; |
84d53c3c699d
Some changes from Matthew Goldstein and I to not automatically remove
Mark Doliner <mark@kingant.net>
parents:
17370
diff
changeset
|
969 |
84d53c3c699d
Some changes from Matthew Goldstein and I to not automatically remove
Mark Doliner <mark@kingant.net>
parents:
17370
diff
changeset
|
970 /* Remove the item from the list */ |
84d53c3c699d
Some changes from Matthew Goldstein and I to not automatically remove
Mark Doliner <mark@kingant.net>
parents:
17370
diff
changeset
|
971 aim_ssi_itemlist_del(&od->ssi.local, del); |
84d53c3c699d
Some changes from Matthew Goldstein and I to not automatically remove
Mark Doliner <mark@kingant.net>
parents:
17370
diff
changeset
|
972 |
84d53c3c699d
Some changes from Matthew Goldstein and I to not automatically remove
Mark Doliner <mark@kingant.net>
parents:
17370
diff
changeset
|
973 /* Modify the parent group */ |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
974 aim_ssi_itemlist_rebuildgroup(&od->ssi.local, group); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
975 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
976 /* Sync our local list with the server list */ |
16884
58f58027608e
It is more useful for these aim_ssi methods to return a real value (the result of aim_ssi_sync()) than to always return 0 regardless of their success or failure
Evan Schoenberg <evan.s@dreskin.net>
parents:
16807
diff
changeset
|
977 return aim_ssi_sync(od); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
978 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
979 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
980 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
981 * Move a buddy from one group to another group. This basically just deletes the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
982 * buddy and re-adds it. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
983 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
984 * @param od The oscar odion. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
985 * @param oldgn The group that the buddy is currently in. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
986 * @param newgn The group that the buddy should be moved in to. |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
987 * @param bn The name of the buddy to be moved. |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
988 * @return Return 0 if no errors, otherwise return the error number. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
989 */ |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
990 int aim_ssi_movebuddy(OscarData *od, const char *oldgn, const char *newgn, const char *bn) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
991 { |
17370
0db74191adbb
Clean up some other ssi-related things. This commit and my last one
Mark Doliner <mark@kingant.net>
parents:
17369
diff
changeset
|
992 struct aim_ssi_item *buddy; |
0db74191adbb
Clean up some other ssi-related things. This commit and my last one
Mark Doliner <mark@kingant.net>
parents:
17369
diff
changeset
|
993 GSList *data; |
17369
f80f7e1047be
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents:
17191
diff
changeset
|
994 |
f80f7e1047be
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents:
17191
diff
changeset
|
995 /* Find the buddy */ |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
996 buddy = aim_ssi_itemlist_finditem(&od->ssi.local, oldgn, bn, AIM_SSI_TYPE_BUDDY); |
17370
0db74191adbb
Clean up some other ssi-related things. This commit and my last one
Mark Doliner <mark@kingant.net>
parents:
17369
diff
changeset
|
997 if (buddy == NULL) |
17369
f80f7e1047be
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents:
17191
diff
changeset
|
998 return -EINVAL; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
999 |
17369
f80f7e1047be
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents:
17191
diff
changeset
|
1000 /* Make a copy of the buddy's TLV list */ |
17370
0db74191adbb
Clean up some other ssi-related things. This commit and my last one
Mark Doliner <mark@kingant.net>
parents:
17369
diff
changeset
|
1001 data = aim_tlvlist_copy(buddy->data); |
17369
f80f7e1047be
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents:
17191
diff
changeset
|
1002 |
17370
0db74191adbb
Clean up some other ssi-related things. This commit and my last one
Mark Doliner <mark@kingant.net>
parents:
17369
diff
changeset
|
1003 /* Delete the old item */ |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
1004 aim_ssi_delbuddy(od, bn, oldgn); |
17369
f80f7e1047be
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents:
17191
diff
changeset
|
1005 |
17370
0db74191adbb
Clean up some other ssi-related things. This commit and my last one
Mark Doliner <mark@kingant.net>
parents:
17369
diff
changeset
|
1006 /* Add the new item using the EXACT SAME TLV list */ |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
1007 aim_ssi_addbuddy(od, bn, newgn, data, NULL, NULL, NULL, FALSE); |
17369
f80f7e1047be
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents:
17191
diff
changeset
|
1008 |
17370
0db74191adbb
Clean up some other ssi-related things. This commit and my last one
Mark Doliner <mark@kingant.net>
parents:
17369
diff
changeset
|
1009 return 0; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1010 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1011 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1012 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1013 * Change the alias stored on the server for a given buddy. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1014 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1015 * @param od The oscar odion. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1016 * @param gn The group that the buddy is currently in. |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
1017 * @param bn The name of the buddy. |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1018 * @param alias The new alias for the buddy, or NULL if you want to remove |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1019 * a buddy's comment. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1020 * @return Return 0 if no errors, otherwise return the error number. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1021 */ |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
1022 int aim_ssi_aliasbuddy(OscarData *od, const char *gn, const char *bn, const char *alias) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1023 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1024 struct aim_ssi_item *tmp; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1025 |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
1026 if (!od || !gn || !bn) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1027 return -EINVAL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1028 |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
1029 if (!(tmp = aim_ssi_itemlist_finditem(&od->ssi.local, gn, bn, AIM_SSI_TYPE_BUDDY))) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1030 return -EINVAL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1031 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1032 /* Either add or remove the 0x0131 TLV from the TLV chain */ |
31905
323876c34a96
Don't use strlen() when all you're trying to do is check if the string
Mark Doliner <mark@kingant.net>
parents:
31852
diff
changeset
|
1033 if (alias && *alias) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1034 aim_tlvlist_replace_str(&tmp->data, 0x0131, alias); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1035 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1036 aim_tlvlist_remove(&tmp->data, 0x0131); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1037 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1038 /* Sync our local list with the server list */ |
16884
58f58027608e
It is more useful for these aim_ssi methods to return a real value (the result of aim_ssi_sync()) than to always return 0 regardless of their success or failure
Evan Schoenberg <evan.s@dreskin.net>
parents:
16807
diff
changeset
|
1039 return aim_ssi_sync(od); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1040 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1041 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1042 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1043 * Change the comment stored on the server for a given buddy. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1044 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1045 * @param od The oscar odion. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1046 * @param gn The group that the buddy is currently in. |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
1047 * @param bn The name of the buddy. |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1048 * @param alias The new comment for the buddy, or NULL if you want to remove |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1049 * a buddy's comment. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1050 * @return Return 0 if no errors, otherwise return the error number. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1051 */ |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
1052 int aim_ssi_editcomment(OscarData *od, const char *gn, const char *bn, const char *comment) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1053 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1054 struct aim_ssi_item *tmp; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1055 |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
1056 if (!od || !gn || !bn) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1057 return -EINVAL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1058 |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
1059 if (!(tmp = aim_ssi_itemlist_finditem(&od->ssi.local, gn, bn, AIM_SSI_TYPE_BUDDY))) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1060 return -EINVAL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1061 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1062 /* Either add or remove the 0x0131 TLV from the TLV chain */ |
31905
323876c34a96
Don't use strlen() when all you're trying to do is check if the string
Mark Doliner <mark@kingant.net>
parents:
31852
diff
changeset
|
1063 if (comment && *comment) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1064 aim_tlvlist_replace_str(&tmp->data, 0x013c, comment); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1065 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1066 aim_tlvlist_remove(&tmp->data, 0x013c); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1067 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1068 /* Sync our local list with the server list */ |
16884
58f58027608e
It is more useful for these aim_ssi methods to return a real value (the result of aim_ssi_sync()) than to always return 0 regardless of their success or failure
Evan Schoenberg <evan.s@dreskin.net>
parents:
16807
diff
changeset
|
1069 return aim_ssi_sync(od); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1070 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1071 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1072 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1073 * Rename a group. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1074 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1075 * @param od The oscar odion. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1076 * @param oldgn The old group name. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1077 * @param newgn The new group name. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1078 * @return Return 0 if no errors, otherwise return the error number. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1079 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1080 int aim_ssi_rename_group(OscarData *od, const char *oldgn, const char *newgn) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1081 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1082 struct aim_ssi_item *group; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1083 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1084 if (!od || !oldgn || !newgn) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1085 return -EINVAL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1086 |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
1087 if (!(group = aim_ssi_itemlist_finditem(&od->ssi.local, oldgn, NULL, AIM_SSI_TYPE_GROUP))) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1088 return -EINVAL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1089 |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
1090 aim_ssi_item_set_name(&od->ssi.local, group, newgn); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1091 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1092 /* Sync our local list with the server list */ |
16884
58f58027608e
It is more useful for these aim_ssi methods to return a real value (the result of aim_ssi_sync()) than to always return 0 regardless of their success or failure
Evan Schoenberg <evan.s@dreskin.net>
parents:
16807
diff
changeset
|
1093 return aim_ssi_sync(od); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1094 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1095 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1096 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1097 * Stores your permit/deny setting on the server, and starts using it. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1098 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1099 * @param od The oscar odion. |
30367
05c634403678
Start using the real ICQ block list (SSI type 0xe) for allowing/blocking
ivan.komarov@soc.pidgin.im
parents:
28496
diff
changeset
|
1100 * @param permdeny Your permit/deny setting. For ICQ accounts, it actually affects your visibility |
05c634403678
Start using the real ICQ block list (SSI type 0xe) for allowing/blocking
ivan.komarov@soc.pidgin.im
parents:
28496
diff
changeset
|
1101 * and has nothing to do with blocking. Can be one of the following: |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1102 * 1 - Allow all users |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1103 * 2 - Block all users |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1104 * 3 - Allow only the users below |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1105 * 4 - Block only the users below |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1106 * 5 - Allow only users on my buddy list |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1107 * @return Return 0 if no errors, otherwise return the error number. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1108 */ |
30367
05c634403678
Start using the real ICQ block list (SSI type 0xe) for allowing/blocking
ivan.komarov@soc.pidgin.im
parents:
28496
diff
changeset
|
1109 int aim_ssi_setpermdeny(OscarData *od, guint8 permdeny) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1110 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1111 struct aim_ssi_item *tmp; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1112 |
16307
9326d4cf5497
If anyone sees the "Unable to add buddy 1" message after
Mark Doliner <mark@kingant.net>
parents:
16306
diff
changeset
|
1113 if (!od || !od->ssi.received_data) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1114 return -EINVAL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1115 |
16297
aae14296a349
Only make sure the master group exists in the event we need to add an
Mark Doliner <mark@kingant.net>
parents:
16279
diff
changeset
|
1116 /* Find the PDINFO item, or add it if it does not exist */ |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
1117 if (!(tmp = aim_ssi_itemlist_finditem(&od->ssi.local, NULL, NULL, AIM_SSI_TYPE_PDINFO))) { |
16297
aae14296a349
Only make sure the master group exists in the event we need to add an
Mark Doliner <mark@kingant.net>
parents:
16279
diff
changeset
|
1118 /* Make sure the master group exists */ |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
1119 if (aim_ssi_itemlist_find(&od->ssi.local, 0x0000, 0x0000) == NULL) |
16297
aae14296a349
Only make sure the master group exists in the event we need to add an
Mark Doliner <mark@kingant.net>
parents:
16279
diff
changeset
|
1120 aim_ssi_itemlist_add(&od->ssi.local, NULL, 0x0000, 0x0000, AIM_SSI_TYPE_GROUP, NULL); |
16278
70a368273778
Fix that pesky ICQ "Unable to add buddy 1" error. Basically we were
Mark Doliner <mark@kingant.net>
parents:
15822
diff
changeset
|
1121 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1122 tmp = aim_ssi_itemlist_add(&od->ssi.local, NULL, 0x0000, 0xFFFF, AIM_SSI_TYPE_PDINFO, NULL); |
16297
aae14296a349
Only make sure the master group exists in the event we need to add an
Mark Doliner <mark@kingant.net>
parents:
16279
diff
changeset
|
1123 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1124 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1125 /* Need to add the 0x00ca TLV to the TLV chain */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1126 aim_tlvlist_replace_8(&tmp->data, 0x00ca, permdeny); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1127 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1128 /* Sync our local list with the server list */ |
16884
58f58027608e
It is more useful for these aim_ssi methods to return a real value (the result of aim_ssi_sync()) than to always return 0 regardless of their success or failure
Evan Schoenberg <evan.s@dreskin.net>
parents:
16807
diff
changeset
|
1129 return aim_ssi_sync(od); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1130 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1131 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1132 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1133 * Set buddy icon information |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1134 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1135 * @param od The oscar odion. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1136 * @param iconcsum The MD5 checksum of the icon you are using. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1137 * @param iconcsumlen Length of the MD5 checksum given above. Should be 0x10 bytes. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1138 * @return Return 0 if no errors, otherwise return the error number. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1139 */ |
16307
9326d4cf5497
If anyone sees the "Unable to add buddy 1" message after
Mark Doliner <mark@kingant.net>
parents:
16306
diff
changeset
|
1140 int aim_ssi_seticon(OscarData *od, const guint8 *iconsum, guint8 iconsumlen) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1141 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1142 struct aim_ssi_item *tmp; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1143 guint8 *csumdata; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1144 |
16307
9326d4cf5497
If anyone sees the "Unable to add buddy 1" message after
Mark Doliner <mark@kingant.net>
parents:
16306
diff
changeset
|
1145 if (!od || !iconsum || !iconsumlen || !od->ssi.received_data) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1146 return -EINVAL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1147 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1148 /* Find the ICONINFO item, or add it if it does not exist */ |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
1149 if (!(tmp = aim_ssi_itemlist_finditem(&od->ssi.local, NULL, "1", AIM_SSI_TYPE_ICONINFO))) { |
16297
aae14296a349
Only make sure the master group exists in the event we need to add an
Mark Doliner <mark@kingant.net>
parents:
16279
diff
changeset
|
1150 /* Make sure the master group exists */ |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
1151 if (aim_ssi_itemlist_find(&od->ssi.local, 0x0000, 0x0000) == NULL) |
16297
aae14296a349
Only make sure the master group exists in the event we need to add an
Mark Doliner <mark@kingant.net>
parents:
16279
diff
changeset
|
1152 aim_ssi_itemlist_add(&od->ssi.local, NULL, 0x0000, 0x0000, AIM_SSI_TYPE_GROUP, NULL); |
aae14296a349
Only make sure the master group exists in the event we need to add an
Mark Doliner <mark@kingant.net>
parents:
16279
diff
changeset
|
1153 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1154 tmp = aim_ssi_itemlist_add(&od->ssi.local, "1", 0x0000, 0xFFFF, AIM_SSI_TYPE_ICONINFO, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1155 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1156 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1157 /* Need to add the 0x00d5 TLV to the TLV chain */ |
17191
1927f4ead3ca
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
16885
diff
changeset
|
1158 csumdata = (guint8 *)g_malloc((iconsumlen+2)*sizeof(guint8)); |
16307
9326d4cf5497
If anyone sees the "Unable to add buddy 1" message after
Mark Doliner <mark@kingant.net>
parents:
16306
diff
changeset
|
1159 aimutil_put8(&csumdata[0], 0x00); |
9326d4cf5497
If anyone sees the "Unable to add buddy 1" message after
Mark Doliner <mark@kingant.net>
parents:
16306
diff
changeset
|
1160 aimutil_put8(&csumdata[1], iconsumlen); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1161 memcpy(&csumdata[2], iconsum, iconsumlen); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1162 aim_tlvlist_replace_raw(&tmp->data, 0x00d5, (iconsumlen+2) * sizeof(guint8), csumdata); |
17191
1927f4ead3ca
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
16885
diff
changeset
|
1163 g_free(csumdata); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1164 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1165 /* Need to add the 0x0131 TLV to the TLV chain, used to cache the icon */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1166 aim_tlvlist_replace_noval(&tmp->data, 0x0131); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1167 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1168 /* Sync our local list with the server list */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1169 aim_ssi_sync(od); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1170 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1171 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1172 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1173 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1174 * Remove a reference to a server stored buddy icon. This will make your |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1175 * icon stop showing up to other people. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1176 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1177 * Really this function just sets the icon to a dummy value. It's weird... |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1178 * but I think the dummy value basically means "I don't have an icon!" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1179 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1180 * @param od The oscar session. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1181 * @return Return 0 if no errors, otherwise return the error number. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1182 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1183 int aim_ssi_delicon(OscarData *od) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1184 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1185 const guint8 csumdata[] = {0x02, 0x01, 0xd2, 0x04, 0x72}; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1186 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1187 return aim_ssi_seticon(od, csumdata, 5); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1188 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1189 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1190 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1191 * Stores your setting for various SSI settings. Whether you |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1192 * should show up as idle or not, etc. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1193 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1194 * @param od The oscar odion. |
28495
c26a59000df9
oscar: Update the details of the buddy preferences based on the OSCAR docs.
Paul Aurich <paul@darkrain42.org>
parents:
28290
diff
changeset
|
1195 * @param presence A bitmask of the first 32 entries [0-31] from |
c26a59000df9
oscar: Update the details of the buddy preferences based on the OSCAR docs.
Paul Aurich <paul@darkrain42.org>
parents:
28290
diff
changeset
|
1196 * http://dev.aol.com/aim/oscar/#FEEDBAG__BUDDY_PREFS |
c26a59000df9
oscar: Update the details of the buddy preferences based on the OSCAR docs.
Paul Aurich <paul@darkrain42.org>
parents:
28290
diff
changeset
|
1197 * 0x00000002 - Hide "eBuddy group" (whatever that is) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1198 * 0x00000400 - Allow others to see your idle time |
28495
c26a59000df9
oscar: Update the details of the buddy preferences based on the OSCAR docs.
Paul Aurich <paul@darkrain42.org>
parents:
28290
diff
changeset
|
1199 * 0x00020000 - Don't show Recent Buddies |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1200 * @return Return 0 if no errors, otherwise return the error number. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1201 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1202 int aim_ssi_setpresence(OscarData *od, guint32 presence) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1203 struct aim_ssi_item *tmp; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1204 |
16307
9326d4cf5497
If anyone sees the "Unable to add buddy 1" message after
Mark Doliner <mark@kingant.net>
parents:
16306
diff
changeset
|
1205 if (!od || !od->ssi.received_data) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1206 return -EINVAL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1207 |
16297
aae14296a349
Only make sure the master group exists in the event we need to add an
Mark Doliner <mark@kingant.net>
parents:
16279
diff
changeset
|
1208 /* Find the PRESENCEPREFS item, or add it if it does not exist */ |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
1209 if (!(tmp = aim_ssi_itemlist_finditem(&od->ssi.local, NULL, NULL, AIM_SSI_TYPE_PRESENCEPREFS))) { |
16297
aae14296a349
Only make sure the master group exists in the event we need to add an
Mark Doliner <mark@kingant.net>
parents:
16279
diff
changeset
|
1210 /* Make sure the master group exists */ |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
1211 if (aim_ssi_itemlist_find(&od->ssi.local, 0x0000, 0x0000) == NULL) |
16297
aae14296a349
Only make sure the master group exists in the event we need to add an
Mark Doliner <mark@kingant.net>
parents:
16279
diff
changeset
|
1212 aim_ssi_itemlist_add(&od->ssi.local, NULL, 0x0000, 0x0000, AIM_SSI_TYPE_GROUP, NULL); |
16278
70a368273778
Fix that pesky ICQ "Unable to add buddy 1" error. Basically we were
Mark Doliner <mark@kingant.net>
parents:
15822
diff
changeset
|
1213 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1214 tmp = aim_ssi_itemlist_add(&od->ssi.local, NULL, 0x0000, 0xFFFF, AIM_SSI_TYPE_PRESENCEPREFS, NULL); |
16297
aae14296a349
Only make sure the master group exists in the event we need to add an
Mark Doliner <mark@kingant.net>
parents:
16279
diff
changeset
|
1215 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1216 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1217 /* Need to add the x00c9 TLV to the TLV chain */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1218 aim_tlvlist_replace_32(&tmp->data, 0x00c9, presence); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1219 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1220 /* Sync our local list with the server list */ |
16884
58f58027608e
It is more useful for these aim_ssi methods to return a real value (the result of aim_ssi_sync()) than to always return 0 regardless of their success or failure
Evan Schoenberg <evan.s@dreskin.net>
parents:
16807
diff
changeset
|
1221 return aim_ssi_sync(od); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1222 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1223 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1224 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1225 * Subtype 0x0002 - Request SSI Rights. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1226 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1227 int aim_ssi_reqrights(OscarData *od) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1228 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1229 FlapConnection *conn; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1230 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1231 if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_FEEDBAG))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1232 return -EINVAL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1233 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1234 aim_genericreq_n_snacid(od, conn, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_REQRIGHTS); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1235 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1236 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1237 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1238 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1239 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1240 * Subtype 0x0003 - SSI Rights Information. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1241 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1242 static int parserights(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1243 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1244 int ret = 0, i; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1245 aim_rxcallback_t userfunc; |
17369
f80f7e1047be
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents:
17191
diff
changeset
|
1246 GSList *tlvlist; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1247 aim_tlv_t *tlv; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1248 ByteStream bstream; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1249 guint16 *maxitems; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1250 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1251 /* This SNAC is made up of a bunch of TLVs */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1252 tlvlist = aim_tlvlist_read(bs); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1253 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1254 /* TLV 0x0004 contains the maximum number of each item */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1255 if (!(tlv = aim_tlv_gettlv(tlvlist, 0x0004, 1))) { |
17369
f80f7e1047be
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents:
17191
diff
changeset
|
1256 aim_tlvlist_free(tlvlist); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1257 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1258 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1259 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1260 byte_stream_init(&bstream, tlv->value, tlv->length); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1261 |
17191
1927f4ead3ca
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
16885
diff
changeset
|
1262 maxitems = (guint16 *)g_malloc((tlv->length/2)*sizeof(guint16)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1263 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1264 for (i=0; i<(tlv->length/2); i++) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1265 maxitems[i] = byte_stream_get16(&bstream); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1266 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1267 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1268 ret = userfunc(od, conn, frame, tlv->length/2, maxitems); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1269 |
17369
f80f7e1047be
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents:
17191
diff
changeset
|
1270 aim_tlvlist_free(tlvlist); |
17191
1927f4ead3ca
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
16885
diff
changeset
|
1271 g_free(maxitems); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1272 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1273 return ret; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1274 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1275 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1276 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1277 * Subtype 0x0004 - Request SSI Data when you don't have a timestamp and |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1278 * revision number. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1279 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1280 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1281 int aim_ssi_reqdata(OscarData *od) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1282 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1283 FlapConnection *conn; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1284 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1285 if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_FEEDBAG))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1286 return -EINVAL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1287 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1288 /* Free any current data, just in case */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1289 aim_ssi_freelist(od); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1290 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1291 aim_genericreq_n_snacid(od, conn, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_REQDATA); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1292 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1293 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1294 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1295 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1296 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1297 * Subtype 0x0006 - SSI Data. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1298 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1299 static int parsedata(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1300 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1301 int ret = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1302 aim_rxcallback_t userfunc; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1303 guint8 fmtver; /* guess */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1304 guint16 namelen, gid, bid, type; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1305 char *name; |
17369
f80f7e1047be
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents:
17191
diff
changeset
|
1306 GSList *data; |
31154
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
1307 GString *debugstr = g_string_new(""); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1308 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1309 fmtver = byte_stream_get8(bs); /* Version of ssi data. Should be 0x00 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1310 od->ssi.numitems += byte_stream_get16(bs); /* # of items in this SSI SNAC */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1311 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1312 /* Read in the list */ |
30393 | 1313 while (byte_stream_bytes_left(bs) > 4) { /* last four bytes are timestamp */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1314 if ((namelen = byte_stream_get16(bs))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1315 name = byte_stream_getstr(bs, namelen); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1316 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1317 name = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1318 gid = byte_stream_get16(bs); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1319 bid = byte_stream_get16(bs); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1320 type = byte_stream_get16(bs); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1321 data = aim_tlvlist_readlen(bs, byte_stream_get16(bs)); |
31154
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
1322 aim_ssi_item_debug_append(debugstr, "\t", aim_ssi_itemlist_add(&od->ssi.official, name, gid, bid, type, data)); |
17191
1927f4ead3ca
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
16885
diff
changeset
|
1323 g_free(name); |
17369
f80f7e1047be
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents:
17191
diff
changeset
|
1324 aim_tlvlist_free(data); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1325 } |
31154
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
1326 purple_debug_misc("oscar", "Reading items from tlvlist for account %s:\n%s", |
32245
f75041cb3fec
Convert libpurple and protocol prpl's to use the purple_account_* accessor functions.
andrew.victor@mxit.com
parents:
31905
diff
changeset
|
1327 purple_account_get_username(purple_connection_get_account(od->gc)), debugstr->str); |
31154
b5714a933dcc
Added some debug output to the SSI code (original patch courtesy of Dustin Gathmann).
ivan.komarov@pidgin.im
parents:
30400
diff
changeset
|
1328 g_string_free(debugstr, TRUE); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1329 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1330 /* Read in the timestamp */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1331 od->ssi.timestamp = byte_stream_get32(bs); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1332 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1333 if (!(snac->flags & 0x0001)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1334 /* Make a copy of the list */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1335 struct aim_ssi_item *cur; |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
1336 for (cur=od->ssi.official.data; cur; cur=cur->next) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1337 aim_ssi_itemlist_add(&od->ssi.local, cur->name, cur->gid, cur->bid, cur->type, cur->data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1338 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1339 od->ssi.received_data = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1340 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1341 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1342 ret = userfunc(od, conn, frame, fmtver, od->ssi.numitems, od->ssi.timestamp); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1343 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1344 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1345 return ret; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1346 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1347 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1348 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1349 * Subtype 0x0007 - SSI Activate Data. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1350 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1351 * Should be sent after receiving 13/6 or 13/f to tell the server you |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1352 * are ready to begin using the list. It will promptly give you the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1353 * presence information for everyone in your list and put your permit/deny |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1354 * settings into effect. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1355 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1356 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1357 int aim_ssi_enable(OscarData *od) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1358 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1359 FlapConnection *conn; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1360 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1361 if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_FEEDBAG))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1362 return -EINVAL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1363 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1364 aim_genericreq_n(od, conn, SNAC_FAMILY_FEEDBAG, 0x0007); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1365 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1366 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1367 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1368 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1369 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1370 * Subtype 0x0008/0x0009/0x000a - SSI Add/Mod/Del Item(s). |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1371 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1372 * Sends the SNAC to add, modify, or delete items from the server-stored |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1373 * information. These 3 SNACs all have an identical structure. The only |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1374 * difference is the subtype that is set for the SNAC. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1375 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1376 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1377 static int aim_ssi_addmoddel(OscarData *od) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1378 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1379 FlapConnection *conn; |
22717
979a81468e19
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents:
21762
diff
changeset
|
1380 ByteStream bs; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1381 aim_snacid_t snacid; |
22717
979a81468e19
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents:
21762
diff
changeset
|
1382 int bslen; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1383 struct aim_ssi_tmp *cur; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1384 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1385 if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_FEEDBAG)) || !od->ssi.pending || !od->ssi.pending->item) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1386 return -EINVAL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1387 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1388 /* Calculate total SNAC size */ |
22717
979a81468e19
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents:
21762
diff
changeset
|
1389 bslen = 0; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1390 for (cur=od->ssi.pending; cur; cur=cur->next) { |
22717
979a81468e19
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents:
21762
diff
changeset
|
1391 bslen += 10; /* For length, GID, BID, type, and length */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1392 if (cur->item->name) |
22717
979a81468e19
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents:
21762
diff
changeset
|
1393 bslen += strlen(cur->item->name); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1394 if (cur->item->data) |
22717
979a81468e19
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents:
21762
diff
changeset
|
1395 bslen += aim_tlvlist_size(cur->item->data); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1396 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1397 |
22717
979a81468e19
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents:
21762
diff
changeset
|
1398 byte_stream_new(&bs, bslen); |
979a81468e19
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents:
21762
diff
changeset
|
1399 |
979a81468e19
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents:
21762
diff
changeset
|
1400 for (cur=od->ssi.pending; cur; cur=cur->next) { |
979a81468e19
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents:
21762
diff
changeset
|
1401 byte_stream_put16(&bs, cur->item->name ? strlen(cur->item->name) : 0); |
979a81468e19
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents:
21762
diff
changeset
|
1402 if (cur->item->name) |
979a81468e19
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents:
21762
diff
changeset
|
1403 byte_stream_putstr(&bs, cur->item->name); |
979a81468e19
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents:
21762
diff
changeset
|
1404 byte_stream_put16(&bs, cur->item->gid); |
979a81468e19
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents:
21762
diff
changeset
|
1405 byte_stream_put16(&bs, cur->item->bid); |
979a81468e19
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents:
21762
diff
changeset
|
1406 byte_stream_put16(&bs, cur->item->type); |
979a81468e19
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents:
21762
diff
changeset
|
1407 byte_stream_put16(&bs, cur->item->data ? aim_tlvlist_size(cur->item->data) : 0); |
979a81468e19
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents:
21762
diff
changeset
|
1408 if (cur->item->data) |
979a81468e19
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents:
21762
diff
changeset
|
1409 aim_tlvlist_write(&bs, &cur->item->data); |
979a81468e19
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents:
21762
diff
changeset
|
1410 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1411 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1412 snacid = aim_cachesnac(od, SNAC_FAMILY_FEEDBAG, od->ssi.pending->action, 0x0000, NULL, 0); |
30400
11c54d781835
Removed unused "flags" parameter.
ivan.komarov@soc.pidgin.im
parents:
30393
diff
changeset
|
1413 flap_connection_send_snac(od, conn, SNAC_FAMILY_FEEDBAG, od->ssi.pending->action, snacid, &bs); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1414 |
22717
979a81468e19
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents:
21762
diff
changeset
|
1415 byte_stream_destroy(&bs); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1416 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1417 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1418 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1419 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1420 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1421 * Subtype 0x0008 - Incoming SSI add. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1422 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1423 * Sent by the server, for example, when someone is added to |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1424 * your "Recent Buddies" group. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1425 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1426 static int parseadd(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1427 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1428 int ret = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1429 aim_rxcallback_t userfunc; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1430 char *name; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1431 guint16 len, gid, bid, type; |
17369
f80f7e1047be
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents:
17191
diff
changeset
|
1432 GSList *data; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1433 |
30393 | 1434 while (byte_stream_bytes_left(bs)) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1435 if ((len = byte_stream_get16(bs))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1436 name = byte_stream_getstr(bs, len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1437 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1438 name = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1439 gid = byte_stream_get16(bs); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1440 bid = byte_stream_get16(bs); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1441 type = byte_stream_get16(bs); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1442 if ((len = byte_stream_get16(bs))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1443 data = aim_tlvlist_readlen(bs, len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1444 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1445 data = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1446 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1447 aim_ssi_itemlist_add(&od->ssi.local, name, gid, bid, type, data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1448 aim_ssi_itemlist_add(&od->ssi.official, name, gid, bid, type, data); |
17369
f80f7e1047be
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents:
17191
diff
changeset
|
1449 aim_tlvlist_free(data); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1450 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1451 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) |
20229
e01a6dc25900
applied changes from 02a707bbb0cf1cab4c65c4977bed39c67c5b2452
Richard Laager <rlaager@wiktel.com>
parents:
19681
diff
changeset
|
1452 ret = userfunc(od, conn, frame, snac->subtype, type, name); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1453 |
17191
1927f4ead3ca
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
16885
diff
changeset
|
1454 g_free(name); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1455 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1456 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1457 return ret; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1458 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1459 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1460 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1461 * Subtype 0x0009 - Incoming SSI mod. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1462 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1463 static int parsemod(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1464 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1465 int ret = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1466 aim_rxcallback_t userfunc; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1467 char *name; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1468 guint16 len, gid, bid, type; |
17369
f80f7e1047be
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents:
17191
diff
changeset
|
1469 GSList *data; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1470 struct aim_ssi_item *item; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1471 |
30393 | 1472 while (byte_stream_bytes_left(bs)) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1473 if ((len = byte_stream_get16(bs))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1474 name = byte_stream_getstr(bs, len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1475 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1476 name = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1477 gid = byte_stream_get16(bs); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1478 bid = byte_stream_get16(bs); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1479 type = byte_stream_get16(bs); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1480 if ((len = byte_stream_get16(bs))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1481 data = aim_tlvlist_readlen(bs, len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1482 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1483 data = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1484 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1485 /* Replace the 2 local items with the given one */ |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
1486 if ((item = aim_ssi_itemlist_find(&od->ssi.local, gid, bid))) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1487 item->type = type; |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
1488 aim_ssi_item_set_name(&od->ssi.local, item, name); |
17369
f80f7e1047be
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents:
17191
diff
changeset
|
1489 aim_tlvlist_free(item->data); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1490 item->data = aim_tlvlist_copy(data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1491 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1492 |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
1493 if ((item = aim_ssi_itemlist_find(&od->ssi.official, gid, bid))) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1494 item->type = type; |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
1495 aim_ssi_item_set_name(&od->ssi.official, item, name); |
17369
f80f7e1047be
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents:
17191
diff
changeset
|
1496 aim_tlvlist_free(item->data); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1497 item->data = aim_tlvlist_copy(data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1498 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1499 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1500 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) |
20229
e01a6dc25900
applied changes from 02a707bbb0cf1cab4c65c4977bed39c67c5b2452
Richard Laager <rlaager@wiktel.com>
parents:
19681
diff
changeset
|
1501 ret = userfunc(od, conn, frame, snac->subtype, type, name); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1502 |
17191
1927f4ead3ca
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
16885
diff
changeset
|
1503 g_free(name); |
17369
f80f7e1047be
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents:
17191
diff
changeset
|
1504 aim_tlvlist_free(data); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1505 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1506 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1507 return ret; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1508 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1509 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1510 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1511 * Subtype 0x000a - Incoming SSI del. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1512 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1513 * XXX - It would probably be good for the client to actually do something when it gets this. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1514 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1515 static int parsedel(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1516 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1517 int ret = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1518 aim_rxcallback_t userfunc; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1519 guint16 gid, bid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1520 struct aim_ssi_item *del; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1521 |
30393 | 1522 while (byte_stream_bytes_left(bs)) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1523 byte_stream_advance(bs, byte_stream_get16(bs)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1524 gid = byte_stream_get16(bs); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1525 bid = byte_stream_get16(bs); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1526 byte_stream_get16(bs); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1527 byte_stream_advance(bs, byte_stream_get16(bs)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1528 |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
1529 if ((del = aim_ssi_itemlist_find(&od->ssi.local, gid, bid))) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1530 aim_ssi_itemlist_del(&od->ssi.local, del); |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
1531 if ((del = aim_ssi_itemlist_find(&od->ssi.official, gid, bid))) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1532 aim_ssi_itemlist_del(&od->ssi.official, del); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1533 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1534 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1535 ret = userfunc(od, conn, frame); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1536 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1537 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1538 return ret; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1539 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1540 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1541 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1542 * Subtype 0x000e - SSI Add/Mod/Del Ack. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1543 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1544 * Response to add, modify, or delete SNAC (sent with aim_ssi_addmoddel). |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1545 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1546 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1547 static int parseack(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1548 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1549 int ret = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1550 aim_rxcallback_t userfunc; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1551 struct aim_ssi_tmp *cur, *del; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1552 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1553 /* Read in the success/failure flags from the ack SNAC */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1554 cur = od->ssi.pending; |
30393 | 1555 while (cur && (byte_stream_bytes_left(bs)>0)) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1556 cur->ack = byte_stream_get16(bs); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1557 cur = cur->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1558 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1559 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1560 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1561 * If outcome is 0, then add the item to the item list, or replace the other item, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1562 * or remove the old item. If outcome is non-zero, then remove the item from the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1563 * local list, or unmodify it, or add it. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1564 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1565 for (cur=od->ssi.pending; (cur && (cur->ack != 0xffff)); cur=cur->next) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1566 if (cur->item) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1567 if (cur->ack) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1568 /* Our action was unsuccessful, so change the local list back to how it was */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1569 if (cur->action == SNAC_SUBTYPE_FEEDBAG_ADD) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1570 /* Remove the item from the local list */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1571 /* Make sure cur->item is still valid memory */ |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
1572 /* TODO: "Still valid memory"? That's bad form. */ |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
1573 if (aim_ssi_itemlist_valid(&od->ssi.local, cur->item)) { |
21742
98514870b73c
g_strdup() is awesome. 11 insertions(+), 35 deletions(-)
Mark Doliner <mark@kingant.net>
parents:
20229
diff
changeset
|
1574 cur->name = g_strdup(cur->item->name); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1575 aim_ssi_itemlist_del(&od->ssi.local, cur->item); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1576 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1577 cur->item = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1578 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1579 } else if (cur->action == SNAC_SUBTYPE_FEEDBAG_MOD) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1580 /* Replace the local item with the item from the official list */ |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
1581 if (aim_ssi_itemlist_valid(&od->ssi.local, cur->item)) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1582 struct aim_ssi_item *cur1; |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
1583 if ((cur1 = aim_ssi_itemlist_find(&od->ssi.official, cur->item->gid, cur->item->bid))) { |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
1584 aim_ssi_item_set_name(&od->ssi.official, cur->item, cur1->name); |
17369
f80f7e1047be
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents:
17191
diff
changeset
|
1585 aim_tlvlist_free(cur->item->data); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1586 cur->item->data = aim_tlvlist_copy(cur1->data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1587 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1588 } else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1589 cur->item = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1590 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1591 } else if (cur->action == SNAC_SUBTYPE_FEEDBAG_DEL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1592 /* Add the item back into the local list */ |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
1593 if (aim_ssi_itemlist_valid(&od->ssi.official, cur->item)) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1594 aim_ssi_itemlist_add(&od->ssi.local, cur->item->name, cur->item->gid, cur->item->bid, cur->item->type, cur->item->data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1595 } else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1596 cur->item = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1597 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1598 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1599 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1600 /* Do the exact opposite */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1601 if (cur->action == SNAC_SUBTYPE_FEEDBAG_ADD) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1602 /* Add the local item to the official list */ |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
1603 if (aim_ssi_itemlist_valid(&od->ssi.local, cur->item)) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1604 aim_ssi_itemlist_add(&od->ssi.official, cur->item->name, cur->item->gid, cur->item->bid, cur->item->type, cur->item->data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1605 } else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1606 cur->item = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1607 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1608 } else if (cur->action == SNAC_SUBTYPE_FEEDBAG_MOD) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1609 /* Replace the official item with the item from the local list */ |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
1610 if (aim_ssi_itemlist_valid(&od->ssi.local, cur->item)) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1611 struct aim_ssi_item *cur1; |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
1612 if ((cur1 = aim_ssi_itemlist_find(&od->ssi.official, cur->item->gid, cur->item->bid))) { |
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
1613 aim_ssi_item_set_name(&od->ssi.official, cur1, cur->item->name); |
17369
f80f7e1047be
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <mark@kingant.net>
parents:
17191
diff
changeset
|
1614 aim_tlvlist_free(cur1->data); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1615 cur1->data = aim_tlvlist_copy(cur->item->data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1616 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1617 } else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1618 cur->item = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1619 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1620 } else if (cur->action == SNAC_SUBTYPE_FEEDBAG_DEL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1621 /* Remove the item from the official list */ |
31836
8d6630912021
Add two hash tables to the oscar code that deals with your server stored
Mark Doliner <mark@kingant.net>
parents:
31243
diff
changeset
|
1622 if (aim_ssi_itemlist_valid(&od->ssi.official, cur->item)) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1623 aim_ssi_itemlist_del(&od->ssi.official, cur->item); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1624 cur->item = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1625 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1626 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1627 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1628 } /* End if (cur->item) */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1629 } /* End for loop */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1630 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1631 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1632 ret = userfunc(od, conn, frame, od->ssi.pending); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1633 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1634 /* Free all aim_ssi_tmp's with an outcome */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1635 cur = od->ssi.pending; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1636 while (cur && (cur->ack != 0xffff)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1637 del = cur; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1638 cur = cur->next; |
17191
1927f4ead3ca
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
16885
diff
changeset
|
1639 g_free(del->name); |
1927f4ead3ca
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
16885
diff
changeset
|
1640 g_free(del); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1641 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1642 od->ssi.pending = cur; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1643 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1644 /* If we're not waiting for any more acks, then send more SNACs */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1645 if (!od->ssi.pending) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1646 od->ssi.waiting_for_ack = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1647 aim_ssi_sync(od); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1648 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1649 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1650 return ret; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1651 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1652 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1653 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1654 * Subtype 0x000f - SSI Data Unchanged. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1655 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1656 * Response to aim_ssi_reqifchanged() if the server-side data is not newer than |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1657 * posted local stamp/revision. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1658 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1659 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1660 static int parsedataunchanged(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1661 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1662 int ret = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1663 aim_rxcallback_t userfunc; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1664 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1665 od->ssi.received_data = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1666 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1667 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1668 ret = userfunc(od, conn, frame); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1669 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1670 return ret; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1671 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1672 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1673 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1674 * Subtype 0x0011 - SSI Begin Data Modification. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1675 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1676 * Tell the server you're going to start modifying data. This marks |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1677 * the beginning of a transaction. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1678 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1679 int aim_ssi_modbegin(OscarData *od) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1680 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1681 FlapConnection *conn; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1682 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1683 if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_FEEDBAG))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1684 return -EINVAL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1685 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1686 aim_genericreq_n(od, conn, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_EDITSTART); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1687 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1688 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1689 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1690 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1691 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1692 * Subtype 0x0012 - SSI End Data Modification. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1693 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1694 * Tell the server you're finished modifying data. The marks the end |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1695 * of a transaction. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1696 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1697 int aim_ssi_modend(OscarData *od) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1698 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1699 FlapConnection *conn; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1700 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1701 if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_FEEDBAG))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1702 return -EINVAL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1703 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1704 aim_genericreq_n(od, conn, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_EDITSTOP); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1705 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1706 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1707 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1708 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1709 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1710 * Subtype 0x0015 - Receive an authorization grant |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1711 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1712 static int receiveauthgrant(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1713 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1714 int ret = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1715 aim_rxcallback_t userfunc; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1716 guint16 tmp; |
32376
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1717 char *bn, *msg, *tmpstr; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1718 |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
1719 /* Read buddy name */ |
32376
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1720 tmp = byte_stream_get8(bs); |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1721 if (!tmp) { |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1722 purple_debug_warning("oscar", "Dropping auth grant SNAC " |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1723 "because username was empty\n"); |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1724 return 0; |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1725 } |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1726 bn = byte_stream_getstr(bs, tmp); |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1727 if (!g_utf8_validate(bn, -1, NULL)) { |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1728 purple_debug_warning("oscar", "Dropping auth grant SNAC " |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1729 "because the username was not valid UTF-8\n"); |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1730 g_free(bn); |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1731 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1732 |
32376
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1733 /* Read message */ |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1734 tmp = byte_stream_get16(bs); |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1735 if (tmp) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1736 msg = byte_stream_getstr(bs, tmp); |
32376
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1737 if (!g_utf8_validate(msg, -1, NULL)) { |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1738 /* Ugh, msg isn't UTF8. Let's salvage. */ |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1739 purple_debug_warning("oscar", "Got non-UTF8 message in auth " |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1740 "grant from %s\n", bn); |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1741 tmpstr = purple_utf8_salvage(msg); |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1742 g_free(msg); |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1743 msg = tmpstr; |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1744 } |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1745 } else |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1746 msg = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1747 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1748 /* Unknown */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1749 tmp = byte_stream_get16(bs); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1750 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1751 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
1752 ret = userfunc(od, conn, frame, bn, msg); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1753 |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
1754 g_free(bn); |
17191
1927f4ead3ca
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
16885
diff
changeset
|
1755 g_free(msg); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1756 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1757 return ret; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1758 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1759 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1760 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1761 * Subtype 0x0018 - Send authorization request |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1762 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1763 * Sends a request for authorization to the given contact. The request will either be |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1764 * granted, denied, or dropped. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1765 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1766 */ |
31401
0cf50b0f7af4
Add invite message support to Oscar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31243
diff
changeset
|
1767 int aim_ssi_sendauthrequest(OscarData *od, const char *bn, const char *msg) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1768 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1769 FlapConnection *conn; |
22717
979a81468e19
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents:
21762
diff
changeset
|
1770 ByteStream bs; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1771 aim_snacid_t snacid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1772 |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
1773 if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_FEEDBAG)) || !bn) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1774 return -EINVAL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1775 |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
1776 byte_stream_new(&bs, 1+strlen(bn) + 2+(msg ? strlen(msg)+1 : 0) + 2); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1777 |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
1778 /* Username */ |
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
1779 byte_stream_put8(&bs, strlen(bn)); |
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
1780 byte_stream_putstr(&bs, bn); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1781 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1782 /* Message (null terminated) */ |
22717
979a81468e19
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents:
21762
diff
changeset
|
1783 byte_stream_put16(&bs, msg ? strlen(msg) : 0); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1784 if (msg) { |
22717
979a81468e19
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents:
21762
diff
changeset
|
1785 byte_stream_putstr(&bs, msg); |
979a81468e19
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents:
21762
diff
changeset
|
1786 byte_stream_put8(&bs, 0x00); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1787 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1788 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1789 /* Unknown */ |
22717
979a81468e19
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents:
21762
diff
changeset
|
1790 byte_stream_put16(&bs, 0x0000); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1791 |
22717
979a81468e19
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents:
21762
diff
changeset
|
1792 snacid = aim_cachesnac(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_SENDAUTHREQ, 0x0000, NULL, 0); |
30400
11c54d781835
Removed unused "flags" parameter.
ivan.komarov@soc.pidgin.im
parents:
30393
diff
changeset
|
1793 flap_connection_send_snac(od, conn, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_SENDAUTHREQ, snacid, &bs); |
22717
979a81468e19
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents:
21762
diff
changeset
|
1794 |
979a81468e19
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents:
21762
diff
changeset
|
1795 byte_stream_destroy(&bs); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1796 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1797 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1798 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1799 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1800 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1801 * Subtype 0x0019 - Receive an authorization request |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1802 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1803 static int receiveauthrequest(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1804 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1805 int ret = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1806 aim_rxcallback_t userfunc; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1807 guint16 tmp; |
32376
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1808 char *bn, *msg, *tmpstr; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1809 |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
1810 /* Read buddy name */ |
32376
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1811 tmp = byte_stream_get8(bs); |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1812 if (!tmp) { |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1813 purple_debug_warning("oscar", "Dropping auth request SNAC " |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1814 "because username was empty\n"); |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1815 return 0; |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1816 } |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1817 bn = byte_stream_getstr(bs, tmp); |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1818 if (!g_utf8_validate(bn, -1, NULL)) { |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1819 purple_debug_warning("oscar", "Dropping auth request SNAC " |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1820 "because the username was not valid UTF-8\n"); |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1821 g_free(bn); |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1822 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1823 |
32376
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1824 /* Read message */ |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1825 tmp = byte_stream_get16(bs); |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1826 if (tmp) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1827 msg = byte_stream_getstr(bs, tmp); |
32376
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1828 if (!g_utf8_validate(msg, -1, NULL)) { |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1829 /* Ugh, msg isn't UTF8. Let's salvage. */ |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1830 purple_debug_warning("oscar", "Got non-UTF8 message in auth " |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1831 "request from %s\n", bn); |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1832 tmpstr = purple_utf8_salvage(msg); |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1833 g_free(msg); |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1834 msg = tmpstr; |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1835 } |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1836 } else |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1837 msg = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1838 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1839 /* Unknown */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1840 tmp = byte_stream_get16(bs); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1841 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1842 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
1843 ret = userfunc(od, conn, frame, bn, msg); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1844 |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
1845 g_free(bn); |
17191
1927f4ead3ca
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
16885
diff
changeset
|
1846 g_free(msg); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1847 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1848 return ret; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1849 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1850 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1851 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1852 * Subtype 0x001a - Send authorization reply |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1853 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1854 * Sends a reply to a request for authorization. The reply can either |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1855 * grant authorization or deny authorization. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1856 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1857 * if reply=0x00 then deny |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1858 * if reply=0x01 then grant |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1859 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1860 */ |
31401
0cf50b0f7af4
Add invite message support to Oscar.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31243
diff
changeset
|
1861 int aim_ssi_sendauthreply(OscarData *od, const char *bn, guint8 reply, const char *msg) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1862 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1863 FlapConnection *conn; |
22717
979a81468e19
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents:
21762
diff
changeset
|
1864 ByteStream bs; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1865 aim_snacid_t snacid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1866 |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
1867 if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_FEEDBAG)) || !bn) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1868 return -EINVAL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1869 |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
1870 byte_stream_new(&bs, 1+strlen(bn) + 1 + 2+(msg ? (strlen(msg)+1) : 0) + 2); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1871 |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
1872 /* Username */ |
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
1873 byte_stream_put8(&bs, strlen(bn)); |
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
1874 byte_stream_putstr(&bs, bn); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1875 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1876 /* Grant or deny */ |
22717
979a81468e19
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents:
21762
diff
changeset
|
1877 byte_stream_put8(&bs, reply); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1878 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1879 /* Message (null terminated) */ |
22717
979a81468e19
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents:
21762
diff
changeset
|
1880 byte_stream_put16(&bs, msg ? (strlen(msg)+1) : 0); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1881 if (msg) { |
22717
979a81468e19
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents:
21762
diff
changeset
|
1882 byte_stream_putstr(&bs, msg); |
979a81468e19
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents:
21762
diff
changeset
|
1883 byte_stream_put8(&bs, 0x00); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1884 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1885 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1886 /* Unknown */ |
22717
979a81468e19
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents:
21762
diff
changeset
|
1887 byte_stream_put16(&bs, 0x0000); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1888 |
22717
979a81468e19
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents:
21762
diff
changeset
|
1889 snacid = aim_cachesnac(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_SENDAUTHREP, 0x0000, NULL, 0); |
30400
11c54d781835
Removed unused "flags" parameter.
ivan.komarov@soc.pidgin.im
parents:
30393
diff
changeset
|
1890 flap_connection_send_snac(od, conn, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_SENDAUTHREP, snacid, &bs); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1891 |
22717
979a81468e19
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evan.s@dreskin.net>
parents:
21762
diff
changeset
|
1892 byte_stream_destroy(&bs); |
22856
ab2322195dab
Minor changes... mostly whitespace related.
Mark Doliner <mark@kingant.net>
parents:
22720
diff
changeset
|
1893 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1894 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1895 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1896 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1897 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1898 * Subtype 0x001b - Receive an authorization reply |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1899 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1900 * You get this bad boy when other people respond to the authorization |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1901 * request that you have previously sent them. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1902 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1903 static int receiveauthreply(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1904 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1905 int ret = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1906 aim_rxcallback_t userfunc; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1907 guint16 tmp; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1908 guint8 reply; |
32376
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1909 char *bn, *msg, *tmpstr; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1910 |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
1911 /* Read buddy name */ |
32376
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1912 tmp = byte_stream_get8(bs); |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1913 if (!tmp) { |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1914 purple_debug_warning("oscar", "Dropping auth reply SNAC " |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1915 "because username was empty\n"); |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1916 return 0; |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1917 } |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1918 bn = byte_stream_getstr(bs, tmp); |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1919 if (!g_utf8_validate(bn, -1, NULL)) { |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1920 purple_debug_warning("oscar", "Dropping auth reply SNAC " |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1921 "because the username was not valid UTF-8\n"); |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1922 g_free(bn); |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1923 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1924 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1925 /* Read reply */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1926 reply = byte_stream_get8(bs); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1927 |
32376
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1928 /* Read message */ |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1929 tmp = byte_stream_get16(bs); |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1930 if (tmp) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1931 msg = byte_stream_getstr(bs, tmp); |
32376
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1932 if (!g_utf8_validate(msg, -1, NULL)) { |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1933 /* Ugh, msg isn't UTF8. Let's salvage. */ |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1934 purple_debug_warning("oscar", "Got non-UTF8 message in auth " |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1935 "reply from %s\n", bn); |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1936 tmpstr = purple_utf8_salvage(msg); |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1937 g_free(msg); |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1938 msg = tmpstr; |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1939 } |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1940 } else |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1941 msg = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1942 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1943 /* Unknown */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1944 tmp = byte_stream_get16(bs); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1945 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1946 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
1947 ret = userfunc(od, conn, frame, bn, reply, msg); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1948 |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
1949 g_free(bn); |
17191
1927f4ead3ca
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
16885
diff
changeset
|
1950 g_free(msg); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1951 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1952 return ret; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1953 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1954 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1955 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1956 * Subtype 0x001c - Receive a message telling you someone added you to their list. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1957 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1958 static int receiveadded(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1959 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1960 int ret = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1961 aim_rxcallback_t userfunc; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1962 guint16 tmp; |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
1963 char *bn; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1964 |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
1965 /* Read buddy name */ |
32376
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1966 tmp = byte_stream_get8(bs); |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1967 if (!tmp) { |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1968 purple_debug_warning("oscar", "Dropping 'you were added' SNAC " |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1969 "because username was empty\n"); |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1970 return 0; |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1971 } |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1972 bn = byte_stream_getstr(bs, tmp); |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1973 if (!g_utf8_validate(bn, -1, NULL)) { |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1974 purple_debug_warning("oscar", "Dropping 'you were added' SNAC " |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1975 "because the username was not valid UTF-8\n"); |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1976 g_free(bn); |
82024b6ea465
Fix remotely-triggerable crashes by validating strings in a few
Mark Doliner <mark@kingant.net>
parents:
31667
diff
changeset
|
1977 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1978 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1979 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
1980 ret = userfunc(od, conn, frame, bn); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1981 |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22856
diff
changeset
|
1982 g_free(bn); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1983 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1984 return ret; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1985 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1986 |
30367
05c634403678
Start using the real ICQ block list (SSI type 0xe) for allowing/blocking
ivan.komarov@soc.pidgin.im
parents:
28496
diff
changeset
|
1987 /* |
05c634403678
Start using the real ICQ block list (SSI type 0xe) for allowing/blocking
ivan.komarov@soc.pidgin.im
parents:
28496
diff
changeset
|
1988 * If we're on ICQ, then AIM_SSI_TYPE_DENY is used for the "permanently invisible" list. |
05c634403678
Start using the real ICQ block list (SSI type 0xe) for allowing/blocking
ivan.komarov@soc.pidgin.im
parents:
28496
diff
changeset
|
1989 * AIM_SSI_TYPE_ICQDENY is used for blocking users instead. |
05c634403678
Start using the real ICQ block list (SSI type 0xe) for allowing/blocking
ivan.komarov@soc.pidgin.im
parents:
28496
diff
changeset
|
1990 */ |
05c634403678
Start using the real ICQ block list (SSI type 0xe) for allowing/blocking
ivan.komarov@soc.pidgin.im
parents:
28496
diff
changeset
|
1991 guint16 |
05c634403678
Start using the real ICQ block list (SSI type 0xe) for allowing/blocking
ivan.komarov@soc.pidgin.im
parents:
28496
diff
changeset
|
1992 aim_ssi_getdenyentrytype(OscarData* od) |
05c634403678
Start using the real ICQ block list (SSI type 0xe) for allowing/blocking
ivan.komarov@soc.pidgin.im
parents:
28496
diff
changeset
|
1993 { |
05c634403678
Start using the real ICQ block list (SSI type 0xe) for allowing/blocking
ivan.komarov@soc.pidgin.im
parents:
28496
diff
changeset
|
1994 return od->icq ? AIM_SSI_TYPE_ICQDENY : AIM_SSI_TYPE_DENY; |
05c634403678
Start using the real ICQ block list (SSI type 0xe) for allowing/blocking
ivan.komarov@soc.pidgin.im
parents:
28496
diff
changeset
|
1995 } |
05c634403678
Start using the real ICQ block list (SSI type 0xe) for allowing/blocking
ivan.komarov@soc.pidgin.im
parents:
28496
diff
changeset
|
1996 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1997 static int |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1998 snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1999 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2000 if (snac->subtype == SNAC_SUBTYPE_FEEDBAG_RIGHTSINFO) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2001 return parserights(od, conn, mod, frame, snac, bs); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2002 else if (snac->subtype == SNAC_SUBTYPE_FEEDBAG_LIST) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2003 return parsedata(od, conn, mod, frame, snac, bs); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2004 else if (snac->subtype == SNAC_SUBTYPE_FEEDBAG_ADD) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2005 return parseadd(od, conn, mod, frame, snac, bs); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2006 else if (snac->subtype == SNAC_SUBTYPE_FEEDBAG_MOD) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2007 return parsemod(od, conn, mod, frame, snac, bs); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2008 else if (snac->subtype == SNAC_SUBTYPE_FEEDBAG_DEL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2009 return parsedel(od, conn, mod, frame, snac, bs); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2010 else if (snac->subtype == SNAC_SUBTYPE_FEEDBAG_SRVACK) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2011 return parseack(od, conn, mod, frame, snac, bs); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2012 else if (snac->subtype == SNAC_SUBTYPE_FEEDBAG_NOLIST) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2013 return parsedataunchanged(od, conn, mod, frame, snac, bs); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2014 else if (snac->subtype == SNAC_SUBTYPE_FEEDBAG_RECVAUTH) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2015 return receiveauthgrant(od, conn, mod, frame, snac, bs); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2016 else if (snac->subtype == SNAC_SUBTYPE_FEEDBAG_RECVAUTHREQ) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2017 return receiveauthrequest(od, conn, mod, frame, snac, bs); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2018 else if (snac->subtype == SNAC_SUBTYPE_FEEDBAG_RECVAUTHREP) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2019 return receiveauthreply(od, conn, mod, frame, snac, bs); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2020 else if (snac->subtype == SNAC_SUBTYPE_FEEDBAG_ADDED) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2021 return receiveadded(od, conn, mod, frame, snac, bs); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2022 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2023 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2024 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2025 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2026 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2027 ssi_shutdown(OscarData *od, aim_module_t *mod) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2028 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2029 aim_ssi_freelist(od); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2030 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2031 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2032 int |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2033 ssi_modfirst(OscarData *od, aim_module_t *mod) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2034 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2035 mod->family = SNAC_FAMILY_FEEDBAG; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2036 mod->version = 0x0004; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2037 mod->toolid = 0x0110; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2038 mod->toolversion = 0x0629; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2039 mod->flags = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2040 strncpy(mod->name, "feedbag", sizeof(mod->name)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2041 mod->snachandler = snachandler; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2042 mod->shutdown = ssi_shutdown; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2043 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2044 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2045 } |