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