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 0x0008 - Popups.
|
|
23 *
|
|
24 * Popups are just what it sounds like. They're a way for the server to
|
|
25 * open up an informative box on the client's screen.
|
|
26 */
|
|
27
|
|
28 #include <oscar.h>
|
|
29
|
|
30 /*
|
|
31 * This is all there is to it.
|
|
32 *
|
|
33 * The message is probably HTML.
|
|
34 *
|
|
35 */
|
13592
|
36 static int
|
|
37 parsepopup(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs)
|
13234
|
38 {
|
|
39 aim_rxcallback_t userfunc;
|
|
40 aim_tlvlist_t *tl;
|
|
41 int ret = 0;
|
|
42 char *msg, *url;
|
|
43 guint16 width, height, delay;
|
|
44
|
|
45 tl = aim_tlvlist_read(bs);
|
|
46
|
|
47 msg = aim_tlv_getstr(tl, 0x0001, 1);
|
|
48 url = aim_tlv_getstr(tl, 0x0002, 1);
|
|
49 width = aim_tlv_get16(tl, 0x0003, 1);
|
|
50 height = aim_tlv_get16(tl, 0x0004, 1);
|
|
51 delay = aim_tlv_get16(tl, 0x0005, 1);
|
|
52
|
13592
|
53 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype)))
|
|
54 ret = userfunc(od, conn, frame, msg, url, width, height, delay);
|
13234
|
55
|
|
56 aim_tlvlist_free(&tl);
|
|
57 free(msg);
|
|
58 free(url);
|
|
59
|
|
60 return ret;
|
|
61 }
|
|
62
|
13592
|
63 static int
|
|
64 snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs)
|
13234
|
65 {
|
|
66 if (snac->subtype == 0x0002)
|
13592
|
67 return parsepopup(od, conn, mod, frame, snac, bs);
|
13234
|
68
|
|
69 return 0;
|
|
70 }
|
|
71
|
13592
|
72 int
|
|
73 popups_modfirst(OscarData *od, aim_module_t *mod)
|
13234
|
74 {
|
|
75 mod->family = 0x0008;
|
|
76 mod->version = 0x0001;
|
|
77 mod->toolid = 0x0104;
|
|
78 mod->toolversion = 0x0001;
|
|
79 mod->flags = 0;
|
|
80 strncpy(mod->name, "popup", sizeof(mod->name));
|
|
81 mod->snachandler = snachandler;
|
|
82
|
|
83 return 0;
|
|
84 }
|