14192
|
1 /*
|
|
2 * Gaim's oscar protocol plugin
|
|
3 * This file is the legal property of its developers.
|
|
4 * Please see the AUTHORS file distributed alongside this file.
|
|
5 *
|
|
6 * This library is free software; you can redistribute it and/or
|
|
7 * modify it under the terms of the GNU Lesser General Public
|
|
8 * License as published by the Free Software Foundation; either
|
|
9 * version 2 of the License, or (at your option) any later version.
|
|
10 *
|
|
11 * This library is distributed in the hope that it will be useful,
|
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
14 * Lesser General Public License for more details.
|
|
15 *
|
|
16 * You should have received a copy of the GNU Lesser General Public
|
|
17 * License along with this library; if not, write to the Free Software
|
|
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
19 */
|
|
20
|
|
21 #include "oscar.h"
|
|
22 #include "peer.h"
|
|
23
|
|
24 aim_module_t *aim__findmodulebygroup(OscarData *od, guint16 group)
|
|
25 {
|
|
26 aim_module_t *cur;
|
|
27
|
|
28 for (cur = (aim_module_t *)od->modlistv; cur; cur = cur->next) {
|
|
29 if (cur->family == group)
|
|
30 return cur;
|
|
31 }
|
|
32
|
|
33 return NULL;
|
|
34 }
|
|
35
|
|
36 aim_module_t *aim__findmodule(OscarData *od, const char *name)
|
|
37 {
|
|
38 aim_module_t *cur;
|
|
39
|
|
40 for (cur = (aim_module_t *)od->modlistv; cur; cur = cur->next) {
|
|
41 if (strcmp(name, cur->name) == 0)
|
|
42 return cur;
|
|
43 }
|
|
44
|
|
45 return NULL;
|
|
46 }
|
|
47
|
|
48 int aim__registermodule(OscarData *od, int (*modfirst)(OscarData *, aim_module_t *))
|
|
49 {
|
|
50 aim_module_t *mod;
|
|
51
|
|
52 if (!od || !modfirst)
|
|
53 return -1;
|
|
54
|
|
55 mod = g_new0(aim_module_t, 1);
|
|
56
|
|
57 if (modfirst(od, mod) == -1) {
|
|
58 free(mod);
|
|
59 return -1;
|
|
60 }
|
|
61
|
|
62 if (aim__findmodule(od, mod->name)) {
|
|
63 if (mod->shutdown)
|
|
64 mod->shutdown(od, mod);
|
|
65 free(mod);
|
|
66 return -1;
|
|
67 }
|
|
68
|
|
69 mod->next = (aim_module_t *)od->modlistv;
|
|
70 od->modlistv = mod;
|
|
71
|
|
72 gaim_debug_misc("oscar", "registered module %s (family 0x%04x, version = 0x%04x, tool 0x%04x, tool version 0x%04x)\n", mod->name, mod->family, mod->version, mod->toolid, mod->toolversion);
|
|
73
|
|
74 return 0;
|
|
75 }
|
|
76
|
|
77 void aim__shutdownmodules(OscarData *od)
|
|
78 {
|
|
79 aim_module_t *cur;
|
|
80
|
|
81 for (cur = (aim_module_t *)od->modlistv; cur; ) {
|
|
82 aim_module_t *tmp;
|
|
83
|
|
84 tmp = cur->next;
|
|
85
|
|
86 if (cur->shutdown)
|
|
87 cur->shutdown(od, cur);
|
|
88
|
|
89 free(cur);
|
|
90
|
|
91 cur = tmp;
|
|
92 }
|
|
93
|
|
94 od->modlistv = NULL;
|
|
95
|
|
96 return;
|
|
97 }
|
|
98
|
|
99 #if 0
|
|
100 /*
|
|
101 * Bleck functions get called when there's no non-bleck functions
|
|
102 * around to cleanup the mess...
|
|
103 */
|
|
104 static int bleck(OscarData *od, FlapFrame *frame, ...)
|
|
105 {
|
|
106 guint16 family, subtype;
|
|
107 guint16 maxf, maxs;
|
|
108
|
|
109 static const char *channels[6] = {
|
|
110 "Invalid (0)",
|
|
111 "FLAP Version",
|
|
112 "SNAC",
|
|
113 "Invalid (3)",
|
|
114 "Negotiation",
|
|
115 "FLAP NOP"
|
|
116 };
|
|
117 static const int maxchannels = 5;
|
|
118
|
|
119 /* XXX: this is ugly. and big just for debugging. */
|
|
120 static const char *literals[14][25] = {
|
|
121 {"Invalid",
|
|
122 NULL
|
|
123 },
|
|
124 {"General",
|
|
125 "Invalid",
|
|
126 "Error",
|
|
127 "Client Ready",
|
|
128 "Server Ready",
|
|
129 "Service Request",
|
|
130 "Redirect",
|
|
131 "Rate Information Request",
|
|
132 "Rate Information",
|
|
133 "Rate Information Ack",
|
|
134 NULL,
|
|
135 "Rate Information Change",
|
|
136 "Server Pause",
|
|
137 NULL,
|
|
138 "Server Resume",
|
|
139 "Request Personal User Information",
|
|
140 "Personal User Information",
|
|
141 "Evil Notification",
|
|
142 NULL,
|
|
143 "Migration notice",
|
|
144 "Message of the Day",
|
|
145 "Set Privacy Flags",
|
|
146 "Well Known URL",
|
|
147 "NOP"
|
|
148 },
|
|
149 {"Location",
|
|
150 "Invalid",
|
|
151 "Error",
|
|
152 "Request Rights",
|
|
153 "Rights Information",
|
|
154 "Set user information",
|
|
155 "Request User Information",
|
|
156 "User Information",
|
|
157 "Watcher Sub Request",
|
|
158 "Watcher Notification"
|
|
159 },
|
|
160 {"Buddy List Management",
|
|
161 "Invalid",
|
|
162 "Error",
|
|
163 "Request Rights",
|
|
164 "Rights Information",
|
|
165 "Add Buddy",
|
|
166 "Remove Buddy",
|
|
167 "Watcher List Query",
|
|
168 "Watcher List Response",
|
|
169 "Watcher SubRequest",
|
|
170 "Watcher Notification",
|
|
171 "Reject Notification",
|
|
172 "Oncoming Buddy",
|
|
173 "Offgoing Buddy"
|
|
174 },
|
|
175 {"Messeging",
|
|
176 "Invalid",
|
|
177 "Error",
|
|
178 "Add ICBM Parameter",
|
|
179 "Remove ICBM Parameter",
|
|
180 "Request Parameter Information",
|
|
181 "Parameter Information",
|
|
182 "Outgoing Message",
|
|
183 "Incoming Message",
|
|
184 "Evil Request",
|
|
185 "Evil Reply",
|
|
186 "Missed Calls",
|
|
187 "Message Error",
|
|
188 "Host Ack"
|
|
189 },
|
|
190 {"Advertisements",
|
|
191 "Invalid",
|
|
192 "Error",
|
|
193 "Request Ad",
|
|
194 "Ad Data (GIFs)"
|
|
195 },
|
|
196 {"Invitation / Client-to-Client",
|
|
197 "Invalid",
|
|
198 "Error",
|
|
199 "Invite a Friend",
|
|
200 "Invitation Ack"
|
|
201 },
|
|
202 {"Administrative",
|
|
203 "Invalid",
|
|
204 "Error",
|
|
205 "Information Request",
|
|
206 "Information Reply",
|
|
207 "Information Change Request",
|
|
208 "Information Chat Reply",
|
|
209 "Account Confirm Request",
|
|
210 "Account Confirm Reply",
|
|
211 "Account Delete Request",
|
|
212 "Account Delete Reply"
|
|
213 },
|
|
214 {"Popups",
|
|
215 "Invalid",
|
|
216 "Error",
|
|
217 "Display Popup"
|
|
218 },
|
|
219 {"BOS",
|
|
220 "Invalid",
|
|
221 "Error",
|
|
222 "Request Rights",
|
|
223 "Rights Response",
|
|
224 "Set group permission mask",
|
|
225 "Add permission list entries",
|
|
226 "Delete permission list entries",
|
|
227 "Add deny list entries",
|
|
228 "Delete deny list entries",
|
|
229 "Server Error"
|
|
230 },
|
|
231 {"User Lookup",
|
|
232 "Invalid",
|
|
233 "Error",
|
|
234 "Search Request",
|
|
235 "Search Response"
|
|
236 },
|
|
237 {"Stats",
|
|
238 "Invalid",
|
|
239 "Error",
|
|
240 "Set minimum report interval",
|
|
241 "Report Events"
|
|
242 },
|
|
243 {"Translate",
|
|
244 "Invalid",
|
|
245 "Error",
|
|
246 "Translate Request",
|
|
247 "Translate Reply",
|
|
248 },
|
|
249 {"Chat Navigation",
|
|
250 "Invalid",
|
|
251 "Error",
|
|
252 "Request rights",
|
|
253 "Request Exchange Information",
|
|
254 "Request Room Information",
|
|
255 "Request Occupant List",
|
|
256 "Search for Room",
|
|
257 "Outgoing Message",
|
|
258 "Incoming Message",
|
|
259 "Evil Request",
|
|
260 "Evil Reply",
|
|
261 "Chat Error",
|
|
262 }
|
|
263 };
|
|
264
|
|
265 maxf = sizeof(literals) / sizeof(literals[0]);
|
|
266 maxs = sizeof(literals[0]) / sizeof(literals[0][0]);
|
|
267
|
|
268 if (frame->channel == 0x02) {
|
|
269
|
|
270 family = byte_stream_get16(&frame->data);
|
|
271 subtype = byte_stream_get16(&frame->data);
|
|
272
|
|
273 if ((family < maxf) && (subtype+1 < maxs) && (literals[family][subtype] != NULL))
|
|
274 gaim_debug_misc("oscar", "bleck: channel %s: null handler for %04x/%04x (%s)\n", channels[frame->channel], family, subtype, literals[family][subtype+1]);
|
|
275 else
|
|
276 gaim_debug_misc("oscar", "bleck: channel %s: null handler for %04x/%04x (no literal)\n", channels[frame->channel], family, subtype);
|
|
277 } else {
|
|
278
|
|
279 if (frame->channel <= maxchannels)
|
|
280 gaim_debug_misc("oscar", "bleck: channel %s (0x%02x)\n", channels[frame->channel], frame->channel);
|
|
281 else
|
|
282 gaim_debug_misc("oscar", "bleck: unknown channel 0x%02x\n", frame->channel);
|
|
283
|
|
284 }
|
|
285
|
|
286 return 1;
|
|
287 }
|
|
288 #endif
|