source: libfaim/popups.c @ 7869e48

Last change on this file since 7869e48 was 7869e48, checked in by Jason Gross <jgross@mit.edu>, 12 years ago
Remove trailing whitespace This commit was made with the command sequence for i in $(git ls-files | tr '\n' ' '); do echo $i; sed -i s'/\s\+$//g' "$(readlink -f $i)"; done
  • Property mode set to 100644
File size: 1.4 KB
RevLine 
[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 */
17static 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
43static 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
52faim_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}
Note: See TracBrowser for help on using the repository browser.