13234
|
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 /*
|
|
22 * Family 0x000e - Routines for the Chat service.
|
|
23 *
|
|
24 */
|
|
25
|
|
26 #include "oscar.h"
|
|
27
|
|
28 #include <string.h>
|
|
29
|
|
30 /* Stored in the ->internal of chat connections */
|
13592
|
31 struct chatconnpriv
|
|
32 {
|
13234
|
33 guint16 exchange;
|
|
34 char *name;
|
|
35 guint16 instance;
|
|
36 };
|
|
37
|
13592
|
38 void
|
|
39 flap_connection_destroy_chat(OscarData *od, FlapConnection *conn)
|
13234
|
40 {
|
|
41 struct chatconnpriv *ccp = (struct chatconnpriv *)conn->internal;
|
|
42
|
|
43 if (ccp)
|
|
44 free(ccp->name);
|
|
45 free(ccp);
|
|
46
|
|
47 return;
|
|
48 }
|
|
49
|
13592
|
50 char *
|
|
51 aim_chat_getname(FlapConnection *conn)
|
13234
|
52 {
|
|
53 struct chatconnpriv *ccp;
|
|
54
|
|
55 if (!conn)
|
|
56 return NULL;
|
|
57
|
13592
|
58 if (conn->type != SNAC_FAMILY_CHAT)
|
13234
|
59 return NULL;
|
|
60
|
|
61 ccp = (struct chatconnpriv *)conn->internal;
|
|
62
|
|
63 return ccp->name;
|
|
64 }
|
|
65
|
|
66 /* XXX get this into conn.c -- evil!! */
|
13592
|
67 FlapConnection *
|
|
68 aim_chat_getconn(OscarData *od, const char *name)
|
13234
|
69 {
|
13254
|
70 GList *cur;
|
13234
|
71
|
13592
|
72 for (cur = od->oscar_connections; cur; cur = cur->next)
|
13254
|
73 {
|
13592
|
74 FlapConnection *conn;
|
13254
|
75 struct chatconnpriv *ccp;
|
13234
|
76
|
13254
|
77 conn = cur->data;
|
|
78 ccp = (struct chatconnpriv *)conn->internal;
|
|
79
|
13592
|
80 if (conn->type != SNAC_FAMILY_CHAT)
|
13234
|
81 continue;
|
13254
|
82 if (!conn->internal) {
|
|
83 gaim_debug_misc("oscar", "faim: chat: chat connection with no name! (fd = %d)\n", conn->fd);
|
13234
|
84 continue;
|
|
85 }
|
|
86
|
|
87 if (strcmp(ccp->name, name) == 0)
|
13254
|
88 return conn;;
|
13234
|
89 }
|
|
90
|
13254
|
91 return NULL;
|
13234
|
92 }
|
|
93
|
13592
|
94 int
|
|
95 aim_chat_attachname(FlapConnection *conn, guint16 exchange, const char *roomname, guint16 instance)
|
13234
|
96 {
|
|
97 struct chatconnpriv *ccp;
|
|
98
|
|
99 if (!conn || !roomname)
|
|
100 return -EINVAL;
|
|
101
|
|
102 if (conn->internal)
|
|
103 free(conn->internal);
|
|
104
|
13592
|
105 ccp = g_new(struct chatconnpriv, 1);
|
13234
|
106
|
|
107 ccp->exchange = exchange;
|
|
108 ccp->name = strdup(roomname);
|
|
109 ccp->instance = instance;
|
|
110
|
|
111 conn->internal = (void *)ccp;
|
|
112
|
|
113 return 0;
|
|
114 }
|
|
115
|
13592
|
116 int
|
|
117 aim_chat_readroominfo(ByteStream *bs, struct aim_chat_roominfo *outinfo)
|
13234
|
118 {
|
|
119 int namelen;
|
|
120
|
|
121 if (!bs || !outinfo)
|
|
122 return 0;
|
|
123
|
13592
|
124 outinfo->exchange = byte_stream_get16(bs);
|
|
125 namelen = byte_stream_get8(bs);
|
|
126 outinfo->name = byte_stream_getstr(bs, namelen);
|
|
127 outinfo->instance = byte_stream_get16(bs);
|
13234
|
128
|
|
129 return 0;
|
|
130 }
|
|
131
|
13592
|
132 int
|
|
133 aim_chat_leaveroom(OscarData *od, const char *name)
|
13234
|
134 {
|
13592
|
135 FlapConnection *conn;
|
13234
|
136
|
13592
|
137 if (!(conn = aim_chat_getconn(od, name)))
|
13234
|
138 return -ENOENT;
|
|
139
|
13592
|
140 flap_connection_close(od, conn);
|
13234
|
141
|
|
142 return 0;
|
|
143 }
|
|
144
|
|
145 /*
|
|
146 * Subtype 0x0002 - General room information. Lots of stuff.
|
|
147 *
|
|
148 * Values I know are in here but I haven't attached
|
|
149 * them to any of the 'Unknown's:
|
|
150 * - Language (English)
|
|
151 *
|
|
152 */
|
13592
|
153 static int
|
|
154 infoupdate(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs)
|
13234
|
155 {
|
|
156 aim_userinfo_t *userinfo = NULL;
|
|
157 aim_rxcallback_t userfunc;
|
|
158 int ret = 0;
|
|
159 int usercount = 0;
|
|
160 guint8 detaillevel = 0;
|
|
161 char *roomname = NULL;
|
|
162 struct aim_chat_roominfo roominfo;
|
|
163 guint16 tlvcount = 0;
|
|
164 aim_tlvlist_t *tlvlist;
|
|
165 char *roomdesc = NULL;
|
|
166 guint16 flags = 0;
|
|
167 guint32 creationtime = 0;
|
|
168 guint16 maxmsglen = 0, maxvisiblemsglen = 0;
|
|
169 guint16 unknown_d2 = 0, unknown_d5 = 0;
|
|
170
|
|
171 aim_chat_readroominfo(bs, &roominfo);
|
|
172
|
13592
|
173 detaillevel = byte_stream_get8(bs);
|
13234
|
174
|
|
175 if (detaillevel != 0x02) {
|
|
176 gaim_debug_misc("oscar", "faim: chat_roomupdateinfo: detail level %d not supported\n", detaillevel);
|
|
177 return 1;
|
|
178 }
|
|
179
|
13592
|
180 tlvcount = byte_stream_get16(bs);
|
13234
|
181
|
|
182 /*
|
|
183 * Everything else are TLVs.
|
|
184 */
|
|
185 tlvlist = aim_tlvlist_read(bs);
|
|
186
|
|
187 /*
|
|
188 * TLV type 0x006a is the room name in Human Readable Form.
|
|
189 */
|
|
190 if (aim_tlv_gettlv(tlvlist, 0x006a, 1))
|
|
191 roomname = aim_tlv_getstr(tlvlist, 0x006a, 1);
|
|
192
|
|
193 /*
|
|
194 * Type 0x006f: Number of occupants.
|
|
195 */
|
|
196 if (aim_tlv_gettlv(tlvlist, 0x006f, 1))
|
|
197 usercount = aim_tlv_get16(tlvlist, 0x006f, 1);
|
|
198
|
|
199 /*
|
|
200 * Type 0x0073: Occupant list.
|
|
201 */
|
|
202 if (aim_tlv_gettlv(tlvlist, 0x0073, 1)) {
|
|
203 int curoccupant = 0;
|
|
204 aim_tlv_t *tmptlv;
|
13239
|
205 ByteStream occbs;
|
13234
|
206
|
|
207 tmptlv = aim_tlv_gettlv(tlvlist, 0x0073, 1);
|
|
208
|
|
209 /* Allocate enough userinfo structs for all occupants */
|
|
210 userinfo = calloc(usercount, sizeof(aim_userinfo_t));
|
|
211
|
13592
|
212 byte_stream_init(&occbs, tmptlv->value, tmptlv->length);
|
13234
|
213
|
|
214 while (curoccupant < usercount)
|
13592
|
215 aim_info_extract(od, &occbs, &userinfo[curoccupant++]);
|
13234
|
216 }
|
|
217
|
|
218 /*
|
|
219 * Type 0x00c9: Flags. (AIM_CHATROOM_FLAG)
|
|
220 */
|
|
221 if (aim_tlv_gettlv(tlvlist, 0x00c9, 1))
|
|
222 flags = aim_tlv_get16(tlvlist, 0x00c9, 1);
|
|
223
|
|
224 /*
|
|
225 * Type 0x00ca: Creation time (4 bytes)
|
|
226 */
|
|
227 if (aim_tlv_gettlv(tlvlist, 0x00ca, 1))
|
|
228 creationtime = aim_tlv_get32(tlvlist, 0x00ca, 1);
|
|
229
|
|
230 /*
|
|
231 * Type 0x00d1: Maximum Message Length
|
|
232 */
|
|
233 if (aim_tlv_gettlv(tlvlist, 0x00d1, 1))
|
|
234 maxmsglen = aim_tlv_get16(tlvlist, 0x00d1, 1);
|
|
235
|
|
236 /*
|
|
237 * Type 0x00d2: Unknown. (2 bytes)
|
|
238 */
|
|
239 if (aim_tlv_gettlv(tlvlist, 0x00d2, 1))
|
|
240 unknown_d2 = aim_tlv_get16(tlvlist, 0x00d2, 1);
|
|
241
|
|
242 /*
|
|
243 * Type 0x00d3: Room Description
|
|
244 */
|
|
245 if (aim_tlv_gettlv(tlvlist, 0x00d3, 1))
|
|
246 roomdesc = aim_tlv_getstr(tlvlist, 0x00d3, 1);
|
|
247
|
|
248 #if 0
|
|
249 /*
|
|
250 * Type 0x000d4: Unknown (flag only)
|
|
251 */
|
|
252 if (aim_tlv_gettlv(tlvlist, 0x000d4, 1)) {
|
|
253 /* Unhandled */
|
|
254 }
|
|
255 #endif
|
|
256
|
|
257 /*
|
|
258 * Type 0x00d5: Unknown. (1 byte)
|
|
259 */
|
|
260 if (aim_tlv_gettlv(tlvlist, 0x00d5, 1))
|
|
261 unknown_d5 = aim_tlv_get8(tlvlist, 0x00d5, 1);
|
|
262
|
|
263 #if 0
|
|
264 /*
|
|
265 * Type 0x00d6: Encoding 1 ("us-ascii")
|
|
266 */
|
|
267 if (aim_tlv_gettlv(tlvlist, 0x000d6, 1)) {
|
|
268 /* Unhandled */
|
|
269 }
|
|
270
|
|
271 /*
|
|
272 * Type 0x00d7: Language 1 ("en")
|
|
273 */
|
|
274 if (aim_tlv_gettlv(tlvlist, 0x000d7, 1)) {
|
|
275 /* Unhandled */
|
|
276 }
|
|
277
|
|
278 /*
|
|
279 * Type 0x00d8: Encoding 2 ("us-ascii")
|
|
280 */
|
|
281 if (aim_tlv_gettlv(tlvlist, 0x000d8, 1)) {
|
|
282 /* Unhandled */
|
|
283 }
|
|
284
|
|
285 /*
|
|
286 * Type 0x00d9: Language 2 ("en")
|
|
287 */
|
|
288 if (aim_tlv_gettlv(tlvlist, 0x000d9, 1)) {
|
|
289 /* Unhandled */
|
|
290 }
|
|
291 #endif
|
|
292
|
|
293 /*
|
|
294 * Type 0x00da: Maximum visible message length
|
|
295 */
|
|
296 if (aim_tlv_gettlv(tlvlist, 0x000da, 1))
|
|
297 maxvisiblemsglen = aim_tlv_get16(tlvlist, 0x00da, 1);
|
|
298
|
13592
|
299 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) {
|
|
300 ret = userfunc(od, conn,
|
|
301 frame,
|
13234
|
302 &roominfo,
|
|
303 roomname,
|
|
304 usercount,
|
|
305 userinfo,
|
|
306 roomdesc,
|
|
307 flags,
|
|
308 creationtime,
|
|
309 maxmsglen,
|
|
310 unknown_d2,
|
|
311 unknown_d5,
|
|
312 maxvisiblemsglen);
|
|
313 }
|
|
314
|
|
315 free(roominfo.name);
|
|
316
|
|
317 while (usercount > 0)
|
|
318 aim_info_free(&userinfo[--usercount]);
|
|
319
|
|
320 free(userinfo);
|
|
321 free(roomname);
|
|
322 free(roomdesc);
|
|
323 aim_tlvlist_free(&tlvlist);
|
|
324
|
|
325 return ret;
|
|
326 }
|
|
327
|
|
328 /* Subtypes 0x0003 and 0x0004 */
|
13592
|
329 static int
|
|
330 userlistchange(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs)
|
13234
|
331 {
|
|
332 aim_userinfo_t *userinfo = NULL;
|
|
333 aim_rxcallback_t userfunc;
|
|
334 int curcount = 0, ret = 0;
|
|
335
|
13592
|
336 while (byte_stream_empty(bs)) {
|
13234
|
337 curcount++;
|
|
338 userinfo = realloc(userinfo, curcount * sizeof(aim_userinfo_t));
|
13592
|
339 aim_info_extract(od, bs, &userinfo[curcount-1]);
|
13234
|
340 }
|
|
341
|
13592
|
342 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype)))
|
|
343 ret = userfunc(od, conn, frame, curcount, userinfo);
|
13234
|
344
|
|
345 aim_info_free(userinfo);
|
|
346 free(userinfo);
|
|
347
|
|
348 return ret;
|
|
349 }
|
|
350
|
|
351 /*
|
|
352 * Subtype 0x0005 - Send a Chat Message.
|
|
353 *
|
|
354 * Possible flags:
|
|
355 * AIM_CHATFLAGS_NOREFLECT -- Unset the flag that requests messages
|
|
356 * should be sent to their sender.
|
|
357 * AIM_CHATFLAGS_AWAY -- Mark the message as an autoresponse
|
|
358 * (Note that WinAIM does not honor this,
|
|
359 * and displays the message as normal.)
|
|
360 *
|
|
361 * XXX convert this to use tlvchains
|
|
362 */
|
13592
|
363 int
|
|
364 aim_chat_send_im(OscarData *od, FlapConnection *conn, guint16 flags, const gchar *msg, int msglen, const char *encoding, const char *language)
|
13234
|
365 {
|
|
366 int i;
|
13592
|
367 FlapFrame *frame;
|
13239
|
368 IcbmCookie *cookie;
|
13234
|
369 aim_snacid_t snacid;
|
|
370 guint8 ckstr[8];
|
|
371 aim_tlvlist_t *otl = NULL, *itl = NULL;
|
|
372
|
13592
|
373 if (!od || !conn || !msg || (msglen <= 0))
|
13234
|
374 return 0;
|
|
375
|
13592
|
376 frame = flap_frame_new(od, 0x02, 1152);
|
13234
|
377
|
13592
|
378 snacid = aim_cachesnac(od, 0x000e, 0x0005, 0x0000, NULL, 0);
|
|
379 aim_putsnac(&frame->data, 0x000e, 0x0005, 0x0000, snacid);
|
13234
|
380
|
|
381 /*
|
|
382 * Cookie
|
|
383 *
|
|
384 * XXX mkcookie should generate the cookie and cache it in one
|
|
385 * operation to preserve uniqueness.
|
|
386 */
|
|
387 for (i = 0; i < 8; i++)
|
|
388 ckstr[i] = (guint8)rand();
|
|
389
|
|
390 cookie = aim_mkcookie(ckstr, AIM_COOKIETYPE_CHAT, NULL);
|
|
391 cookie->data = NULL; /* XXX store something useful here */
|
|
392
|
13592
|
393 aim_cachecookie(od, cookie);
|
13234
|
394
|
|
395 /* ICBM Header */
|
13592
|
396 byte_stream_putraw(&frame->data, ckstr, 8); /* Cookie */
|
|
397 byte_stream_put16(&frame->data, 0x0003); /* Channel */
|
13234
|
398
|
|
399 /*
|
|
400 * Type 1: Flag meaning this message is destined to the room.
|
|
401 */
|
|
402 aim_tlvlist_add_noval(&otl, 0x0001);
|
|
403
|
|
404 /*
|
|
405 * Type 6: Reflect
|
|
406 */
|
|
407 if (!(flags & AIM_CHATFLAGS_NOREFLECT))
|
|
408 aim_tlvlist_add_noval(&otl, 0x0006);
|
|
409
|
|
410 /*
|
|
411 * Type 7: Autoresponse
|
|
412 */
|
|
413 if (flags & AIM_CHATFLAGS_AWAY)
|
|
414 aim_tlvlist_add_noval(&otl, 0x0007);
|
|
415
|
|
416 /*
|
|
417 * SubTLV: Type 1: Message
|
|
418 */
|
|
419 aim_tlvlist_add_raw(&itl, 0x0001, msglen, (guchar *)msg);
|
|
420
|
|
421 /*
|
|
422 * SubTLV: Type 2: Encoding
|
|
423 */
|
|
424 if (encoding != NULL)
|
|
425 aim_tlvlist_add_str(&itl, 0x0002, encoding);
|
|
426
|
|
427 /*
|
|
428 * SubTLV: Type 3: Language
|
|
429 */
|
|
430 if (language != NULL)
|
|
431 aim_tlvlist_add_str(&itl, 0x0003, language);
|
|
432
|
|
433 /*
|
|
434 * Type 5: Message block. Contains more TLVs.
|
|
435 *
|
|
436 * This could include other information... We just
|
|
437 * put in a message TLV however.
|
|
438 *
|
|
439 */
|
|
440 aim_tlvlist_add_frozentlvlist(&otl, 0x0005, &itl);
|
|
441
|
13592
|
442 aim_tlvlist_write(&frame->data, &otl);
|
13234
|
443
|
|
444 aim_tlvlist_free(&itl);
|
|
445 aim_tlvlist_free(&otl);
|
|
446
|
13592
|
447 flap_connection_send(conn, frame);
|
13234
|
448
|
|
449 return 0;
|
|
450 }
|
|
451
|
|
452 /*
|
|
453 * Subtype 0x0006
|
|
454 *
|
|
455 * We could probably include this in the normal ICBM parsing
|
|
456 * code as channel 0x0003, however, since only the start
|
|
457 * would be the same, we might as well do it here.
|
|
458 *
|
|
459 * General outline of this SNAC:
|
|
460 * snac
|
|
461 * cookie
|
|
462 * channel id
|
|
463 * tlvlist
|
|
464 * unknown
|
|
465 * source user info
|
|
466 * name
|
|
467 * evility
|
|
468 * userinfo tlvs
|
|
469 * online time
|
|
470 * etc
|
|
471 * message metatlv
|
|
472 * message tlv
|
|
473 * message string
|
|
474 * possibly others
|
|
475 *
|
|
476 */
|
13592
|
477 static int
|
|
478 incomingim_ch3(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs)
|
13234
|
479 {
|
|
480 int ret = 0, i;
|
|
481 aim_rxcallback_t userfunc;
|
|
482 aim_userinfo_t userinfo;
|
|
483 guint8 cookie[8];
|
|
484 guint16 channel;
|
|
485 aim_tlvlist_t *otl;
|
|
486 char *msg = NULL;
|
|
487 int len = 0;
|
|
488 char *encoding = NULL, *language = NULL;
|
13239
|
489 IcbmCookie *ck;
|
13234
|
490
|
|
491 memset(&userinfo, 0, sizeof(aim_userinfo_t));
|
|
492
|
|
493 /*
|
|
494 * Read ICBM Cookie.
|
|
495 */
|
|
496 for (i = 0; i < 8; i++)
|
13592
|
497 cookie[i] = byte_stream_get8(bs);
|
13234
|
498
|
13592
|
499 if ((ck = aim_uncachecookie(od, cookie, AIM_COOKIETYPE_CHAT))) {
|
13234
|
500 free(ck->data);
|
|
501 free(ck);
|
|
502 }
|
|
503
|
|
504 /*
|
|
505 * Channel ID
|
|
506 *
|
|
507 * Channel 0x0003 is used for chat messages.
|
|
508 *
|
|
509 */
|
13592
|
510 channel = byte_stream_get16(bs);
|
13234
|
511
|
|
512 if (channel != 0x0003) {
|
|
513 gaim_debug_misc("oscar", "faim: chat_incoming: unknown channel! (0x%04x)\n", channel);
|
|
514 return 0;
|
|
515 }
|
|
516
|
|
517 /*
|
|
518 * Start parsing TLVs right away.
|
|
519 */
|
|
520 otl = aim_tlvlist_read(bs);
|
|
521
|
|
522 /*
|
|
523 * Type 0x0003: Source User Information
|
|
524 */
|
|
525 if (aim_tlv_gettlv(otl, 0x0003, 1)) {
|
|
526 aim_tlv_t *userinfotlv;
|
13239
|
527 ByteStream tbs;
|
13234
|
528
|
|
529 userinfotlv = aim_tlv_gettlv(otl, 0x0003, 1);
|
|
530
|
13592
|
531 byte_stream_init(&tbs, userinfotlv->value, userinfotlv->length);
|
|
532 aim_info_extract(od, &tbs, &userinfo);
|
13234
|
533 }
|
|
534
|
|
535 #if 0
|
|
536 /*
|
|
537 * Type 0x0001: If present, it means it was a message to the
|
|
538 * room (as opposed to a whisper).
|
|
539 */
|
|
540 if (aim_tlv_gettlv(otl, 0x0001, 1)) {
|
|
541 /* Unhandled */
|
|
542 }
|
|
543 #endif
|
|
544
|
|
545 /*
|
|
546 * Type 0x0005: Message Block. Conains more TLVs.
|
|
547 */
|
|
548 if (aim_tlv_gettlv(otl, 0x0005, 1)) {
|
|
549 aim_tlvlist_t *itl;
|
|
550 aim_tlv_t *msgblock;
|
13239
|
551 ByteStream tbs;
|
13234
|
552
|
|
553 msgblock = aim_tlv_gettlv(otl, 0x0005, 1);
|
13592
|
554 byte_stream_init(&tbs, msgblock->value, msgblock->length);
|
13234
|
555 itl = aim_tlvlist_read(&tbs);
|
|
556
|
|
557 /*
|
|
558 * Type 0x0001: Message.
|
|
559 */
|
|
560 if (aim_tlv_gettlv(itl, 0x0001, 1)) {
|
|
561 msg = aim_tlv_getstr(itl, 0x0001, 1);
|
|
562 len = aim_tlv_gettlv(itl, 0x0001, 1)->length;
|
|
563 }
|
|
564
|
|
565 /*
|
|
566 * Type 0x0002: Encoding.
|
|
567 */
|
|
568 if (aim_tlv_gettlv(itl, 0x0002, 1))
|
|
569 encoding = aim_tlv_getstr(itl, 0x0002, 1);
|
|
570
|
|
571 /*
|
|
572 * Type 0x0003: Language.
|
|
573 */
|
|
574 if (aim_tlv_gettlv(itl, 0x0003, 1))
|
|
575 language = aim_tlv_getstr(itl, 0x0003, 1);
|
|
576
|
|
577 aim_tlvlist_free(&itl);
|
|
578 }
|
|
579
|
13592
|
580 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype)))
|
|
581 ret = userfunc(od, conn, frame, &userinfo, len, msg, encoding, language);
|
13234
|
582
|
|
583 aim_info_free(&userinfo);
|
|
584 free(msg);
|
|
585 aim_tlvlist_free(&otl);
|
|
586
|
|
587 return ret;
|
|
588 }
|
|
589
|
13592
|
590 static int
|
|
591 snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs)
|
13234
|
592 {
|
|
593 if (snac->subtype == 0x0002)
|
13592
|
594 return infoupdate(od, conn, mod, frame, snac, bs);
|
13234
|
595 else if ((snac->subtype == 0x0003) || (snac->subtype == 0x0004))
|
13592
|
596 return userlistchange(od, conn, mod, frame, snac, bs);
|
13234
|
597 else if (snac->subtype == 0x0006)
|
13592
|
598 return incomingim_ch3(od, conn, mod, frame, snac, bs);
|
13234
|
599
|
|
600 return 0;
|
|
601 }
|
|
602
|
13592
|
603 int
|
|
604 chat_modfirst(OscarData *od, aim_module_t *mod)
|
13234
|
605 {
|
|
606 mod->family = 0x000e;
|
|
607 mod->version = 0x0001;
|
|
608 mod->toolid = 0x0010;
|
|
609 mod->toolversion = 0x0629;
|
|
610 mod->flags = 0;
|
|
611 strncpy(mod->name, "chat", sizeof(mod->name));
|
|
612 mod->snachandler = snachandler;
|
|
613
|
|
614 return 0;
|
|
615 }
|