mark PurpleImageClass as private
[pidgin-git.git] / libpurple / protocols / oscar / family_popup.c
blob608ac595ecb3bb65957bb4e55ad29e71c0d1ec1e
1 /*
2 * Purple's oscar protocol plugin
3 * This file is the legal property of its developers.
4 * Please see the AUTHORS file distributed alongside this file.
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.
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.
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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
22 * Family 0x0008 - Popups.
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.
28 #include <oscar.h>
31 * This is all there is to it.
33 * The message is probably HTML.
36 static int
37 parsepopup(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs)
39 aim_rxcallback_t userfunc;
40 GSList *tlvlist;
41 int ret = 0;
42 char *msg, *url;
43 guint16 width, height, delay;
45 tlvlist = aim_tlvlist_read(bs);
47 msg = aim_tlv_getstr(tlvlist, 0x0001, 1);
48 url = aim_tlv_getstr(tlvlist, 0x0002, 1);
49 width = aim_tlv_get16(tlvlist, 0x0003, 1);
50 height = aim_tlv_get16(tlvlist, 0x0004, 1);
51 delay = aim_tlv_get16(tlvlist, 0x0005, 1);
53 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype)))
54 ret = userfunc(od, conn, frame, msg, url, width, height, delay);
56 aim_tlvlist_free(tlvlist);
57 g_free(msg);
58 g_free(url);
60 return ret;
63 static int
64 snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs)
66 if (snac->subtype == 0x0002)
67 return parsepopup(od, conn, mod, frame, snac, bs);
69 return 0;
72 int
73 popups_modfirst(OscarData *od, aim_module_t *mod)
75 mod->family = SNAC_FAMILY_POPUP;
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;
83 return 0;