annotate src/protocols/oscar/service.c @ 10751:bf5e48215158

[gaim-migrate @ 12354] Get rid of serv_finish_login because it's dumb. Also fix some problems with gg and silc that I introduced yesterday. I didn't grep for places where account->password was accessed directly. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 27 Mar 2005 17:50:35 +0000
parents 33746d45bd0d
children 8d74ae785a46
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1 /*
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 2866
diff changeset
2 * Family 0x0001 - This is a very special group. All connections support
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3 * this group, as it does some particularly good things (like rate limiting).
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4 */
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
6 #define FAIM_INTERNAL
2734
9fc65bb80596 [gaim-migrate @ 2747]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2703
diff changeset
7 #define FAIM_NEED_CONN_INTERNAL
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
8 #include <aim.h>
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
9
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
10 #include "md5.h"
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
11
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 2866
diff changeset
12 /* Subtype 0x0002 - Client Online */
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
13 faim_export int aim_clientready(aim_session_t *sess, aim_conn_t *conn)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
14 {
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
15 aim_conn_inside_t *ins = (aim_conn_inside_t *)conn->inside;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
16 struct snacgroup *sg;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
17 aim_frame_t *fr;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
18 aim_snacid_t snacid;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
19
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
20 if (!ins)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
21 return -EINVAL;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
22
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
23 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 1152)))
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
24 return -ENOMEM;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
25
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
26 snacid = aim_cachesnac(sess, 0x0001, 0x0002, 0x0000, NULL, 0);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
27 aim_putsnac(&fr->data, 0x0001, 0x0002, 0x0000, snacid);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
28
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
29 /*
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
30 * Send only the tool versions that the server cares about (that it
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
31 * marked as supporting in the server ready SNAC).
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
32 */
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
33 for (sg = ins->groups; sg; sg = sg->next) {
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
34 aim_module_t *mod;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
35
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
36 if ((mod = aim__findmodulebygroup(sess, sg->group))) {
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
37 aimbs_put16(&fr->data, mod->family);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
38 aimbs_put16(&fr->data, mod->version);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
39 aimbs_put16(&fr->data, mod->toolid);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
40 aimbs_put16(&fr->data, mod->toolversion);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
41 } else
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
42 faimdprintf(sess, 1, "aim_clientready: server supports group 0x%04x but we don't!\n", sg->group);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
43 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
44
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
45 aim_tx_enqueue(sess, fr);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
46
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
47 return 0;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
48 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
49
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
50 /*
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 2866
diff changeset
51 * Subtype 0x0003 - Host Online
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
52 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
53 * See comments in conn.c about how the group associations are supposed
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
54 * to work, and how they really work.
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
55 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
56 * This info probably doesn't even need to make it to the client.
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
57 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
58 * We don't actually call the client here. This starts off the connection
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
59 * initialization routine required by all AIM connections. The next time
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
60 * the client is called is the CONNINITDONE callback, which should be
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
61 * shortly after the rate information is acknowledged.
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
62 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
63 */
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
64 static int hostonline(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
65 {
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
66 fu16_t *families;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
67 int famcount;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
68
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
69
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
70 if (!(families = malloc(aim_bstream_empty(bs))))
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
71 return 0;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
72
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
73 for (famcount = 0; aim_bstream_empty(bs); famcount++) {
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
74 families[famcount] = aimbs_get16(bs);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
75 aim_conn_addgroup(rx->conn, families[famcount]);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
76 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
77
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
78 free(families);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
79
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
80
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
81 /*
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
82 * Next step is in the Host Versions handler.
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
83 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
84 * Note that we must send this before we request rates, since
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
85 * the format of the rate information depends on the versions we
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
86 * give it.
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
87 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
88 */
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
89 aim_setversions(sess, rx->conn);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
90
10157
0de7eee583e6 [gaim-migrate @ 11237]
Mark Doliner <mark@kingant.net>
parents: 9879
diff changeset
91 return 1;
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
92 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
93
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 2866
diff changeset
94 /* Subtype 0x0004 - Service request */
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
95 faim_export int aim_reqservice(aim_session_t *sess, aim_conn_t *conn, fu16_t serviceid)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
96 {
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
97 return aim_genericreq_s(sess, conn, 0x0001, 0x0004, &serviceid);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
98 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
99
8225
9790cda80d52 [gaim-migrate @ 8948]
Mark Doliner <mark@kingant.net>
parents: 7484
diff changeset
100 /*
9790cda80d52 [gaim-migrate @ 8948]
Mark Doliner <mark@kingant.net>
parents: 7484
diff changeset
101 * Join a room of name roomname. This is the first step to joining an
9790cda80d52 [gaim-migrate @ 8948]
Mark Doliner <mark@kingant.net>
parents: 7484
diff changeset
102 * already created room. It's basically a Service Request for
9790cda80d52 [gaim-migrate @ 8948]
Mark Doliner <mark@kingant.net>
parents: 7484
diff changeset
103 * family 0x000e, with a little added on to specify the exchange and room
9790cda80d52 [gaim-migrate @ 8948]
Mark Doliner <mark@kingant.net>
parents: 7484
diff changeset
104 * name.
9790cda80d52 [gaim-migrate @ 8948]
Mark Doliner <mark@kingant.net>
parents: 7484
diff changeset
105 */
9790cda80d52 [gaim-migrate @ 8948]
Mark Doliner <mark@kingant.net>
parents: 7484
diff changeset
106 faim_export int aim_chat_join(aim_session_t *sess, aim_conn_t *conn, fu16_t exchange, const char *roomname, fu16_t instance)
9790cda80d52 [gaim-migrate @ 8948]
Mark Doliner <mark@kingant.net>
parents: 7484
diff changeset
107 {
9790cda80d52 [gaim-migrate @ 8948]
Mark Doliner <mark@kingant.net>
parents: 7484
diff changeset
108 aim_frame_t *fr;
9790cda80d52 [gaim-migrate @ 8948]
Mark Doliner <mark@kingant.net>
parents: 7484
diff changeset
109 aim_snacid_t snacid;
9790cda80d52 [gaim-migrate @ 8948]
Mark Doliner <mark@kingant.net>
parents: 7484
diff changeset
110 aim_tlvlist_t *tl = NULL;
9790cda80d52 [gaim-migrate @ 8948]
Mark Doliner <mark@kingant.net>
parents: 7484
diff changeset
111 struct chatsnacinfo csi;
10157
0de7eee583e6 [gaim-migrate @ 11237]
Mark Doliner <mark@kingant.net>
parents: 9879
diff changeset
112
8225
9790cda80d52 [gaim-migrate @ 8948]
Mark Doliner <mark@kingant.net>
parents: 7484
diff changeset
113 if (!sess || !conn || !roomname || !strlen(roomname))
9790cda80d52 [gaim-migrate @ 8948]
Mark Doliner <mark@kingant.net>
parents: 7484
diff changeset
114 return -EINVAL;
9790cda80d52 [gaim-migrate @ 8948]
Mark Doliner <mark@kingant.net>
parents: 7484
diff changeset
115
9790cda80d52 [gaim-migrate @ 8948]
Mark Doliner <mark@kingant.net>
parents: 7484
diff changeset
116 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 512)))
9790cda80d52 [gaim-migrate @ 8948]
Mark Doliner <mark@kingant.net>
parents: 7484
diff changeset
117 return -ENOMEM;
9790cda80d52 [gaim-migrate @ 8948]
Mark Doliner <mark@kingant.net>
parents: 7484
diff changeset
118
9790cda80d52 [gaim-migrate @ 8948]
Mark Doliner <mark@kingant.net>
parents: 7484
diff changeset
119 memset(&csi, 0, sizeof(csi));
9790cda80d52 [gaim-migrate @ 8948]
Mark Doliner <mark@kingant.net>
parents: 7484
diff changeset
120 csi.exchange = exchange;
9790cda80d52 [gaim-migrate @ 8948]
Mark Doliner <mark@kingant.net>
parents: 7484
diff changeset
121 strncpy(csi.name, roomname, sizeof(csi.name));
9790cda80d52 [gaim-migrate @ 8948]
Mark Doliner <mark@kingant.net>
parents: 7484
diff changeset
122 csi.instance = instance;
9790cda80d52 [gaim-migrate @ 8948]
Mark Doliner <mark@kingant.net>
parents: 7484
diff changeset
123
9790cda80d52 [gaim-migrate @ 8948]
Mark Doliner <mark@kingant.net>
parents: 7484
diff changeset
124 snacid = aim_cachesnac(sess, 0x0001, 0x0004, 0x0000, &csi, sizeof(csi));
9790cda80d52 [gaim-migrate @ 8948]
Mark Doliner <mark@kingant.net>
parents: 7484
diff changeset
125 aim_putsnac(&fr->data, 0x0001, 0x0004, 0x0000, snacid);
9790cda80d52 [gaim-migrate @ 8948]
Mark Doliner <mark@kingant.net>
parents: 7484
diff changeset
126
9790cda80d52 [gaim-migrate @ 8948]
Mark Doliner <mark@kingant.net>
parents: 7484
diff changeset
127 /*
9790cda80d52 [gaim-migrate @ 8948]
Mark Doliner <mark@kingant.net>
parents: 7484
diff changeset
128 * Requesting service chat (0x000e)
9790cda80d52 [gaim-migrate @ 8948]
Mark Doliner <mark@kingant.net>
parents: 7484
diff changeset
129 */
9790cda80d52 [gaim-migrate @ 8948]
Mark Doliner <mark@kingant.net>
parents: 7484
diff changeset
130 aimbs_put16(&fr->data, 0x000e);
9790cda80d52 [gaim-migrate @ 8948]
Mark Doliner <mark@kingant.net>
parents: 7484
diff changeset
131
9790cda80d52 [gaim-migrate @ 8948]
Mark Doliner <mark@kingant.net>
parents: 7484
diff changeset
132 aim_tlvlist_add_chatroom(&tl, 0x0001, exchange, roomname, instance);
9790cda80d52 [gaim-migrate @ 8948]
Mark Doliner <mark@kingant.net>
parents: 7484
diff changeset
133 aim_tlvlist_write(&fr->data, &tl);
9790cda80d52 [gaim-migrate @ 8948]
Mark Doliner <mark@kingant.net>
parents: 7484
diff changeset
134 aim_tlvlist_free(&tl);
9790cda80d52 [gaim-migrate @ 8948]
Mark Doliner <mark@kingant.net>
parents: 7484
diff changeset
135
9790cda80d52 [gaim-migrate @ 8948]
Mark Doliner <mark@kingant.net>
parents: 7484
diff changeset
136 aim_tx_enqueue(sess, fr);
9790cda80d52 [gaim-migrate @ 8948]
Mark Doliner <mark@kingant.net>
parents: 7484
diff changeset
137
10157
0de7eee583e6 [gaim-migrate @ 11237]
Mark Doliner <mark@kingant.net>
parents: 9879
diff changeset
138 return 0;
8225
9790cda80d52 [gaim-migrate @ 8948]
Mark Doliner <mark@kingant.net>
parents: 7484
diff changeset
139 }
9790cda80d52 [gaim-migrate @ 8948]
Mark Doliner <mark@kingant.net>
parents: 7484
diff changeset
140
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 2866
diff changeset
141 /* Subtype 0x0005 - Redirect */
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
142 static int redirect(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
143 {
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
144 struct aim_redirect_data redir;
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
145 aim_rxcallback_t userfunc;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
146 aim_tlvlist_t *tlvlist;
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
147 aim_snac_t *origsnac = NULL;
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
148 int ret = 0;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
149
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
150 memset(&redir, 0, sizeof(redir));
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
151
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7141
diff changeset
152 tlvlist = aim_tlvlist_read(bs);
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
153
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7141
diff changeset
154 if (!aim_tlv_gettlv(tlvlist, 0x000d, 1) ||
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7141
diff changeset
155 !aim_tlv_gettlv(tlvlist, 0x0005, 1) ||
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7141
diff changeset
156 !aim_tlv_gettlv(tlvlist, 0x0006, 1)) {
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7141
diff changeset
157 aim_tlvlist_free(&tlvlist);
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
158 return 0;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
159 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
160
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7141
diff changeset
161 redir.group = aim_tlv_get16(tlvlist, 0x000d, 1);
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7141
diff changeset
162 redir.ip = aim_tlv_getstr(tlvlist, 0x0005, 1);
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7141
diff changeset
163 redir.cookielen = aim_tlv_gettlv(tlvlist, 0x0006, 1)->length;
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7141
diff changeset
164 redir.cookie = aim_tlv_getstr(tlvlist, 0x0006, 1);
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
165
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
166 /* Fetch original SNAC so we can get csi if needed */
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
167 origsnac = aim_remsnac(sess, snac->id);
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
168
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
169 if ((redir.group == AIM_CONN_TYPE_CHAT) && origsnac) {
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
170 struct chatsnacinfo *csi = (struct chatsnacinfo *)origsnac->data;
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
171
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
172 redir.chat.exchange = csi->exchange;
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
173 redir.chat.room = csi->name;
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
174 redir.chat.instance = csi->instance;
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
175 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
176
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
177 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
178 ret = userfunc(sess, rx, &redir);
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
179
2821
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
180 free((void *)redir.ip);
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
181 free((void *)redir.cookie);
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
182
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
183 if (origsnac)
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
184 free(origsnac->data);
9467e4ee81be [gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
185 free(origsnac);
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
186
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7141
diff changeset
187 aim_tlvlist_free(&tlvlist);
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
188
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
189 return ret;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
190 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
191
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 2866
diff changeset
192 /* Subtype 0x0006 - Request Rate Information. */
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
193 faim_internal int aim_reqrates(aim_session_t *sess, aim_conn_t *conn)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
194 {
7282
ad243bc63184 [gaim-migrate @ 7861]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
195 return aim_genericreq_n_snacid(sess, conn, 0x0001, 0x0006);
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
196 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
197
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
198 /*
8735
92cbf9713795 [gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents: 8225
diff changeset
199 * OSCAR defines several 'rate classes'. Each class has separate
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
200 * rate limiting properties (limit level, alert level, disconnect
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
201 * level, etc), and a set of SNAC family/type pairs associated with
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
202 * it. The rate classes, their limiting properties, and the definitions
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
203 * of which SNACs are belong to which class, are defined in the
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
204 * Rate Response packet at login to each host.
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
205 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
206 * Logically, all rate offenses within one class count against further
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
207 * offenses for other SNACs in the same class (ie, sending messages
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
208 * too fast will limit the number of user info requests you can send,
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
209 * since those two SNACs are in the same rate class).
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
210 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
211 * Since the rate classes are defined dynamically at login, the values
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
212 * below may change. But they seem to be fairly constant.
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
213 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
214 * Currently, BOS defines five rate classes, with the commonly used
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
215 * members as follows...
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
216 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
217 * Rate class 0x0001:
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
218 * - Everything thats not in any of the other classes
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
219 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
220 * Rate class 0x0002:
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
221 * - Buddy list add/remove
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
222 * - Permit list add/remove
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
223 * - Deny list add/remove
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
224 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
225 * Rate class 0x0003:
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
226 * - User information requests
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
227 * - Outgoing ICBMs
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
228 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
229 * Rate class 0x0004:
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
230 * - A few unknowns: 2/9, 2/b, and f/2
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
231 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
232 * Rate class 0x0005:
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
233 * - Chat room create
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
234 * - Outgoing chat ICBMs
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
235 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
236 * The only other thing of note is that class 5 (chat) has slightly looser
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
237 * limiting properties than class 3 (normal messages). But thats just a
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
238 * small bit of trivia for you.
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
239 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
240 * The last thing that needs to be learned about the rate limiting
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
241 * system is how the actual numbers relate to the passing of time. This
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
242 * seems to be a big mystery.
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
243 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
244 */
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
245
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
246 static void rc_addclass(struct rateclass **head, struct rateclass *inrc)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
247 {
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
248 struct rateclass *rc, *rc2;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
249
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
250 if (!(rc = malloc(sizeof(struct rateclass))))
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
251 return;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
252
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
253 memcpy(rc, inrc, sizeof(struct rateclass));
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
254 rc->next = NULL;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
255
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
256 for (rc2 = *head; rc2 && rc2->next; rc2 = rc2->next)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
257 ;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
258
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
259 if (!rc2)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
260 *head = rc;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
261 else
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
262 rc2->next = rc;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
263
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
264 return;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
265 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
266
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
267 static struct rateclass *rc_findclass(struct rateclass **head, fu16_t id)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
268 {
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
269 struct rateclass *rc;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
270
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
271 for (rc = *head; rc; rc = rc->next) {
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
272 if (rc->classid == id)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
273 return rc;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
274 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
275
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
276 return NULL;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
277 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
278
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
279 static void rc_addpair(struct rateclass *rc, fu16_t group, fu16_t type)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
280 {
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
281 struct snacpair *sp, *sp2;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
282
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
283 if (!(sp = malloc(sizeof(struct snacpair))))
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
284 return;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
285 memset(sp, 0, sizeof(struct snacpair));
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
286
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
287 sp->group = group;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
288 sp->subtype = type;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
289 sp->next = NULL;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
290
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
291 for (sp2 = rc->members; sp2 && sp2->next; sp2 = sp2->next)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
292 ;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
293
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
294 if (!sp2)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
295 rc->members = sp;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
296 else
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
297 sp2->next = sp;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
298
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
299 return;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
300 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
301
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 2866
diff changeset
302 /* Subtype 0x0007 - Rate Parameters */
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
303 static int rateresp(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
304 {
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
305 aim_conn_inside_t *ins = (aim_conn_inside_t *)rx->conn->inside;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
306 fu16_t numclasses, i;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
307 aim_rxcallback_t userfunc;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
308
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
309
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
310 /*
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
311 * First are the parameters for each rate class.
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
312 */
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
313 numclasses = aimbs_get16(bs);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
314 for (i = 0; i < numclasses; i++) {
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
315 struct rateclass rc;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
316
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
317 memset(&rc, 0, sizeof(struct rateclass));
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
318
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
319 rc.classid = aimbs_get16(bs);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
320 rc.windowsize = aimbs_get32(bs);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
321 rc.clear = aimbs_get32(bs);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
322 rc.alert = aimbs_get32(bs);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
323 rc.limit = aimbs_get32(bs);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
324 rc.disconnect = aimbs_get32(bs);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
325 rc.current = aimbs_get32(bs);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
326 rc.max = aimbs_get32(bs);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
327
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
328 /*
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
329 * The server will send an extra five bytes of parameters
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
330 * depending on the version we advertised in 1/17. If we
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
331 * didn't send 1/17 (evil!), then this will crash and you
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
332 * die, as it will default to the old version but we have
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
333 * the new version hardcoded here.
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
334 */
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
335 if (mod->version >= 3)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
336 aimbs_getrawbuf(bs, rc.unknown, sizeof(rc.unknown));
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
337
2734
9fc65bb80596 [gaim-migrate @ 2747]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2703
diff changeset
338 faimdprintf(sess, 1, "--- Adding rate class %d to connection type %d: window size = %ld, clear = %ld, alert = %ld, limit = %ld, disconnect = %ld, current = %ld, max = %ld\n", rx->conn->type, rc.classid, rc.windowsize, rc.clear, rc.alert, rc.limit, rc.disconnect, rc.current, rc.max);
9fc65bb80596 [gaim-migrate @ 2747]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2703
diff changeset
339
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
340 rc_addclass(&ins->rates, &rc);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
341 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
342
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
343 /*
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
344 * Then the members of each class.
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
345 */
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
346 for (i = 0; i < numclasses; i++) {
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
347 fu16_t classid, count;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
348 struct rateclass *rc;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
349 int j;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
350
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
351 classid = aimbs_get16(bs);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
352 count = aimbs_get16(bs);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
353
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
354 rc = rc_findclass(&ins->rates, classid);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
355
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
356 for (j = 0; j < count; j++) {
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
357 fu16_t group, subtype;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
358
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
359 group = aimbs_get16(bs);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
360 subtype = aimbs_get16(bs);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
361
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
362 if (rc)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
363 rc_addpair(rc, group, subtype);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
364 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
365 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
366
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
367 /*
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
368 * We don't pass the rate information up to the client, as it really
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
369 * doesn't care. The information is stored in the connection, however
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
370 * so that we can do more fun stuff later (not really).
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
371 */
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
372
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
373 /*
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
374 * Last step in the conn init procedure is to acknowledge that we
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
375 * agree to these draconian limitations.
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
376 */
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
377 aim_rates_addparam(sess, rx->conn);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
378
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
379 /*
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
380 * Finally, tell the client it's ready to go...
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
381 */
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
382 if ((userfunc = aim_callhandler(sess, rx->conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE)))
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
383 userfunc(sess, rx);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
384
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
385
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
386 return 1;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
387 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
388
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 2866
diff changeset
389 /* Subtype 0x0008 - Add Rate Parameter */
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
390 faim_internal int aim_rates_addparam(aim_session_t *sess, aim_conn_t *conn)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
391 {
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
392 aim_conn_inside_t *ins = (aim_conn_inside_t *)conn->inside;
10157
0de7eee583e6 [gaim-migrate @ 11237]
Mark Doliner <mark@kingant.net>
parents: 9879
diff changeset
393 aim_frame_t *fr;
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
394 aim_snacid_t snacid;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
395 struct rateclass *rc;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
396
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
397 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 512)))
10157
0de7eee583e6 [gaim-migrate @ 11237]
Mark Doliner <mark@kingant.net>
parents: 9879
diff changeset
398 return -ENOMEM;
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
399
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
400 snacid = aim_cachesnac(sess, 0x0001, 0x0008, 0x0000, NULL, 0);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
401 aim_putsnac(&fr->data, 0x0001, 0x0008, 0x0000, snacid);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
402
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
403 for (rc = ins->rates; rc; rc = rc->next)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
404 aimbs_put16(&fr->data, rc->classid);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
405
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
406 aim_tx_enqueue(sess, fr);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
407
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
408 return 0;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
409 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
410
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 2866
diff changeset
411 /* Subtype 0x0009 - Delete Rate Parameter */
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
412 faim_internal int aim_rates_delparam(aim_session_t *sess, aim_conn_t *conn)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
413 {
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
414 aim_conn_inside_t *ins = (aim_conn_inside_t *)conn->inside;
10157
0de7eee583e6 [gaim-migrate @ 11237]
Mark Doliner <mark@kingant.net>
parents: 9879
diff changeset
415 aim_frame_t *fr;
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
416 aim_snacid_t snacid;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
417 struct rateclass *rc;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
418
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
419 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 512)))
10157
0de7eee583e6 [gaim-migrate @ 11237]
Mark Doliner <mark@kingant.net>
parents: 9879
diff changeset
420 return -ENOMEM;
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
421
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
422 snacid = aim_cachesnac(sess, 0x0001, 0x0009, 0x0000, NULL, 0);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
423 aim_putsnac(&fr->data, 0x0001, 0x0009, 0x0000, snacid);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
424
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
425 for (rc = ins->rates; rc; rc = rc->next)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
426 aimbs_put16(&fr->data, rc->classid);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
427
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
428 aim_tx_enqueue(sess, fr);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
429
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
430 return 0;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
431 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
432
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 2866
diff changeset
433 /* Subtype 0x000a - Rate Change */
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
434 static int ratechange(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
435 {
4871
0b64f386a7b8 [gaim-migrate @ 5201]
Mark Doliner <mark@kingant.net>
parents: 4342
diff changeset
436 int ret = 0;
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
437 aim_rxcallback_t userfunc;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
438 fu16_t code, rateclass;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
439 fu32_t currentavg, maxavg, windowsize, clear, alert, limit, disconnect;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
440
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
441 code = aimbs_get16(bs);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
442 rateclass = aimbs_get16(bs);
10157
0de7eee583e6 [gaim-migrate @ 11237]
Mark Doliner <mark@kingant.net>
parents: 9879
diff changeset
443
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
444 windowsize = aimbs_get32(bs);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
445 clear = aimbs_get32(bs);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
446 alert = aimbs_get32(bs);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
447 limit = aimbs_get32(bs);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
448 disconnect = aimbs_get32(bs);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
449 currentavg = aimbs_get32(bs);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
450 maxavg = aimbs_get32(bs);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
451
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
452 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
4871
0b64f386a7b8 [gaim-migrate @ 5201]
Mark Doliner <mark@kingant.net>
parents: 4342
diff changeset
453 ret = userfunc(sess, rx, code, rateclass, windowsize, clear, alert, limit, disconnect, currentavg, maxavg);
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
454
4871
0b64f386a7b8 [gaim-migrate @ 5201]
Mark Doliner <mark@kingant.net>
parents: 4342
diff changeset
455 return ret;
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
456 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
457
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
458 /*
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 2866
diff changeset
459 * How Migrations work.
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
460 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
461 * The server sends a Server Pause message, which the client should respond to
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
462 * with a Server Pause Ack, which contains the families it needs on this
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
463 * connection. The server will send a Migration Notice with an IP address, and
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
464 * then disconnect. Next the client should open the connection and send the
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
465 * cookie. Repeat the normal login process and pretend this never happened.
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
466 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
467 * The Server Pause contains no data.
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
468 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
469 */
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
470
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 2866
diff changeset
471 /* Subtype 0x000b - Service Pause */
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
472 static int serverpause(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
473 {
4871
0b64f386a7b8 [gaim-migrate @ 5201]
Mark Doliner <mark@kingant.net>
parents: 4342
diff changeset
474 int ret = 0;
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
475 aim_rxcallback_t userfunc;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
476
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
477 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
4871
0b64f386a7b8 [gaim-migrate @ 5201]
Mark Doliner <mark@kingant.net>
parents: 4342
diff changeset
478 ret = userfunc(sess, rx);
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
479
4871
0b64f386a7b8 [gaim-migrate @ 5201]
Mark Doliner <mark@kingant.net>
parents: 4342
diff changeset
480 return ret;
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
481 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
482
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
483 /*
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 2866
diff changeset
484 * Subtype 0x000c - Service Pause Acknowledgement
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
485 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
486 * It is rather important that aim_sendpauseack() gets called for the exact
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
487 * same connection that the Server Pause callback was called for, since
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
488 * libfaim extracts the data for the SNAC from the connection structure.
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
489 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
490 * Of course, if you don't do that, more bad things happen than just what
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
491 * libfaim can cause.
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
492 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
493 */
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
494 faim_export int aim_sendpauseack(aim_session_t *sess, aim_conn_t *conn)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
495 {
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
496 aim_frame_t *fr;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
497 aim_snacid_t snacid;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
498 aim_conn_inside_t *ins = (aim_conn_inside_t *)conn->inside;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
499 struct snacgroup *sg;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
500
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
501 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 1024)))
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
502 return -ENOMEM;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
503
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
504 snacid = aim_cachesnac(sess, 0x0001, 0x000c, 0x0000, NULL, 0);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
505 aim_putsnac(&fr->data, 0x0001, 0x000c, 0x0000, snacid);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
506
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
507 /*
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
508 * This list should have all the groups that the original
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
509 * Host Online / Server Ready said this host supports. And
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
510 * we want them all back after the migration.
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
511 */
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
512 for (sg = ins->groups; sg; sg = sg->next)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
513 aimbs_put16(&fr->data, sg->group);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
514
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
515 aim_tx_enqueue(sess, fr);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
516
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
517 return 0;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
518 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
519
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 2866
diff changeset
520 /* Subtype 0x000d - Service Resume */
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
521 static int serverresume(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
522 {
4871
0b64f386a7b8 [gaim-migrate @ 5201]
Mark Doliner <mark@kingant.net>
parents: 4342
diff changeset
523 int ret = 0;
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
524 aim_rxcallback_t userfunc;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
525
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
526 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
4871
0b64f386a7b8 [gaim-migrate @ 5201]
Mark Doliner <mark@kingant.net>
parents: 4342
diff changeset
527 ret = userfunc(sess, rx);
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
528
4871
0b64f386a7b8 [gaim-migrate @ 5201]
Mark Doliner <mark@kingant.net>
parents: 4342
diff changeset
529 return ret;
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
530 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
531
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 2866
diff changeset
532 /* Subtype 0x000e - Request self-info */
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
533 faim_export int aim_reqpersonalinfo(aim_session_t *sess, aim_conn_t *conn)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
534 {
7282
ad243bc63184 [gaim-migrate @ 7861]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
535 return aim_genericreq_n_snacid(sess, conn, 0x0001, 0x000e);
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
536 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
537
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 2866
diff changeset
538 /* Subtype 0x000f - Self User Info */
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
539 static int selfinfo(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
540 {
4871
0b64f386a7b8 [gaim-migrate @ 5201]
Mark Doliner <mark@kingant.net>
parents: 4342
diff changeset
541 int ret = 0;
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
542 aim_rxcallback_t userfunc;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
543 aim_userinfo_t userinfo;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
544
5836
09f7f23dc83a [gaim-migrate @ 6267]
Mark Doliner <mark@kingant.net>
parents: 4901
diff changeset
545 aim_info_extract(sess, bs, &userinfo);
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
546
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
547 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
4871
0b64f386a7b8 [gaim-migrate @ 5201]
Mark Doliner <mark@kingant.net>
parents: 4342
diff changeset
548 ret = userfunc(sess, rx, &userinfo);
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
549
5836
09f7f23dc83a [gaim-migrate @ 6267]
Mark Doliner <mark@kingant.net>
parents: 4901
diff changeset
550 aim_info_free(&userinfo);
09f7f23dc83a [gaim-migrate @ 6267]
Mark Doliner <mark@kingant.net>
parents: 4901
diff changeset
551
4871
0b64f386a7b8 [gaim-migrate @ 5201]
Mark Doliner <mark@kingant.net>
parents: 4342
diff changeset
552 return ret;
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
553 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
554
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 2866
diff changeset
555 /* Subtype 0x0010 - Evil Notification */
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
556 static int evilnotify(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
557 {
4871
0b64f386a7b8 [gaim-migrate @ 5201]
Mark Doliner <mark@kingant.net>
parents: 4342
diff changeset
558 int ret = 0;
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
559 aim_rxcallback_t userfunc;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
560 fu16_t newevil;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
561 aim_userinfo_t userinfo;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
562
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
563 memset(&userinfo, 0, sizeof(aim_userinfo_t));
10157
0de7eee583e6 [gaim-migrate @ 11237]
Mark Doliner <mark@kingant.net>
parents: 9879
diff changeset
564
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
565 newevil = aimbs_get16(bs);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
566
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
567 if (aim_bstream_empty(bs))
5836
09f7f23dc83a [gaim-migrate @ 6267]
Mark Doliner <mark@kingant.net>
parents: 4901
diff changeset
568 aim_info_extract(sess, bs, &userinfo);
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
569
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
570 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
4871
0b64f386a7b8 [gaim-migrate @ 5201]
Mark Doliner <mark@kingant.net>
parents: 4342
diff changeset
571 ret = userfunc(sess, rx, newevil, &userinfo);
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
572
5836
09f7f23dc83a [gaim-migrate @ 6267]
Mark Doliner <mark@kingant.net>
parents: 4901
diff changeset
573 aim_info_free(&userinfo);
09f7f23dc83a [gaim-migrate @ 6267]
Mark Doliner <mark@kingant.net>
parents: 4901
diff changeset
574
4871
0b64f386a7b8 [gaim-migrate @ 5201]
Mark Doliner <mark@kingant.net>
parents: 4342
diff changeset
575 return ret;
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
576 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
577
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
578 /*
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 2866
diff changeset
579 * Subtype 0x0011 - Idle Notification
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
580 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
581 * Should set your current idle time in seconds. Note that this should
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
582 * never be called consecutively with a non-zero idle time. That makes
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
583 * OSCAR do funny things. Instead, just set it once you go idle, and then
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
584 * call it again with zero when you're back.
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
585 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
586 */
7474
2bdacd38528c [gaim-migrate @ 8087]
Mark Doliner <mark@kingant.net>
parents: 7282
diff changeset
587 faim_export int aim_srv_setidle(aim_session_t *sess, fu32_t idletime)
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
588 {
7474
2bdacd38528c [gaim-migrate @ 8087]
Mark Doliner <mark@kingant.net>
parents: 7282
diff changeset
589 aim_conn_t *conn;
2bdacd38528c [gaim-migrate @ 8087]
Mark Doliner <mark@kingant.net>
parents: 7282
diff changeset
590
7484
5b83ed21f070 [gaim-migrate @ 8097]
Mark Doliner <mark@kingant.net>
parents: 7474
diff changeset
591 if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_BOS)))
7474
2bdacd38528c [gaim-migrate @ 8087]
Mark Doliner <mark@kingant.net>
parents: 7282
diff changeset
592 return -EINVAL;
2bdacd38528c [gaim-migrate @ 8087]
Mark Doliner <mark@kingant.net>
parents: 7282
diff changeset
593
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
594 return aim_genericreq_l(sess, conn, 0x0001, 0x0011, &idletime);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
595 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
596
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
597 /*
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 2866
diff changeset
598 * Subtype 0x0012 - Service Migrate
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
599 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
600 * This is the final SNAC sent on the original connection during a migration.
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
601 * It contains the IP and cookie used to connect to the new server, and
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
602 * optionally a list of the SNAC groups being migrated.
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
603 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
604 */
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
605 static int migrate(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
606 {
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
607 aim_rxcallback_t userfunc;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
608 int ret = 0;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
609 fu16_t groupcount, i;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
610 aim_tlvlist_t *tl;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
611 char *ip = NULL;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
612 aim_tlv_t *cktlv;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
613
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
614 /*
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
615 * Apparently there's some fun stuff that can happen right here. The
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
616 * migration can actually be quite selective about what groups it
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
617 * moves to the new server. When not all the groups for a connection
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
618 * are migrated, or they are all migrated but some groups are moved
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
619 * to a different server than others, it is called a bifurcated
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
620 * migration.
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
621 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
622 * Let's play dumb and not support that.
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
623 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
624 */
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
625 groupcount = aimbs_get16(bs);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
626 for (i = 0; i < groupcount; i++) {
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
627 fu16_t group;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
628
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
629 group = aimbs_get16(bs);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
630
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
631 faimdprintf(sess, 0, "bifurcated migration unsupported -- group 0x%04x\n", group);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
632 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
633
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7141
diff changeset
634 tl = aim_tlvlist_read(bs);
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
635
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7141
diff changeset
636 if (aim_tlv_gettlv(tl, 0x0005, 1))
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7141
diff changeset
637 ip = aim_tlv_getstr(tl, 0x0005, 1);
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
638
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7141
diff changeset
639 cktlv = aim_tlv_gettlv(tl, 0x0006, 1);
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
640
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
641 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
642 ret = userfunc(sess, rx, ip, cktlv ? cktlv->value : NULL);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
643
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7141
diff changeset
644 aim_tlvlist_free(&tl);
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
645 free(ip);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
646
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
647 return ret;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
648 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
649
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 2866
diff changeset
650 /* Subtype 0x0013 - Message of the Day */
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
651 static int motd(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
652 {
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
653 aim_rxcallback_t userfunc;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
654 char *msg = NULL;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
655 int ret = 0;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
656 aim_tlvlist_t *tlvlist;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
657 fu16_t id;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
658
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
659 /*
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
660 * Code.
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
661 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
662 * Valid values:
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
663 * 1 Mandatory upgrade
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
664 * 2 Advisory upgrade
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
665 * 3 System bulletin
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
666 * 4 Nothing's wrong ("top o the world" -- normal)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
667 * 5 Lets-break-something.
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
668 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
669 */
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
670 id = aimbs_get16(bs);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
671
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
672 /*
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
673 * TLVs follow
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
674 */
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7141
diff changeset
675 tlvlist = aim_tlvlist_read(bs);
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
676
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7141
diff changeset
677 msg = aim_tlv_getstr(tlvlist, 0x000b, 1);
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
678
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
679 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
680 ret = userfunc(sess, rx, id, msg);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
681
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
682 free(msg);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
683
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7141
diff changeset
684 aim_tlvlist_free(&tlvlist);
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
685
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
686 return ret;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
687 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
688
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
689 /*
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 2866
diff changeset
690 * Subtype 0x0014 - Set privacy flags
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
691 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
692 * Normally 0x03.
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
693 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
694 * Bit 1: Allows other AIM users to see how long you've been idle.
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
695 * Bit 2: Allows other AIM users to see how long you've been a member.
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
696 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
697 */
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
698 faim_export int aim_bos_setprivacyflags(aim_session_t *sess, aim_conn_t *conn, fu32_t flags)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
699 {
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
700 return aim_genericreq_l(sess, conn, 0x0001, 0x0014, &flags);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
701 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
702
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
703 /*
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 2866
diff changeset
704 * Subtype 0x0016 - No-op
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
705 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
706 * WinAIM sends these every 4min or so to keep the connection alive. Its not
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 2866
diff changeset
707 * really necessary.
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
708 *
7282
ad243bc63184 [gaim-migrate @ 7861]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
709 * Wha? No? Since when? I think WinAIM sends an empty channel 3
ad243bc63184 [gaim-migrate @ 7861]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
710 * SNAC as a no-op...
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
711 */
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
712 faim_export int aim_nop(aim_session_t *sess, aim_conn_t *conn)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
713 {
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
714 return aim_genericreq_n(sess, conn, 0x0001, 0x0016);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
715 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
716
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
717 /*
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 2866
diff changeset
718 * Subtype 0x0017 - Set client versions
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
719 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
720 * If you've seen the clientonline/clientready SNAC you're probably
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
721 * wondering what the point of this one is. And that point seems to be
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
722 * that the versions in the client online SNAC are sent too late for the
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
723 * server to be able to use them to change the protocol for the earlier
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
724 * login packets (client versions are sent right after Host Online is
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
725 * received, but client online versions aren't sent until quite a bit later).
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
726 * We can see them already making use of this by changing the format of
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
727 * the rate information based on what version of group 1 we advertise here.
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
728 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
729 */
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
730 faim_internal int aim_setversions(aim_session_t *sess, aim_conn_t *conn)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
731 {
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
732 aim_conn_inside_t *ins = (aim_conn_inside_t *)conn->inside;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
733 struct snacgroup *sg;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
734 aim_frame_t *fr;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
735 aim_snacid_t snacid;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
736
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
737 if (!ins)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
738 return -EINVAL;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
739
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
740 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 1152)))
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
741 return -ENOMEM;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
742
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
743 snacid = aim_cachesnac(sess, 0x0001, 0x0017, 0x0000, NULL, 0);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
744 aim_putsnac(&fr->data, 0x0001, 0x0017, 0x0000, snacid);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
745
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
746 /*
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
747 * Send only the versions that the server cares about (that it
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
748 * marked as supporting in the server ready SNAC).
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
749 */
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
750 for (sg = ins->groups; sg; sg = sg->next) {
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
751 aim_module_t *mod;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
752
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
753 if ((mod = aim__findmodulebygroup(sess, sg->group))) {
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
754 aimbs_put16(&fr->data, mod->family);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
755 aimbs_put16(&fr->data, mod->version);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
756 } else
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
757 faimdprintf(sess, 1, "aim_setversions: server supports group 0x%04x but we don't!\n", sg->group);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
758 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
759
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
760 aim_tx_enqueue(sess, fr);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
761
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
762 return 0;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
763 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
764
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 2866
diff changeset
765 /* Subtype 0x0018 - Host versions */
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
766 static int hostversions(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
767 {
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
768 int vercount;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
769 fu8_t *versions;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
770
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
771 /* This is frivolous. (Thank you SmarterChild.) */
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
772 vercount = aim_bstream_empty(bs)/4;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
773 versions = aimbs_getraw(bs, aim_bstream_empty(bs));
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
774 free(versions);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
775
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
776 /*
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
777 * Now request rates.
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
778 */
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
779 aim_reqrates(sess, rx->conn);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
780
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
781 return 1;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
782 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
783
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
784 /*
10560
33746d45bd0d [gaim-migrate @ 11938]
Mark Doliner <mark@kingant.net>
parents: 10199
diff changeset
785 * Subtype 0x001e - Set various account settings (mostly ICQ related).
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
786 *
10560
33746d45bd0d [gaim-migrate @ 11938]
Mark Doliner <mark@kingant.net>
parents: 10199
diff changeset
787 * These settings are transient, not server-stored (i.e. they only
33746d45bd0d [gaim-migrate @ 11938]
Mark Doliner <mark@kingant.net>
parents: 10199
diff changeset
788 * apply to this session, and must be re-set the next time you sign
33746d45bd0d [gaim-migrate @ 11938]
Mark Doliner <mark@kingant.net>
parents: 10199
diff changeset
789 * on).
33746d45bd0d [gaim-migrate @ 11938]
Mark Doliner <mark@kingant.net>
parents: 10199
diff changeset
790 *
33746d45bd0d [gaim-migrate @ 11938]
Mark Doliner <mark@kingant.net>
parents: 10199
diff changeset
791 * You can set your ICQ status (available, away, do not disturb,
33746d45bd0d [gaim-migrate @ 11938]
Mark Doliner <mark@kingant.net>
parents: 10199
diff changeset
792 * etc.), or whether your IP address should be hidden or not, or
33746d45bd0d [gaim-migrate @ 11938]
Mark Doliner <mark@kingant.net>
parents: 10199
diff changeset
793 * if your status is visible on ICQ web sites, and you can set
33746d45bd0d [gaim-migrate @ 11938]
Mark Doliner <mark@kingant.net>
parents: 10199
diff changeset
794 * your IP address info and what not.
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
795 *
4342
051265d35a36 [gaim-migrate @ 4607]
Mark Doliner <mark@kingant.net>
parents: 4293
diff changeset
796 * These are the same TLVs seen in user info. You can
051265d35a36 [gaim-migrate @ 4607]
Mark Doliner <mark@kingant.net>
parents: 4293
diff changeset
797 * also set 0x0008 and 0x000c.
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
798 */
4901
ad589b887af9 [gaim-migrate @ 5235]
Mark Doliner <mark@kingant.net>
parents: 4871
diff changeset
799 faim_export int aim_setextstatus(aim_session_t *sess, fu32_t status)
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
800 {
4901
ad589b887af9 [gaim-migrate @ 5235]
Mark Doliner <mark@kingant.net>
parents: 4871
diff changeset
801 aim_conn_t *conn;
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
802 aim_frame_t *fr;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
803 aim_snacid_t snacid;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
804 aim_tlvlist_t *tl = NULL;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
805 fu32_t data;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
806
9879
aef5f316b746 [gaim-migrate @ 10758]
Mark Doliner <mark@kingant.net>
parents: 8735
diff changeset
807 if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_MSG)))
4901
ad589b887af9 [gaim-migrate @ 5235]
Mark Doliner <mark@kingant.net>
parents: 4871
diff changeset
808 return -EINVAL;
ad589b887af9 [gaim-migrate @ 5235]
Mark Doliner <mark@kingant.net>
parents: 4871
diff changeset
809
10560
33746d45bd0d [gaim-migrate @ 11938]
Mark Doliner <mark@kingant.net>
parents: 10199
diff changeset
810 data = AIM_ICQ_STATE_DIRECTREQUIREAUTH | AIM_ICQ_STATE_HIDEIP | AIM_ICQ_STATE_WEBAWARE | status;
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
811
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
812 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 8)))
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
813 return -ENOMEM;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
814
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
815 snacid = aim_cachesnac(sess, 0x0001, 0x001e, 0x0000, NULL, 0);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
816 aim_putsnac(&fr->data, 0x0001, 0x001e, 0x0000, snacid);
10157
0de7eee583e6 [gaim-migrate @ 11237]
Mark Doliner <mark@kingant.net>
parents: 9879
diff changeset
817
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7141
diff changeset
818 aim_tlvlist_add_32(&tl, 0x0006, data);
10560
33746d45bd0d [gaim-migrate @ 11938]
Mark Doliner <mark@kingant.net>
parents: 10199
diff changeset
819 #if 0
33746d45bd0d [gaim-migrate @ 11938]
Mark Doliner <mark@kingant.net>
parents: 10199
diff changeset
820 aim_tlvlist_add_raw(&tl, 0x000c, 0x0025, chunk_of_x25_bytes_with_ip_address_etc);
33746d45bd0d [gaim-migrate @ 11938]
Mark Doliner <mark@kingant.net>
parents: 10199
diff changeset
821 aim_tlvlist_add_raw(&tl, 0x0011, 0x0005, unknown 0x01 61 10 f6 41);
33746d45bd0d [gaim-migrate @ 11938]
Mark Doliner <mark@kingant.net>
parents: 10199
diff changeset
822 aim_tlvlist_add_16(&tl, 0x0012, unknown 0x00 00);
33746d45bd0d [gaim-migrate @ 11938]
Mark Doliner <mark@kingant.net>
parents: 10199
diff changeset
823 #endif
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7141
diff changeset
824 aim_tlvlist_write(&fr->data, &tl);
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7141
diff changeset
825 aim_tlvlist_free(&tl);
10157
0de7eee583e6 [gaim-migrate @ 11237]
Mark Doliner <mark@kingant.net>
parents: 9879
diff changeset
826
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
827 aim_tx_enqueue(sess, fr);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
828
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
829 return 0;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
830 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
831
5917
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
832 /*
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
833 * Subtype 0x001e - Extended Status.
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
834 *
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
835 * Sets your "available" message. This is currently only supported by iChat
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
836 * and Gaim.
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
837 *
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
838 * These are the same TLVs seen in user info. You can
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
839 * also set 0x0008 and 0x000c.
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
840 */
10199
76e296e16def [gaim-migrate @ 11316]
Mark Doliner <mark@kingant.net>
parents: 10157
diff changeset
841 faim_export int aim_srv_setavailmsg(aim_session_t *sess, const char *msg)
5917
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
842 {
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
843 aim_conn_t *conn;
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
844 aim_frame_t *fr;
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
845 aim_snacid_t snacid;
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
846
9879
aef5f316b746 [gaim-migrate @ 10758]
Mark Doliner <mark@kingant.net>
parents: 8735
diff changeset
847 if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0004)))
5917
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
848 return -EINVAL;
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
849
7141
af8ac078d4c2 [gaim-migrate @ 7708]
Mark Doliner <mark@kingant.net>
parents: 6101
diff changeset
850 if (msg != NULL) {
5948
1bebb8345bde [gaim-migrate @ 6392]
Mark Doliner <mark@kingant.net>
parents: 5917
diff changeset
851 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + strlen(msg) + 8)))
5917
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
852 return -ENOMEM;
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
853
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
854 snacid = aim_cachesnac(sess, 0x0001, 0x001e, 0x0000, NULL, 0);
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
855 aim_putsnac(&fr->data, 0x0001, 0x001e, 0x0000, snacid);
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
856
7141
af8ac078d4c2 [gaim-migrate @ 7708]
Mark Doliner <mark@kingant.net>
parents: 6101
diff changeset
857 aimbs_put16(&fr->data, 0x001d); /* userinfo TLV type */
af8ac078d4c2 [gaim-migrate @ 7708]
Mark Doliner <mark@kingant.net>
parents: 6101
diff changeset
858 aimbs_put16(&fr->data, strlen(msg)+8); /* total length of userinfo TLV data */
5948
1bebb8345bde [gaim-migrate @ 6392]
Mark Doliner <mark@kingant.net>
parents: 5917
diff changeset
859 aimbs_put16(&fr->data, 0x0002);
1bebb8345bde [gaim-migrate @ 6392]
Mark Doliner <mark@kingant.net>
parents: 5917
diff changeset
860 aimbs_put8(&fr->data, 0x04);
1bebb8345bde [gaim-migrate @ 6392]
Mark Doliner <mark@kingant.net>
parents: 5917
diff changeset
861 aimbs_put8(&fr->data, strlen(msg)+4);
1bebb8345bde [gaim-migrate @ 6392]
Mark Doliner <mark@kingant.net>
parents: 5917
diff changeset
862 aimbs_put16(&fr->data, strlen(msg));
5917
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
863 aimbs_putraw(&fr->data, msg, strlen(msg));
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
864 aimbs_put16(&fr->data, 0x0000);
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
865 } else {
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
866 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + 8)))
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
867 return -ENOMEM;
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
868
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
869 snacid = aim_cachesnac(sess, 0x0001, 0x001e, 0x0000, NULL, 0);
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
870 aim_putsnac(&fr->data, 0x0001, 0x001e, 0x0000, snacid);
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
871
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
872 aimbs_put16(&fr->data, 0x001d);
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
873 aimbs_put16(&fr->data, 0x0008);
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
874 aimbs_put16(&fr->data, 0x0002);
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
875 aimbs_put16(&fr->data, 0x0404);
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
876 aimbs_put16(&fr->data, 0x0000);
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
877 aimbs_put16(&fr->data, 0x0000);
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
878 }
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
879
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
880 aim_tx_enqueue(sess, fr);
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
881
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
882 return 0;
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
883 }
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
884
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
885 /*
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
886 * Starting this past week (26 Mar 2001, say), AOL has started sending
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
887 * this nice little extra SNAC. AFAIK, it has never been used until now.
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
888 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
889 * The request contains eight bytes. The first four are an offset, the
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
890 * second four are a length.
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
891 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
892 * The offset is an offset into aim.exe when it is mapped during execution
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
893 * on Win32. So far, AOL has only been requesting bytes in static regions
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
894 * of memory. (I won't put it past them to start requesting data in
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
895 * less static regions -- regions that are initialized at run time, but still
8735
92cbf9713795 [gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents: 8225
diff changeset
896 * before the client receives this request.)
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
897 *
8735
92cbf9713795 [gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents: 8225
diff changeset
898 * When the client receives the request, it adds it to the current ds
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
899 * (0x00400000) and dereferences it, copying the data into a buffer which
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
900 * it then runs directly through the MD5 hasher. The 16 byte output of
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
901 * the hash is then sent back to the server.
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
902 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
903 * If the client does not send any data back, or the data does not match
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
904 * the data that the specific client should have, the client will get the
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
905 * following message from "AOL Instant Messenger":
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
906 * "You have been disconnected from the AOL Instant Message Service (SM)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
907 * for accessing the AOL network using unauthorized software. You can
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
908 * download a FREE, fully featured, and authorized client, here
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
909 * http://www.aol.com/aim/download2.html"
8735
92cbf9713795 [gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents: 8225
diff changeset
910 * The connection is then closed, receiving disconnect code 1, URL
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
911 * http://www.aim.aol.com/errors/USER_LOGGED_OFF_NEW_LOGIN.html.
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
912 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
913 * Note, however, that numerous inconsistencies can cause the above error,
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
914 * not just sending back a bad hash. Do not immediatly suspect this code
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
915 * if you get disconnected. AOL and the open/free software community have
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
916 * played this game for a couple years now, generating the above message
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
917 * on numerous ocassions.
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
918 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
919 * Anyway, neener. We win again.
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
920 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
921 */
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 2866
diff changeset
922 /* Subtype 0x001f - Client verification */
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
923 static int memrequest(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
924 {
4871
0b64f386a7b8 [gaim-migrate @ 5201]
Mark Doliner <mark@kingant.net>
parents: 4342
diff changeset
925 int ret = 0;
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
926 aim_rxcallback_t userfunc;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
927 fu32_t offset, len;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
928 aim_tlvlist_t *list;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
929 char *modname;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
930
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
931 offset = aimbs_get32(bs);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
932 len = aimbs_get32(bs);
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7141
diff changeset
933 list = aim_tlvlist_read(bs);
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
934
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7141
diff changeset
935 modname = aim_tlv_getstr(list, 0x0001, 1);
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
936
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
937 faimdprintf(sess, 1, "data at 0x%08lx (%d bytes) of requested\n", offset, len, modname ? modname : "aim.exe");
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
938
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
939 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
4871
0b64f386a7b8 [gaim-migrate @ 5201]
Mark Doliner <mark@kingant.net>
parents: 4342
diff changeset
940 ret = userfunc(sess, rx, offset, len, modname);
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
941
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
942 free(modname);
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7141
diff changeset
943 aim_tlvlist_free(&list);
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
944
4871
0b64f386a7b8 [gaim-migrate @ 5201]
Mark Doliner <mark@kingant.net>
parents: 4342
diff changeset
945 return ret;
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
946 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
947
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
948 #if 0
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
949 static void dumpbox(aim_session_t *sess, unsigned char *buf, int len)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
950 {
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
951 int i;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
952
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
953 if (!sess || !buf || !len)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
954 return;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
955
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
956 faimdprintf(sess, 1, "\nDump of %d bytes at %p:", len, buf);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
957
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
958 for (i = 0; i < len; i++) {
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
959 if ((i % 8) == 0)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
960 faimdprintf(sess, 1, "\n\t");
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
961
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
962 faimdprintf(sess, 1, "0x%2x ", buf[i]);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
963 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
964
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
965 faimdprintf(sess, 1, "\n\n");
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
966
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
967 return;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
968 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
969 #endif
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
970
3952
07283934dedd [gaim-migrate @ 4133]
Mark Doliner <mark@kingant.net>
parents: 2866
diff changeset
971 /* Subtype 0x0020 - Client verification reply */
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
972 faim_export int aim_sendmemblock(aim_session_t *sess, aim_conn_t *conn, fu32_t offset, fu32_t len, const fu8_t *buf, fu8_t flag)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
973 {
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
974 aim_frame_t *fr;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
975 aim_snacid_t snacid;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
976
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
977 if (!sess || !conn)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
978 return -EINVAL;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
979
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
980 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+2+16)))
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
981 return -ENOMEM;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
982
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
983 snacid = aim_cachesnac(sess, 0x0001, 0x0020, 0x0000, NULL, 0);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
984
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
985 aim_putsnac(&fr->data, 0x0001, 0x0020, 0x0000, snacid);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
986 aimbs_put16(&fr->data, 0x0010); /* md5 is always 16 bytes */
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
987
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
988 if ((flag == AIM_SENDMEMBLOCK_FLAG_ISHASH) && buf && (len == 0x10)) { /* we're getting a hash */
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
989
10157
0de7eee583e6 [gaim-migrate @ 11237]
Mark Doliner <mark@kingant.net>
parents: 9879
diff changeset
990 aimbs_putraw(&fr->data, buf, 0x10);
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
991
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
992 } else if (buf && (len > 0)) { /* use input buffer */
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
993 md5_state_t state;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
994 md5_byte_t digest[0x10];
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
995
10157
0de7eee583e6 [gaim-migrate @ 11237]
Mark Doliner <mark@kingant.net>
parents: 9879
diff changeset
996 md5_init(&state);
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
997 md5_append(&state, (const md5_byte_t *)buf, len);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
998 md5_finish(&state, digest);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
999
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1000 aimbs_putraw(&fr->data, (fu8_t *)digest, 0x10);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1001
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1002 } else if (len == 0) { /* no length, just hash NULL (buf is optional) */
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1003 md5_state_t state;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1004 fu8_t nil = '\0';
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1005 md5_byte_t digest[0x10];
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1006
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1007 /*
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1008 * These MD5 routines are stupid in that you have to have
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1009 * at least one append. So thats why this doesn't look
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1010 * real logical.
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1011 */
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1012 md5_init(&state);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1013 md5_append(&state, (const md5_byte_t *)&nil, 0);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1014 md5_finish(&state, digest);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1015
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1016 aimbs_putraw(&fr->data, (fu8_t *)digest, 0x10);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1017
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1018 } else {
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1019
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1020 /*
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1021 * This data is correct for AIM 3.5.1670.
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1022 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1023 * Using these blocks is as close to "legal" as you can get
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1024 * without using an AIM binary.
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1025 *
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1026 */
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1027 if ((offset == 0x03ffffff) && (len == 0x03ffffff)) {
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1028
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1029 #if 1 /* with "AnrbnrAqhfzcd" */
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1030 aimbs_put32(&fr->data, 0x44a95d26);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1031 aimbs_put32(&fr->data, 0xd2490423);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1032 aimbs_put32(&fr->data, 0x93b8821f);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1033 aimbs_put32(&fr->data, 0x51c54b01);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1034 #else /* no filename */
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1035 aimbs_put32(&fr->data, 0x1df8cbae);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1036 aimbs_put32(&fr->data, 0x5523b839);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1037 aimbs_put32(&fr->data, 0xa0e10db3);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1038 aimbs_put32(&fr->data, 0xa46d3b39);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1039 #endif
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1040
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1041 } else if ((offset == 0x00001000) && (len == 0x00000000)) {
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1042
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1043 aimbs_put32(&fr->data, 0xd41d8cd9);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1044 aimbs_put32(&fr->data, 0x8f00b204);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1045 aimbs_put32(&fr->data, 0xe9800998);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1046 aimbs_put32(&fr->data, 0xecf8427e);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1047
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1048 } else
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1049 faimdprintf(sess, 0, "sendmemblock: WARNING: unknown hash request\n");
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1050
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1051 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1052
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1053 aim_tx_enqueue(sess, fr);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1054
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1055 return 0;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1056 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1057
5836
09f7f23dc83a [gaim-migrate @ 6267]
Mark Doliner <mark@kingant.net>
parents: 4901
diff changeset
1058 /*
09f7f23dc83a [gaim-migrate @ 6267]
Mark Doliner <mark@kingant.net>
parents: 4901
diff changeset
1059 * Subtype 0x0021 - Receive our extended status
09f7f23dc83a [gaim-migrate @ 6267]
Mark Doliner <mark@kingant.net>
parents: 4901
diff changeset
1060 *
5892
da8939ad60b6 [gaim-migrate @ 6324]
Mark Doliner <mark@kingant.net>
parents: 5871
diff changeset
1061 * This is used for iChat's "available" messages, and maybe ICQ extended
da8939ad60b6 [gaim-migrate @ 6324]
Mark Doliner <mark@kingant.net>
parents: 5871
diff changeset
1062 * status messages? It's also used to tell the client whether or not it
da8939ad60b6 [gaim-migrate @ 6324]
Mark Doliner <mark@kingant.net>
parents: 5871
diff changeset
1063 * needs to upload an SSI buddy icon... who engineers this stuff, anyway?
5836
09f7f23dc83a [gaim-migrate @ 6267]
Mark Doliner <mark@kingant.net>
parents: 4901
diff changeset
1064 */
09f7f23dc83a [gaim-migrate @ 6267]
Mark Doliner <mark@kingant.net>
parents: 4901
diff changeset
1065 static int aim_parse_extstatus(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
09f7f23dc83a [gaim-migrate @ 6267]
Mark Doliner <mark@kingant.net>
parents: 4901
diff changeset
1066 {
5892
da8939ad60b6 [gaim-migrate @ 6324]
Mark Doliner <mark@kingant.net>
parents: 5871
diff changeset
1067 int ret = 0;
5836
09f7f23dc83a [gaim-migrate @ 6267]
Mark Doliner <mark@kingant.net>
parents: 4901
diff changeset
1068 aim_rxcallback_t userfunc;
5837
a48c338dff6c [gaim-migrate @ 6268]
Mark Doliner <mark@kingant.net>
parents: 5836
diff changeset
1069 fu16_t type;
5892
da8939ad60b6 [gaim-migrate @ 6324]
Mark Doliner <mark@kingant.net>
parents: 5871
diff changeset
1070 fu8_t flags, length;
5836
09f7f23dc83a [gaim-migrate @ 6267]
Mark Doliner <mark@kingant.net>
parents: 4901
diff changeset
1071
10157
0de7eee583e6 [gaim-migrate @ 11237]
Mark Doliner <mark@kingant.net>
parents: 9879
diff changeset
1072 type = aimbs_get16(bs);
5892
da8939ad60b6 [gaim-migrate @ 6324]
Mark Doliner <mark@kingant.net>
parents: 5871
diff changeset
1073 flags = aimbs_get8(bs);
da8939ad60b6 [gaim-migrate @ 6324]
Mark Doliner <mark@kingant.net>
parents: 5871
diff changeset
1074 length = aimbs_get8(bs);
da8939ad60b6 [gaim-migrate @ 6324]
Mark Doliner <mark@kingant.net>
parents: 5871
diff changeset
1075
5842
dbed8c87f750 [gaim-migrate @ 6273]
Sean Egan <seanegan@gmail.com>
parents: 5837
diff changeset
1076 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
dbed8c87f750 [gaim-migrate @ 6273]
Sean Egan <seanegan@gmail.com>
parents: 5837
diff changeset
1077 switch (type) {
5892
da8939ad60b6 [gaim-migrate @ 6324]
Mark Doliner <mark@kingant.net>
parents: 5871
diff changeset
1078 case 0x0000:
6101
e4a5085fb870 [gaim-migrate @ 6560]
Mark Doliner <mark@kingant.net>
parents: 5948
diff changeset
1079 case 0x0001: { /* buddy icon checksum */
e4a5085fb870 [gaim-migrate @ 6560]
Mark Doliner <mark@kingant.net>
parents: 5948
diff changeset
1080 /* not sure what the difference between 1 and 0 is */
5892
da8939ad60b6 [gaim-migrate @ 6324]
Mark Doliner <mark@kingant.net>
parents: 5871
diff changeset
1081 fu8_t *md5 = aimbs_getraw(bs, length);
da8939ad60b6 [gaim-migrate @ 6324]
Mark Doliner <mark@kingant.net>
parents: 5871
diff changeset
1082 ret = userfunc(sess, rx, type, flags, length, md5);
5842
dbed8c87f750 [gaim-migrate @ 6273]
Sean Egan <seanegan@gmail.com>
parents: 5837
diff changeset
1083 free(md5);
5892
da8939ad60b6 [gaim-migrate @ 6324]
Mark Doliner <mark@kingant.net>
parents: 5871
diff changeset
1084 } break;
6101
e4a5085fb870 [gaim-migrate @ 6560]
Mark Doliner <mark@kingant.net>
parents: 5948
diff changeset
1085 case 0x0002: { /* available message */
5892
da8939ad60b6 [gaim-migrate @ 6324]
Mark Doliner <mark@kingant.net>
parents: 5871
diff changeset
1086 /* there is a second length that is just for the message */
da8939ad60b6 [gaim-migrate @ 6324]
Mark Doliner <mark@kingant.net>
parents: 5871
diff changeset
1087 char *msg = aimbs_getstr(bs, aimbs_get16(bs));
5842
dbed8c87f750 [gaim-migrate @ 6273]
Sean Egan <seanegan@gmail.com>
parents: 5837
diff changeset
1088 ret = userfunc(sess, rx, msg);
dbed8c87f750 [gaim-migrate @ 6273]
Sean Egan <seanegan@gmail.com>
parents: 5837
diff changeset
1089 free(msg);
5892
da8939ad60b6 [gaim-migrate @ 6324]
Mark Doliner <mark@kingant.net>
parents: 5871
diff changeset
1090 } break;
5842
dbed8c87f750 [gaim-migrate @ 6273]
Sean Egan <seanegan@gmail.com>
parents: 5837
diff changeset
1091 }
5871
508adf90fbb9 [gaim-migrate @ 6303]
Sean Egan <seanegan@gmail.com>
parents: 5843
diff changeset
1092 }
5917
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
1093
a747e9e0e2cf [gaim-migrate @ 6349]
Mark Doliner <mark@kingant.net>
parents: 5892
diff changeset
1094 return ret;
5836
09f7f23dc83a [gaim-migrate @ 6267]
Mark Doliner <mark@kingant.net>
parents: 4901
diff changeset
1095 }
09f7f23dc83a [gaim-migrate @ 6267]
Mark Doliner <mark@kingant.net>
parents: 4901
diff changeset
1096
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1097 static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1098 {
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1099
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1100 if (snac->subtype == 0x0003)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1101 return hostonline(sess, mod, rx, snac, bs);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1102 else if (snac->subtype == 0x0005)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1103 return redirect(sess, mod, rx, snac, bs);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1104 else if (snac->subtype == 0x0007)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1105 return rateresp(sess, mod, rx, snac, bs);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1106 else if (snac->subtype == 0x000a)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1107 return ratechange(sess, mod, rx, snac, bs);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1108 else if (snac->subtype == 0x000b)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1109 return serverpause(sess, mod, rx, snac, bs);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1110 else if (snac->subtype == 0x000d)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1111 return serverresume(sess, mod, rx, snac, bs);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1112 else if (snac->subtype == 0x000f)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1113 return selfinfo(sess, mod, rx, snac, bs);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1114 else if (snac->subtype == 0x0010)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1115 return evilnotify(sess, mod, rx, snac, bs);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1116 else if (snac->subtype == 0x0012)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1117 return migrate(sess, mod, rx, snac, bs);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1118 else if (snac->subtype == 0x0013)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1119 return motd(sess, mod, rx, snac, bs);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1120 else if (snac->subtype == 0x0018)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1121 return hostversions(sess, mod, rx, snac, bs);
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1122 else if (snac->subtype == 0x001f)
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1123 return memrequest(sess, mod, rx, snac, bs);
5836
09f7f23dc83a [gaim-migrate @ 6267]
Mark Doliner <mark@kingant.net>
parents: 4901
diff changeset
1124 else if (snac->subtype == 0x0021)
09f7f23dc83a [gaim-migrate @ 6267]
Mark Doliner <mark@kingant.net>
parents: 4901
diff changeset
1125 return aim_parse_extstatus(sess, mod, rx, snac, bs);
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1126
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1127 return 0;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1128 }
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1129
7474
2bdacd38528c [gaim-migrate @ 8087]
Mark Doliner <mark@kingant.net>
parents: 7282
diff changeset
1130 faim_internal int service_modfirst(aim_session_t *sess, aim_module_t *mod)
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1131 {
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1132
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1133 mod->family = 0x0001;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1134 mod->version = 0x0003;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1135 mod->toolid = 0x0110;
4071
2532f1192da3 [gaim-migrate @ 4283]
Mark Doliner <mark@kingant.net>
parents: 3952
diff changeset
1136 mod->toolversion = 0x0629;
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1137 mod->flags = 0;
7474
2bdacd38528c [gaim-migrate @ 8087]
Mark Doliner <mark@kingant.net>
parents: 7282
diff changeset
1138 strncpy(mod->name, "service", sizeof(mod->name));
2703
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1139 mod->snachandler = snachandler;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1140
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1141 return 0;
441b84ab7f4e [gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1142 }