Sun, 15 Apr 2007 02:10:37 +0000
propagate from branch 'im.pidgin.gaim' (head b2836a24d81e7a1bd1d21b3aea8794b094391344)
to branch 'im.pidgin.rlaager.merging.soc-msnp13-to-svn18164' (head 463b4fa9f067b279f843520d95a822adc86a0a1b)
| 13235 | 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 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13240
diff
changeset
|
36 | static int |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13240
diff
changeset
|
37 | parsepopup(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
| 13235 | 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 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13240
diff
changeset
|
53 | if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13240
diff
changeset
|
54 | ret = userfunc(od, conn, frame, msg, url, width, height, delay); |
| 13235 | 55 | |
| 56 | aim_tlvlist_free(&tl); | |
| 57 | free(msg); | |
| 58 | free(url); | |
| 59 | ||
| 60 | return ret; | |
| 61 | } | |
| 62 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13240
diff
changeset
|
63 | static int |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13240
diff
changeset
|
64 | snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
| 13235 | 65 | { |
| 66 | if (snac->subtype == 0x0002) | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13240
diff
changeset
|
67 | return parsepopup(od, conn, mod, frame, snac, bs); |
| 13235 | 68 | |
| 69 | return 0; | |
| 70 | } | |
| 71 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13240
diff
changeset
|
72 | int |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13240
diff
changeset
|
73 | popups_modfirst(OscarData *od, aim_module_t *mod) |
| 13235 | 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 | } |