1 | |
---|
2 | /* |
---|
3 | * Popups are just what it sounds like. They're a way for the server to |
---|
4 | * open up an informative box on the client's screen. |
---|
5 | */ |
---|
6 | |
---|
7 | #define FAIM_INTERNAL |
---|
8 | #include <aim.h> |
---|
9 | |
---|
10 | /* |
---|
11 | * This is all there is to it. |
---|
12 | * |
---|
13 | * The message is probably HTML. |
---|
14 | * |
---|
15 | */ |
---|
16 | static int parsepopup(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) |
---|
17 | { |
---|
18 | aim_rxcallback_t userfunc; |
---|
19 | aim_tlvlist_t *tl; |
---|
20 | int ret = 0; |
---|
21 | char *msg, *url; |
---|
22 | fu16_t width, height, delay; |
---|
23 | |
---|
24 | tl = aim_readtlvchain(bs); |
---|
25 | |
---|
26 | msg = aim_gettlv_str(tl, 0x0001, 1); |
---|
27 | url = aim_gettlv_str(tl, 0x0002, 1); |
---|
28 | width = aim_gettlv16(tl, 0x0003, 1); |
---|
29 | height = aim_gettlv16(tl, 0x0004, 1); |
---|
30 | delay = aim_gettlv16(tl, 0x0005, 1); |
---|
31 | |
---|
32 | if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) |
---|
33 | ret = userfunc(sess, rx, msg, url, width, height, delay); |
---|
34 | |
---|
35 | aim_freetlvchain(&tl); |
---|
36 | free(msg); |
---|
37 | free(url); |
---|
38 | |
---|
39 | return ret; |
---|
40 | } |
---|
41 | |
---|
42 | static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) |
---|
43 | { |
---|
44 | |
---|
45 | if (snac->subtype == 0x0002) |
---|
46 | return parsepopup(sess, mod, rx, snac, bs); |
---|
47 | |
---|
48 | return 0; |
---|
49 | } |
---|
50 | |
---|
51 | faim_internal int popups_modfirst(aim_session_t *sess, aim_module_t *mod) |
---|
52 | { |
---|
53 | |
---|
54 | mod->family = 0x0008; |
---|
55 | mod->version = 0x0001; |
---|
56 | mod->toolid = 0x0104; |
---|
57 | mod->toolversion = 0x0001; |
---|
58 | mod->flags = 0; |
---|
59 | strncpy(mod->name, "popups", sizeof(mod->name)); |
---|
60 | mod->snachandler = snachandler; |
---|
61 | |
---|
62 | return 0; |
---|
63 | } |
---|
64 | |
---|
65 | |
---|