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