annotate src/protocols/oscar/popups.c @ 8931:73223e21b943

[gaim-migrate @ 9701] This gives us a "Paste as Text" right click menu option for imhtml, thanks to khc and Simguy. I did some work on it too, and fixed all the bugs I could find. I also decided to change all the gtk_clipboard_get()s to gtk_widget_get_clipboard()s, all two of them. committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Sat, 15 May 2004 05:56:55 +0000
parents 6d3d8f11e765
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2672
c41030cfed76 [gaim-migrate @ 2685]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
1 /*
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 2673
diff changeset
2 * Family 0x0008 - Popups.
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 2673
diff changeset
3 *
2673
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
4 * Popups are just what it sounds like. They're a way for the server to
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
5 * open up an informative box on the client's screen.
2672
c41030cfed76 [gaim-migrate @ 2685]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
6 */
c41030cfed76 [gaim-migrate @ 2685]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
7
c41030cfed76 [gaim-migrate @ 2685]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
8 #define FAIM_INTERNAL
c41030cfed76 [gaim-migrate @ 2685]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
9 #include <aim.h>
c41030cfed76 [gaim-migrate @ 2685]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
10
2673
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
11 /*
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
12 * This is all there is to it.
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
13 *
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
14 * The message is probably HTML.
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
15 *
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
16 */
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
17 static int parsepopup(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
18 {
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
19 aim_rxcallback_t userfunc;
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
20 aim_tlvlist_t *tl;
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
21 int ret = 0;
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
22 char *msg, *url;
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
23 fu16_t width, height, delay;
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
24
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 3952
diff changeset
25 tl = aim_tlvlist_read(bs);
2673
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
26
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 3952
diff changeset
27 msg = aim_tlv_getstr(tl, 0x0001, 1);
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 3952
diff changeset
28 url = aim_tlv_getstr(tl, 0x0002, 1);
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 3952
diff changeset
29 width = aim_tlv_get16(tl, 0x0003, 1);
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 3952
diff changeset
30 height = aim_tlv_get16(tl, 0x0004, 1);
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 3952
diff changeset
31 delay = aim_tlv_get16(tl, 0x0005, 1);
2673
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
32
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
33 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
34 ret = userfunc(sess, rx, msg, url, width, height, delay);
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
35
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 3952
diff changeset
36 aim_tlvlist_free(&tl);
2673
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
37 free(msg);
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
38 free(url);
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
39
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
40 return ret;
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
41 }
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
42
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
43 static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
44 {
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
45
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
46 if (snac->subtype == 0x0002)
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
47 return parsepopup(sess, mod, rx, snac, bs);
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
48
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
49 return 0;
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
50 }
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
51
2672
c41030cfed76 [gaim-migrate @ 2685]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
52 faim_internal int popups_modfirst(aim_session_t *sess, aim_module_t *mod)
c41030cfed76 [gaim-migrate @ 2685]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
53 {
c41030cfed76 [gaim-migrate @ 2685]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
54
c41030cfed76 [gaim-migrate @ 2685]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
55 mod->family = 0x0008;
c41030cfed76 [gaim-migrate @ 2685]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
56 mod->version = 0x0001;
c41030cfed76 [gaim-migrate @ 2685]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
57 mod->toolid = 0x0104;
c41030cfed76 [gaim-migrate @ 2685]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
58 mod->toolversion = 0x0001;
c41030cfed76 [gaim-migrate @ 2685]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
59 mod->flags = 0;
c41030cfed76 [gaim-migrate @ 2685]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
60 strncpy(mod->name, "popups", sizeof(mod->name));
2673
81d658e6ac1e [gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
61 mod->snachandler = snachandler;
2672
c41030cfed76 [gaim-migrate @ 2685]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
62
c41030cfed76 [gaim-migrate @ 2685]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
63 return 0;
c41030cfed76 [gaim-migrate @ 2685]
Adam Fritzler <mid@auk.cx>
parents:
diff changeset
64 }