Mercurial > pidgin.yaz
annotate libfaim/aim_chatnav.c @ 1256:b2f63d1a989b
[gaim-migrate @ 1266]
dont --enable-debug! hehe j/k
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Thu, 14 Dec 2000 01:54:16 +0000 |
parents | 920c86b753d7 |
children |
rev | line source |
---|---|
2 | 1 /* |
2 * | |
3 * | |
4 * | |
5 * | |
6 */ | |
7 | |
283
0f14e6d8a51b
[gaim-migrate @ 293]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
237
diff
changeset
|
8 #include <faim/aim.h> |
237 | 9 |
10 | |
11 /* | |
12 * conn must be a chatnav connection! | |
13 */ | |
840
595ac7759563
[gaim-migrate @ 850]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
771
diff
changeset
|
14 faim_export unsigned long aim_chatnav_reqrights(struct aim_session_t *sess, |
595ac7759563
[gaim-migrate @ 850]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
771
diff
changeset
|
15 struct aim_conn_t *conn) |
237 | 16 { |
1248
920c86b753d7
[gaim-migrate @ 1258]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1201
diff
changeset
|
17 aim_genericreq_n(sess, conn, 0x000d, 0x0002); |
237 | 18 |
1248
920c86b753d7
[gaim-migrate @ 1258]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1201
diff
changeset
|
19 return sess->snac_nextid; |
237 | 20 } |
21 | |
840
595ac7759563
[gaim-migrate @ 850]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
771
diff
changeset
|
22 faim_export unsigned long aim_chatnav_clientready(struct aim_session_t *sess, |
595ac7759563
[gaim-migrate @ 850]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
771
diff
changeset
|
23 struct aim_conn_t *conn) |
237 | 24 { |
25 struct command_tx_struct *newpacket; | |
26 int i; | |
27 | |
445
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
28 if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, 0x20))) |
237 | 29 return -1; |
30 | |
31 newpacket->lock = 1; | |
32 | |
33 i = aim_putsnac(newpacket->data, 0x0001, 0x0002, 0x0000, sess->snac_nextid); | |
34 | |
35 i+= aimutil_put16(newpacket->data+i, 0x000d); | |
36 i+= aimutil_put16(newpacket->data+i, 0x0001); | |
37 | |
38 i+= aimutil_put16(newpacket->data+i, 0x0004); | |
39 i+= aimutil_put16(newpacket->data+i, 0x0001); | |
40 | |
41 i+= aimutil_put16(newpacket->data+i, 0x0001); | |
42 i+= aimutil_put16(newpacket->data+i, 0x0003); | |
43 | |
44 i+= aimutil_put16(newpacket->data+i, 0x0004); | |
45 i+= aimutil_put16(newpacket->data+i, 0x0686); | |
46 | |
47 aim_tx_enqueue(sess, newpacket); | |
48 | |
49 return (sess->snac_nextid++); | |
50 } | |
51 | |
52 /* | |
53 * Since multiple things can trigger this callback, | |
54 * we must lookup the snacid to determine the original | |
55 * snac subtype that was called. | |
56 */ | |
840
595ac7759563
[gaim-migrate @ 850]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
771
diff
changeset
|
57 faim_internal int aim_chatnav_parse_info(struct aim_session_t *sess, struct command_rx_struct *command) |
237 | 58 { |
59 struct aim_snac_t *snac; | |
60 u_long snacid; | |
61 rxcallback_t userfunc; | |
715
58106806ac2b
[gaim-migrate @ 725]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
62 int ret=1; |
237 | 63 |
64 snacid = aimutil_get32(command->data+6); | |
65 snac = aim_remsnac(sess, snacid); | |
66 | |
67 if (!snac) | |
68 { | |
69 printf("faim: chatnav_parse_info: received response to unknown request! (%08lx)\n", snacid); | |
70 return 1; | |
71 } | |
72 | |
73 if (snac->family != 0x000d) | |
74 { | |
75 printf("faim: chatnav_parse_info: recieved response that maps to corrupt request! (fam=%04x)\n", snac->family); | |
76 return 1; | |
77 } | |
78 | |
79 /* | |
80 * We now know what the original SNAC subtype was. | |
81 */ | |
82 switch(snac->type) | |
83 { | |
84 case 0x0002: /* request chat rights */ | |
85 { | |
86 struct aim_tlvlist_t *tlvlist; | |
87 struct aim_chat_exchangeinfo *exchanges = NULL; | |
88 int curexchange = 0; | |
89 struct aim_tlv_t *exchangetlv; | |
90 u_char maxrooms = 0; | |
91 struct aim_tlvlist_t *innerlist; | |
92 | |
93 tlvlist = aim_readtlvchain(command->data+10, command->commandlen-10); | |
94 | |
95 /* | |
96 * Type 0x0002: Maximum concurrent rooms. | |
97 */ | |
98 if (aim_gettlv(tlvlist, 0x0002, 1)) | |
1248
920c86b753d7
[gaim-migrate @ 1258]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1201
diff
changeset
|
99 maxrooms = aim_gettlv8(tlvlist, 0x0002, 1); |
237 | 100 |
101 /* | |
102 * Type 0x0003: Exchange information | |
103 * | |
104 * There can be any number of these, each one | |
105 * representing another exchange. | |
106 * | |
107 */ | |
108 curexchange = 0; | |
109 while ((exchangetlv = aim_gettlv(tlvlist, 0x0003, curexchange+1))) | |
110 { | |
111 curexchange++; | |
112 exchanges = realloc(exchanges, curexchange * sizeof(struct aim_chat_exchangeinfo)); | |
113 | |
722
26e96119d5a5
[gaim-migrate @ 732]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
715
diff
changeset
|
114 |
237 | 115 /* exchange number */ |
116 exchanges[curexchange-1].number = aimutil_get16(exchangetlv->value); | |
117 innerlist = aim_readtlvchain(exchangetlv->value+2, exchangetlv->length-2); | |
118 | |
119 /* | |
120 * Type 0x000d: Unknown. | |
121 */ | |
122 if (aim_gettlv(innerlist, 0x000d, 1)) | |
123 ; | |
124 | |
125 /* | |
126 * Type 0x0004: Unknown | |
127 */ | |
128 if (aim_gettlv(innerlist, 0x0004, 1)) | |
129 ; | |
130 | |
771
72e556f6b99d
[gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
722
diff
changeset
|
131 /* |
72e556f6b99d
[gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
722
diff
changeset
|
132 * Type 0x0002: Unknown |
72e556f6b99d
[gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
722
diff
changeset
|
133 */ |
72e556f6b99d
[gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
722
diff
changeset
|
134 if (aim_gettlv(innerlist, 0x0002, 1)) { |
1248
920c86b753d7
[gaim-migrate @ 1258]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1201
diff
changeset
|
135 unsigned short classperms; |
771
72e556f6b99d
[gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
722
diff
changeset
|
136 |
1248
920c86b753d7
[gaim-migrate @ 1258]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1201
diff
changeset
|
137 classperms = aim_gettlv16(innerlist, 0x0002, 1); |
771
72e556f6b99d
[gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
722
diff
changeset
|
138 |
72e556f6b99d
[gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
722
diff
changeset
|
139 printf("faim: class permissions %x\n", classperms); |
72e556f6b99d
[gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
722
diff
changeset
|
140 } |
72e556f6b99d
[gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
722
diff
changeset
|
141 |
237 | 142 /* |
143 * Type 0x00c9: Unknown | |
144 */ | |
145 if (aim_gettlv(innerlist, 0x00c9, 1)) | |
146 ; | |
147 | |
148 /* | |
149 * Type 0x00ca: Creation Date | |
150 */ | |
151 if (aim_gettlv(innerlist, 0x00ca, 1)) | |
152 ; | |
153 | |
154 /* | |
771
72e556f6b99d
[gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
722
diff
changeset
|
155 * Type 0x00d0: Mandatory Channels? |
237 | 156 */ |
157 if (aim_gettlv(innerlist, 0x00d0, 1)) | |
158 ; | |
2 | 159 |
237 | 160 /* |
161 * Type 0x00d1: Maximum Message length | |
162 */ | |
163 if (aim_gettlv(innerlist, 0x00d1, 1)) | |
164 ; | |
165 | |
166 /* | |
771
72e556f6b99d
[gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
722
diff
changeset
|
167 * Type 0x00d2: Maximum Occupancy? |
237 | 168 */ |
169 if (aim_gettlv(innerlist, 0x00d2, 1)) | |
170 ; | |
171 | |
172 /* | |
173 * Type 0x00d3: Exchange Name | |
174 */ | |
175 if (aim_gettlv(innerlist, 0x00d3, 1)) | |
176 exchanges[curexchange-1].name = aim_gettlv_str(innerlist, 0x00d3, 1); | |
177 else | |
178 exchanges[curexchange-1].name = NULL; | |
179 | |
180 /* | |
771
72e556f6b99d
[gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
722
diff
changeset
|
181 * Type 0x00d5: Creation Permissions |
72e556f6b99d
[gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
722
diff
changeset
|
182 * |
72e556f6b99d
[gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
722
diff
changeset
|
183 * 0 Creation not allowed |
72e556f6b99d
[gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
722
diff
changeset
|
184 * 1 Room creation allowed |
72e556f6b99d
[gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
722
diff
changeset
|
185 * 2 Exchange creation allowed |
72e556f6b99d
[gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
722
diff
changeset
|
186 * |
237 | 187 */ |
771
72e556f6b99d
[gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
722
diff
changeset
|
188 if (aim_gettlv(innerlist, 0x00d5, 1)) { |
1248
920c86b753d7
[gaim-migrate @ 1258]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1201
diff
changeset
|
189 unsigned char createperms; |
771
72e556f6b99d
[gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
722
diff
changeset
|
190 |
1248
920c86b753d7
[gaim-migrate @ 1258]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1201
diff
changeset
|
191 createperms = aim_gettlv8(innerlist, 0x00d5, 1); |
771
72e556f6b99d
[gaim-migrate @ 781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
722
diff
changeset
|
192 } |
237 | 193 |
194 /* | |
195 * Type 0x00d6: Character Set (First Time) | |
196 */ | |
197 if (aim_gettlv(innerlist, 0x00d6, 1)) | |
198 exchanges[curexchange-1].charset1 = aim_gettlv_str(innerlist, 0x00d6, 1); | |
199 else | |
200 exchanges[curexchange-1].charset1 = NULL; | |
201 | |
202 /* | |
203 * Type 0x00d7: Language (First Time) | |
204 */ | |
205 if (aim_gettlv(innerlist, 0x00d7, 1)) | |
206 exchanges[curexchange-1].lang1 = aim_gettlv_str(innerlist, 0x00d7, 1); | |
207 else | |
208 exchanges[curexchange-1].lang1 = NULL; | |
209 | |
210 /* | |
211 * Type 0x00d8: Character Set (Second Time) | |
212 */ | |
213 if (aim_gettlv(innerlist, 0x00d8, 1)) | |
214 exchanges[curexchange-1].charset2 = aim_gettlv_str(innerlist, 0x00d8, 1); | |
215 else | |
216 exchanges[curexchange-1].charset2 = NULL; | |
217 | |
218 /* | |
219 * Type 0x00d9: Language (Second Time) | |
220 */ | |
221 if (aim_gettlv(innerlist, 0x00d9, 1)) | |
222 exchanges[curexchange-1].lang2 = aim_gettlv_str(innerlist, 0x00d9, 1); | |
223 else | |
224 exchanges[curexchange-1].lang2 = NULL; | |
715
58106806ac2b
[gaim-migrate @ 725]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
225 |
58106806ac2b
[gaim-migrate @ 725]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
226 aim_freetlvchain(&innerlist); |
237 | 227 } |
228 | |
229 /* | |
230 * Call client. | |
231 */ | |
232 userfunc = aim_callhandler(command->conn, 0x000d, 0x0009); | |
233 if (userfunc) | |
234 ret = userfunc(sess, | |
235 command, | |
236 snac->type, | |
237 maxrooms, | |
238 curexchange, | |
239 exchanges); | |
240 curexchange--; | |
722
26e96119d5a5
[gaim-migrate @ 732]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
715
diff
changeset
|
241 while(curexchange >= 0) |
237 | 242 { |
243 if (exchanges[curexchange].name) | |
244 free(exchanges[curexchange].name); | |
245 if (exchanges[curexchange].charset1) | |
246 free(exchanges[curexchange].charset1); | |
247 if (exchanges[curexchange].lang1) | |
248 free(exchanges[curexchange].lang1); | |
249 if (exchanges[curexchange].charset2) | |
250 free(exchanges[curexchange].charset2); | |
251 if (exchanges[curexchange].lang2) | |
252 free(exchanges[curexchange].lang2); | |
253 curexchange--; | |
254 } | |
255 free(exchanges); | |
256 aim_freetlvchain(&tlvlist); | |
715
58106806ac2b
[gaim-migrate @ 725]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
257 |
58106806ac2b
[gaim-migrate @ 725]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
258 break; |
237 | 259 } |
260 case 0x0003: /* request exchange info */ | |
261 printf("faim: chatnav_parse_info: resposne to exchange info\n"); | |
715
58106806ac2b
[gaim-migrate @ 725]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
262 break; |
237 | 263 case 0x0004: /* request room info */ |
264 printf("faim: chatnav_parse_info: response to room info\n"); | |
715
58106806ac2b
[gaim-migrate @ 725]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
265 break; |
237 | 266 case 0x0005: /* request more room info */ |
267 printf("faim: chatnav_parse_info: response to more room info\n"); | |
715
58106806ac2b
[gaim-migrate @ 725]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
268 break; |
237 | 269 case 0x0006: /* request occupant list */ |
270 printf("faim: chatnav_parse_info: response to occupant info\n"); | |
715
58106806ac2b
[gaim-migrate @ 725]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
271 break; |
237 | 272 case 0x0007: /* search for a room */ |
273 printf("faim: chatnav_parse_info: search results\n"); | |
715
58106806ac2b
[gaim-migrate @ 725]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
274 break; |
903
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
275 case 0x0008: { /* create room */ |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
276 /* |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
277 000d 0009 0000 0000 0010 |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
278 |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
279 0004 0053 |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
280 0004 -- exchange |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
281 0c 7a 6f6f 6f6d 7a6f 6f6f 6d34 32 cookie/name |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
282 0000 -- instance |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
283 02 -- detail level |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
284 0007 -- unknown! |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
285 006a 000c 7a 6f 6f6f 6d7a 6f6f 6f6d 3432 -- fully qualified name |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
286 00c9 0002 0011 -- flags |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
287 00ca 0004 39c0 0883 -- create time |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
288 00d1 0002 0200 -- max msg len |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
289 00d2 0002 0018 -- max occupants |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
290 00d3 000c -- name |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
291 7a6f 6f6f 6d7a 6f6f 6f6d 3432 |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
292 00d5 0001 02 -- creation permission |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
293 */ |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
294 struct aim_tlvlist_t *tlvlist, *innerlist; |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
295 char *ck = NULL, *fqcn = NULL, *name = NULL; |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
296 unsigned short exchange, instance, unknown, flags, maxmsglen, maxoccupancy; |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
297 unsigned long createtime = 0; |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
298 unsigned char createperms; |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
299 int i, cklen; |
1248
920c86b753d7
[gaim-migrate @ 1258]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1201
diff
changeset
|
300 struct aim_tlv_t *bigblock; |
903
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
301 |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
302 i = 10; |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
303 if (!(tlvlist = aim_readtlvchain(command->data+i, command->commandlen-i))) { |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
304 printf("faim: unable to read top tlv in create room response\n"); |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
305 break; |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
306 } |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
307 |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
308 if (!(bigblock = aim_gettlv(tlvlist, 0x0004, 1))) { |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
309 printf("faim: no bigblock in top tlv in create room response\n"); |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
310 aim_freetlvchain(&tlvlist); |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
311 break; |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
312 } |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
313 i = 0; |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
314 |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
315 exchange = aimutil_get16(bigblock->value+i); |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
316 i += 2; |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
317 |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
318 cklen = aimutil_get8(bigblock->value+i); |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
319 i++; |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
320 |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
321 ck = malloc(cklen+1); |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
322 memcpy(ck, bigblock->value+i, cklen); |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
323 ck[cklen] = '\0'; |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
324 i += cklen; |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
325 |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
326 instance = aimutil_get16(bigblock->value+i); |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
327 i += 2; |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
328 |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
329 if (aimutil_get8(bigblock->value+i) != 0x02) { |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
330 printf("faim: unknown detaillevel in create room response (0x%02x)\n", aimutil_get8(bigblock->value+i)); |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
331 aim_freetlvchain(&tlvlist); |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
332 free(ck); |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
333 break; |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
334 } |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
335 i += 1; |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
336 |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
337 unknown = aimutil_get16(bigblock->value+i); |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
338 i += 2; |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
339 |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
340 if (!(innerlist = aim_readtlvchain(bigblock->value+i, bigblock->length-i))) { |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
341 printf("faim: unable to read inner tlv chain in create room response\n"); |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
342 aim_freetlvchain(&tlvlist); |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
343 free(ck); |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
344 break; |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
345 } |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
346 |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
347 if (aim_gettlv(innerlist, 0x006a, 1)) |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
348 fqcn = aim_gettlv_str(innerlist, 0x006a, 1); |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
349 |
1248
920c86b753d7
[gaim-migrate @ 1258]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1201
diff
changeset
|
350 if (aim_gettlv(innerlist, 0x00c9, 1)) |
920c86b753d7
[gaim-migrate @ 1258]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1201
diff
changeset
|
351 flags = aim_gettlv16(innerlist, 0x00c9, 1); |
903
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
352 |
1248
920c86b753d7
[gaim-migrate @ 1258]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1201
diff
changeset
|
353 if (aim_gettlv(innerlist, 0x00ca, 1)) |
920c86b753d7
[gaim-migrate @ 1258]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1201
diff
changeset
|
354 createtime = aim_gettlv32(innerlist, 0x00ca, 1); |
903
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
355 |
1248
920c86b753d7
[gaim-migrate @ 1258]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1201
diff
changeset
|
356 if (aim_gettlv(innerlist, 0x00d1, 1)) |
920c86b753d7
[gaim-migrate @ 1258]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1201
diff
changeset
|
357 maxmsglen = aim_gettlv16(innerlist, 0x00d1, 1); |
903
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
358 |
1248
920c86b753d7
[gaim-migrate @ 1258]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1201
diff
changeset
|
359 if (aim_gettlv(innerlist, 0x00d2, 1)) |
920c86b753d7
[gaim-migrate @ 1258]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1201
diff
changeset
|
360 maxoccupancy = aim_gettlv16(innerlist, 0x00d2, 1); |
903
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
361 |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
362 if (aim_gettlv(innerlist, 0x00d3, 1)) |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
363 name = aim_gettlv_str(innerlist, 0x00d3, 1); |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
364 |
1248
920c86b753d7
[gaim-migrate @ 1258]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1201
diff
changeset
|
365 if (aim_gettlv(innerlist, 0x00d5, 1)) |
920c86b753d7
[gaim-migrate @ 1258]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1201
diff
changeset
|
366 createperms = aim_gettlv8(innerlist, 0x00d5, 1); |
903
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
367 |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
368 if ((userfunc = aim_callhandler(command->conn, 0x000d, 0x0009))) { |
1201
90bb83cafb9e
[gaim-migrate @ 1211]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
937
diff
changeset
|
369 ret = userfunc(sess, command, snac->type, fqcn, instance, exchange, flags, createtime, maxmsglen, maxoccupancy, createperms, unknown, name, ck); |
903
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
370 } |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
371 |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
372 if (ck) |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
373 free(ck); |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
374 if (name) |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
375 free(name); |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
376 if (fqcn) |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
377 free(fqcn); |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
378 aim_freetlvchain(&innerlist); |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
379 aim_freetlvchain(&tlvlist); |
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
380 |
715
58106806ac2b
[gaim-migrate @ 725]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
381 break; |
903
16492f41410d
[gaim-migrate @ 913]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
382 } |
237 | 383 default: /* unknown */ |
384 printf("faim: chatnav_parse_info: unknown request subtype (%04x)\n", snac->type); | |
385 } | |
386 | |
715
58106806ac2b
[gaim-migrate @ 725]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
387 if (snac && snac->data) |
58106806ac2b
[gaim-migrate @ 725]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
388 free(snac->data); |
58106806ac2b
[gaim-migrate @ 725]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
389 if (snac) |
58106806ac2b
[gaim-migrate @ 725]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
390 free(snac); |
58106806ac2b
[gaim-migrate @ 725]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
391 |
58106806ac2b
[gaim-migrate @ 725]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
392 return ret; |
237 | 393 } |
394 | |
840
595ac7759563
[gaim-migrate @ 850]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
771
diff
changeset
|
395 faim_export unsigned long aim_chatnav_createroom(struct aim_session_t *sess, |
595ac7759563
[gaim-migrate @ 850]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
771
diff
changeset
|
396 struct aim_conn_t *conn, |
595ac7759563
[gaim-migrate @ 850]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
771
diff
changeset
|
397 char *name, |
595ac7759563
[gaim-migrate @ 850]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
771
diff
changeset
|
398 u_short exchange) |
237 | 399 { |
400 struct command_tx_struct *newpacket; | |
401 int i; | |
402 | |
445
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
403 if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, 10+12+strlen("invite")+strlen(name)))) |
237 | 404 return -1; |
405 | |
406 newpacket->lock = 1; | |
407 | |
408 i = aim_putsnac(newpacket->data, 0x000d, 0x0008, 0x0000, sess->snac_nextid); | |
409 | |
410 /* exchange */ | |
411 i+= aimutil_put16(newpacket->data+i, exchange); | |
412 | |
413 /* room cookie */ | |
414 i+= aimutil_put8(newpacket->data+i, strlen("invite")); | |
415 i+= aimutil_putstr(newpacket->data+i, "invite", strlen("invite")); | |
416 | |
417 /* instance */ | |
418 i+= aimutil_put16(newpacket->data+i, 0xffff); | |
419 | |
420 /* detail level */ | |
421 i+= aimutil_put8(newpacket->data+i, 0x01); | |
422 | |
423 /* tlvcount */ | |
424 i+= aimutil_put16(newpacket->data+i, 0x0001); | |
425 | |
426 /* room name */ | |
427 i+= aim_puttlv_str(newpacket->data+i, 0x00d3, strlen(name), name); | |
428 | |
1248
920c86b753d7
[gaim-migrate @ 1258]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1201
diff
changeset
|
429 aim_cachesnac(sess, 0x000d, 0x0008, 0x0000, NULL, 0); |
237 | 430 |
431 aim_tx_enqueue(sess, newpacket); | |
432 | |
1248
920c86b753d7
[gaim-migrate @ 1258]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1201
diff
changeset
|
433 return sess->snac_nextid; |
237 | 434 } |