annotate libfaim/chatnav.c @ 1762:5d53611d68c6

[gaim-migrate @ 1772] we don't distribute this file anymore committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Fri, 27 Apr 2001 21:53:27 +0000
parents 3fe5799b7823
children 109cacf1ff97
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1535
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1 /*
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2 * Handle ChatNav.
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4 * [The ChatNav(igation) service does various things to keep chat
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5 * alive. It provides room information, room searching and creating,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
6 * as well as giving users the right ("permission") to use chat.]
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
7 *
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
8 */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
9
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
10 #define FAIM_INTERNAL
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
11 #include <aim.h>
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
12
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
13 /*
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
14 * conn must be a chatnav connection!
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
15 */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
16 faim_export unsigned long aim_chatnav_reqrights(struct aim_session_t *sess,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
17 struct aim_conn_t *conn)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
18 {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
19 aim_genericreq_n(sess, conn, 0x000d, 0x0002);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
20
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
21 return sess->snac_nextid;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
22 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
23
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
24 faim_export unsigned long aim_chatnav_clientready(struct aim_session_t *sess,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
25 struct aim_conn_t *conn)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
26 {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
27 struct command_tx_struct *newpacket;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
28 int i;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
29
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
30 if (!(newpacket = aim_tx_new(sess, conn, AIM_FRAMETYPE_OSCAR, 0x0002, 0x20)))
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
31 return -1;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
32
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
33 newpacket->lock = 1;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
34
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
35 i = aim_putsnac(newpacket->data, 0x0001, 0x0002, 0x0000, sess->snac_nextid);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
36
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
37 i+= aimutil_put16(newpacket->data+i, 0x000d);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
38 i+= aimutil_put16(newpacket->data+i, 0x0001);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
39
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
40 i+= aimutil_put16(newpacket->data+i, 0x0004);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
41 i+= aimutil_put16(newpacket->data+i, 0x0001);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
42
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
43 i+= aimutil_put16(newpacket->data+i, 0x0001);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
44 i+= aimutil_put16(newpacket->data+i, 0x0003);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
45
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
46 i+= aimutil_put16(newpacket->data+i, 0x0004);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
47 i+= aimutil_put16(newpacket->data+i, 0x0686);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
48
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
49 aim_tx_enqueue(sess, newpacket);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
50
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
51 return (sess->snac_nextid++);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
52 }
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
53
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
54 faim_export unsigned long aim_chatnav_createroom(struct aim_session_t *sess,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
55 struct aim_conn_t *conn,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
56 char *name,
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
57 u_short exchange)
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
58 {
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
59 struct command_tx_struct *newpacket;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
60 int i;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
61
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
62 if (!(newpacket = aim_tx_new(sess, conn, AIM_FRAMETYPE_OSCAR, 0x0002, 10+12+strlen("invite")+strlen(name))))
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
63 return -1;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
64
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
65 newpacket->lock = 1;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
66
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
67 i = aim_putsnac(newpacket->data, 0x000d, 0x0008, 0x0000, sess->snac_nextid);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
68
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
69 /* exchange */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
70 i+= aimutil_put16(newpacket->data+i, exchange);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
71
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
72 /* room cookie */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
73 i+= aimutil_put8(newpacket->data+i, strlen("invite"));
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
74 i+= aimutil_putstr(newpacket->data+i, "invite", strlen("invite"));
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
75
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
76 /* instance */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
77 i+= aimutil_put16(newpacket->data+i, 0xffff);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
78
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
79 /* detail level */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
80 i+= aimutil_put8(newpacket->data+i, 0x01);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
81
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
82 /* tlvcount */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
83 i+= aimutil_put16(newpacket->data+i, 0x0001);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
84
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
85 /* room name */
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
86 i+= aim_puttlv_str(newpacket->data+i, 0x00d3, strlen(name), name);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
87
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
88 aim_cachesnac(sess, 0x000d, 0x0008, 0x0000, NULL, 0);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
89
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
90 aim_tx_enqueue(sess, newpacket);
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
91
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
92 return sess->snac_nextid;
1e2cc8c8bf3c [gaim-migrate @ 1545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
93 }
1649
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
94
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
95 static int parseinfo_perms(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen, struct aim_snac_t *snac2)
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
96 {
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
97 rxcallback_t userfunc;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
98 int ret = 0;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
99 struct aim_tlvlist_t *tlvlist;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
100 struct aim_chat_exchangeinfo *exchanges = NULL;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
101 int curexchange = 0;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
102 struct aim_tlv_t *exchangetlv;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
103 unsigned char maxrooms = 0;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
104 struct aim_tlvlist_t *innerlist;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
105
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
106 tlvlist = aim_readtlvchain(data, datalen);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
107
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
108 /*
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
109 * Type 0x0002: Maximum concurrent rooms.
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
110 */
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
111 if (aim_gettlv(tlvlist, 0x0002, 1))
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
112 maxrooms = aim_gettlv8(tlvlist, 0x0002, 1);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
113
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
114 /*
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
115 * Type 0x0003: Exchange information
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
116 *
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
117 * There can be any number of these, each one
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
118 * representing another exchange.
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
119 *
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
120 */
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
121 curexchange = 0;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
122 while ((exchangetlv = aim_gettlv(tlvlist, 0x0003, curexchange+1))) {
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
123 curexchange++;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
124 exchanges = realloc(exchanges, curexchange * sizeof(struct aim_chat_exchangeinfo));
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
125 /* exchange number */
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
126 exchanges[curexchange-1].number = aimutil_get16(exchangetlv->value);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
127 innerlist = aim_readtlvchain(exchangetlv->value+2, exchangetlv->length-2);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
128
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
129 /*
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
130 * Type 0x000d: Unknown.
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
131 */
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
132 if (aim_gettlv(innerlist, 0x000d, 1))
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
133 ;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
134
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
135 /*
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
136 * Type 0x0004: Unknown
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
137 */
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
138 if (aim_gettlv(innerlist, 0x0004, 1))
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
139 ;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
140
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
141 /*
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
142 * Type 0x0002: Unknown
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
143 */
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
144 if (aim_gettlv(innerlist, 0x0002, 1)) {
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
145 unsigned short classperms;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
146
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
147 classperms = aim_gettlv16(innerlist, 0x0002, 1);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
148
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
149 faimdprintf(sess, 1, "faim: class permissions %x\n", classperms);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
150 }
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
151
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
152 /*
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
153 * Type 0x00c9: Unknown
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
154 */
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
155 if (aim_gettlv(innerlist, 0x00c9, 1))
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
156 ;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
157
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
158 /*
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
159 * Type 0x00ca: Creation Date
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
160 */
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
161 if (aim_gettlv(innerlist, 0x00ca, 1))
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
162 ;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
163
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
164 /*
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
165 * Type 0x00d0: Mandatory Channels?
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
166 */
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
167 if (aim_gettlv(innerlist, 0x00d0, 1))
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
168 ;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
169
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
170 /*
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
171 * Type 0x00d1: Maximum Message length
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
172 */
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
173 if (aim_gettlv(innerlist, 0x00d1, 1))
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
174 ;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
175
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
176 /*
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
177 * Type 0x00d2: Maximum Occupancy?
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
178 */
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
179 if (aim_gettlv(innerlist, 0x00d2, 1))
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
180 ;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
181
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
182 /*
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
183 * Type 0x00d3: Exchange Name
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
184 */
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
185 if (aim_gettlv(innerlist, 0x00d3, 1))
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
186 exchanges[curexchange-1].name = aim_gettlv_str(innerlist, 0x00d3, 1);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
187 else
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
188 exchanges[curexchange-1].name = NULL;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
189
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
190 /*
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
191 * Type 0x00d5: Creation Permissions
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
192 *
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
193 * 0 Creation not allowed
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
194 * 1 Room creation allowed
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
195 * 2 Exchange creation allowed
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
196 *
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
197 */
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
198 if (aim_gettlv(innerlist, 0x00d5, 1)) {
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
199 unsigned char createperms;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
200
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
201 createperms = aim_gettlv8(innerlist, 0x00d5, 1);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
202 }
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
203
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
204 /*
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
205 * Type 0x00d6: Character Set (First Time)
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
206 */
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
207 if (aim_gettlv(innerlist, 0x00d6, 1))
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
208 exchanges[curexchange-1].charset1 = aim_gettlv_str(innerlist, 0x00d6, 1);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
209 else
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
210 exchanges[curexchange-1].charset1 = NULL;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
211
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
212 /*
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
213 * Type 0x00d7: Language (First Time)
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
214 */
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
215 if (aim_gettlv(innerlist, 0x00d7, 1))
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
216 exchanges[curexchange-1].lang1 = aim_gettlv_str(innerlist, 0x00d7, 1);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
217 else
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
218 exchanges[curexchange-1].lang1 = NULL;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
219
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
220 /*
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
221 * Type 0x00d8: Character Set (Second Time)
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
222 */
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
223 if (aim_gettlv(innerlist, 0x00d8, 1))
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
224 exchanges[curexchange-1].charset2 = aim_gettlv_str(innerlist, 0x00d8, 1);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
225 else
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
226 exchanges[curexchange-1].charset2 = NULL;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
227
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
228 /*
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
229 * Type 0x00d9: Language (Second Time)
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
230 */
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
231 if (aim_gettlv(innerlist, 0x00d9, 1))
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
232 exchanges[curexchange-1].lang2 = aim_gettlv_str(innerlist, 0x00d9, 1);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
233 else
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
234 exchanges[curexchange-1].lang2 = NULL;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
235
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
236 aim_freetlvchain(&innerlist);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
237 }
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
238
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
239 /*
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
240 * Call client.
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
241 */
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
242 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
243 ret = userfunc(sess, rx, snac2->type, maxrooms, curexchange, exchanges);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
244 curexchange--;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
245 while(curexchange >= 0) {
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
246 free(exchanges[curexchange].name);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
247 free(exchanges[curexchange].charset1);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
248 free(exchanges[curexchange].lang1);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
249 free(exchanges[curexchange].charset2);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
250 free(exchanges[curexchange].lang2);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
251 curexchange--;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
252 }
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
253 free(exchanges);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
254 aim_freetlvchain(&tlvlist);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
255
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
256 return ret;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
257 }
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
258
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
259 static int parseinfo_create(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen, struct aim_snac_t *snac2)
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
260 {
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
261 rxcallback_t userfunc;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
262 struct aim_tlvlist_t *tlvlist, *innerlist;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
263 char *ck = NULL, *fqcn = NULL, *name = NULL;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
264 unsigned short exchange = 0, instance = 0, unknown = 0, flags = 0, maxmsglen = 0, maxoccupancy = 0;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
265 unsigned long createtime = 0;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
266 unsigned char createperms = 0;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
267 int i = 0, cklen;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
268 struct aim_tlv_t *bigblock;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
269 int ret = 0;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
270
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
271 if (!(tlvlist = aim_readtlvchain(data, datalen))) {
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
272 faimdprintf(sess, 0, "unable to read top tlv in create room response\n");
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
273 return 0;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
274 }
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
275
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
276 if (!(bigblock = aim_gettlv(tlvlist, 0x0004, 1))) {
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
277 faimdprintf(sess, 0, "no bigblock in top tlv in create room response\n");
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
278 aim_freetlvchain(&tlvlist);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
279 return 0;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
280 }
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
281
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
282 exchange = aimutil_get16(bigblock->value+i);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
283 i += 2;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
284
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
285 cklen = aimutil_get8(bigblock->value+i);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
286 i++;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
287
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
288 ck = malloc(cklen+1);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
289 memcpy(ck, bigblock->value+i, cklen);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
290 ck[cklen] = '\0';
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
291 i += cklen;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
292
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
293 instance = aimutil_get16(bigblock->value+i);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
294 i += 2;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
295
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
296 if (aimutil_get8(bigblock->value+i) != 0x02) {
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
297 faimdprintf(sess, 0, "unknown detaillevel in create room response (0x%02x)\n", aimutil_get8(bigblock->value+i));
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
298 aim_freetlvchain(&tlvlist);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
299 free(ck);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
300 return 0;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
301 }
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
302 i += 1;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
303
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
304 unknown = aimutil_get16(bigblock->value+i);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
305 i += 2;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
306
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
307 if (!(innerlist = aim_readtlvchain(bigblock->value+i, bigblock->length-i))) {
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
308 faimdprintf(sess, 0, "unable to read inner tlv chain in create room response\n");
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
309 aim_freetlvchain(&tlvlist);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
310 free(ck);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
311 return 0;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
312 }
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
313
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
314 if (aim_gettlv(innerlist, 0x006a, 1))
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
315 fqcn = aim_gettlv_str(innerlist, 0x006a, 1);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
316
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
317 if (aim_gettlv(innerlist, 0x00c9, 1))
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
318 flags = aim_gettlv16(innerlist, 0x00c9, 1);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
319
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
320 if (aim_gettlv(innerlist, 0x00ca, 1))
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
321 createtime = aim_gettlv32(innerlist, 0x00ca, 1);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
322
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
323 if (aim_gettlv(innerlist, 0x00d1, 1))
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
324 maxmsglen = aim_gettlv16(innerlist, 0x00d1, 1);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
325
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
326 if (aim_gettlv(innerlist, 0x00d2, 1))
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
327 maxoccupancy = aim_gettlv16(innerlist, 0x00d2, 1);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
328
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
329 if (aim_gettlv(innerlist, 0x00d3, 1))
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
330 name = aim_gettlv_str(innerlist, 0x00d3, 1);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
331
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
332 if (aim_gettlv(innerlist, 0x00d5, 1))
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
333 createperms = aim_gettlv8(innerlist, 0x00d5, 1);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
334
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
335 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
336 ret = userfunc(sess, rx, snac2->type, fqcn, instance, exchange, flags, createtime, maxmsglen, maxoccupancy, createperms, unknown, name, ck);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
337
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
338 free(ck);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
339 free(name);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
340 free(fqcn);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
341 aim_freetlvchain(&innerlist);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
342 aim_freetlvchain(&tlvlist);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
343
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
344 return ret;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
345 }
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
346
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
347 /*
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
348 * Since multiple things can trigger this callback,
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
349 * we must lookup the snacid to determine the original
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
350 * snac subtype that was called.
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
351 */
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
352 static int parseinfo(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen)
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
353 {
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
354 struct aim_snac_t *snac2;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
355 int ret = 0;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
356
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
357 if (!(snac2 = aim_remsnac(sess, snac->id))) {
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
358 faimdprintf(sess, 0, "faim: chatnav_parse_info: received response to unknown request! (%08lx)\n", snac->id);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
359 return 0;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
360 }
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
361
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
362 if (snac2->family != 0x000d) {
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
363 faimdprintf(sess, 0, "faim: chatnav_parse_info: recieved response that maps to corrupt request! (fam=%04x)\n", snac2->family);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
364 return 0;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
365 }
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
366
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
367 /*
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
368 * We now know what the original SNAC subtype was.
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
369 */
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
370 if (snac2->type == 0x0002) /* request chat rights */
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
371 ret = parseinfo_perms(sess, mod, rx, snac, data, datalen, snac2);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
372 else if (snac2->type == 0x0003) /* request exchange info */
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
373 faimdprintf(sess, 0, "chatnav_parse_info: resposne to exchange info\n");
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
374 else if (snac2->type == 0x0004) /* request room info */
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
375 faimdprintf(sess, 0, "chatnav_parse_info: response to room info\n");
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
376 else if (snac2->type == 0x0005) /* request more room info */
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
377 faimdprintf(sess, 0, "chatnav_parse_info: response to more room info\n");
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
378 else if (snac2->type == 0x0006) /* request occupant list */
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
379 faimdprintf(sess, 0, "chatnav_parse_info: response to occupant info\n");
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
380 else if (snac2->type == 0x0007) /* search for a room */
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
381 faimdprintf(sess, 0, "chatnav_parse_info: search results\n");
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
382 else if (snac2->type == 0x0008) /* create room */
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
383 ret = parseinfo_create(sess, mod, rx, snac, data, datalen, snac2);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
384 else
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
385 faimdprintf(sess, 0, "chatnav_parse_info: unknown request subtype (%04x)\n", snac2->type);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
386
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
387 if (snac2)
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
388 free(snac2->data);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
389 free(snac2);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
390
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
391 return ret;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
392 }
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
393
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
394 static int snachandler(struct aim_session_t *sess, aim_module_t *mod, struct command_rx_struct *rx, aim_modsnac_t *snac, unsigned char *data, int datalen)
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
395 {
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
396
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
397 if (snac->subtype == 0x0009)
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
398 return parseinfo(sess, mod, rx, snac, data, datalen);
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
399
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
400 return 0;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
401 }
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
402
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
403 faim_internal int chatnav_modfirst(struct aim_session_t *sess, aim_module_t *mod)
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
404 {
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
405
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
406 mod->family = 0x000d;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
407 mod->version = 0x0000;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
408 mod->flags = 0;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
409 strncpy(mod->name, "chatnav", sizeof(mod->name));
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
410 mod->snachandler = snachandler;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
411
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
412 return 0;
3fe5799b7823 [gaim-migrate @ 1659]
Adam Fritzler <mid@auk.cx>
parents: 1535
diff changeset
413 }