comparison src/protocols/oscar/chatnav.c @ 7167:6d3d8f11e765

[gaim-migrate @ 7734] I, uh, renamed some functions in libfaim. Functions that every file uses. A lot. So it looks like I did a lot of work, but I didn't. Yeah, in a typical work I actually only do about 15 minutes of real work. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 05 Oct 2003 23:50:40 +0000
parents 2532f1192da3
children 92cbf9713795
comparison
equal deleted inserted replaced
7166:e6b01bd8d6cd 7167:6d3d8f11e765
65 aimbs_put16(&fr->data, 0xffff); 65 aimbs_put16(&fr->data, 0xffff);
66 66
67 /* detail level */ 67 /* detail level */
68 aimbs_put8(&fr->data, 0x01); 68 aimbs_put8(&fr->data, 0x01);
69 69
70 aim_addtlvtochain_raw(&tl, 0x00d3, strlen(name), name); 70 aim_tlvlist_add_raw(&tl, 0x00d3, strlen(name), name);
71 aim_addtlvtochain_raw(&tl, 0x00d6, strlen(charset), charset); 71 aim_tlvlist_add_raw(&tl, 0x00d6, strlen(charset), charset);
72 aim_addtlvtochain_raw(&tl, 0x00d7, strlen(lang), lang); 72 aim_tlvlist_add_raw(&tl, 0x00d7, strlen(lang), lang);
73 73
74 /* tlvcount */ 74 /* tlvcount */
75 aimbs_put16(&fr->data, aim_counttlvchain(&tl)); 75 aimbs_put16(&fr->data, aim_tlvlist_count(&tl));
76 aim_writetlvchain(&fr->data, &tl); 76 aim_tlvlist_write(&fr->data, &tl);
77 77
78 aim_freetlvchain(&tl); 78 aim_tlvlist_free(&tl);
79 79
80 aim_tx_enqueue(sess, fr); 80 aim_tx_enqueue(sess, fr);
81 81
82 return 0; 82 return 0;
83 } 83 }
90 int curexchange; 90 int curexchange;
91 aim_tlv_t *exchangetlv; 91 aim_tlv_t *exchangetlv;
92 fu8_t maxrooms = 0; 92 fu8_t maxrooms = 0;
93 aim_tlvlist_t *tlvlist, *innerlist; 93 aim_tlvlist_t *tlvlist, *innerlist;
94 94
95 tlvlist = aim_readtlvchain(bs); 95 tlvlist = aim_tlvlist_read(bs);
96 96
97 /* 97 /*
98 * Type 0x0002: Maximum concurrent rooms. 98 * Type 0x0002: Maximum concurrent rooms.
99 */ 99 */
100 if (aim_gettlv(tlvlist, 0x0002, 1)) 100 if (aim_tlv_gettlv(tlvlist, 0x0002, 1))
101 maxrooms = aim_gettlv8(tlvlist, 0x0002, 1); 101 maxrooms = aim_tlv_get8(tlvlist, 0x0002, 1);
102 102
103 /* 103 /*
104 * Type 0x0003: Exchange information 104 * Type 0x0003: Exchange information
105 * 105 *
106 * There can be any number of these, each one 106 * There can be any number of these, each one
107 * representing another exchange. 107 * representing another exchange.
108 * 108 *
109 */ 109 */
110 for (curexchange = 0; ((exchangetlv = aim_gettlv(tlvlist, 0x0003, curexchange+1))); ) { 110 for (curexchange = 0; ((exchangetlv = aim_tlv_gettlv(tlvlist, 0x0003, curexchange+1))); ) {
111 aim_bstream_t tbs; 111 aim_bstream_t tbs;
112 112
113 aim_bstream_init(&tbs, exchangetlv->value, exchangetlv->length); 113 aim_bstream_init(&tbs, exchangetlv->value, exchangetlv->length);
114 114
115 curexchange++; 115 curexchange++;
116 116
117 exchanges = realloc(exchanges, curexchange * sizeof(struct aim_chat_exchangeinfo)); 117 exchanges = realloc(exchanges, curexchange * sizeof(struct aim_chat_exchangeinfo));
118 118
119 /* exchange number */ 119 /* exchange number */
120 exchanges[curexchange-1].number = aimbs_get16(&tbs); 120 exchanges[curexchange-1].number = aimbs_get16(&tbs);
121 innerlist = aim_readtlvchain(&tbs); 121 innerlist = aim_tlvlist_read(&tbs);
122 122
123 /* 123 /*
124 * Type 0x000a: Unknown. 124 * Type 0x000a: Unknown.
125 * 125 *
126 * Usually three bytes: 0x0114 (exchange 1) or 0x010f (others). 126 * Usually three bytes: 0x0114 (exchange 1) or 0x010f (others).
127 * 127 *
128 */ 128 */
129 if (aim_gettlv(innerlist, 0x000a, 1)) 129 if (aim_tlv_gettlv(innerlist, 0x000a, 1))
130 ; 130 ;
131 131
132 /* 132 /*
133 * Type 0x000d: Unknown. 133 * Type 0x000d: Unknown.
134 */ 134 */
135 if (aim_gettlv(innerlist, 0x000d, 1)) 135 if (aim_tlv_gettlv(innerlist, 0x000d, 1))
136 ; 136 ;
137 137
138 /* 138 /*
139 * Type 0x0004: Unknown 139 * Type 0x0004: Unknown
140 */ 140 */
141 if (aim_gettlv(innerlist, 0x0004, 1)) 141 if (aim_tlv_gettlv(innerlist, 0x0004, 1))
142 ; 142 ;
143 143
144 /* 144 /*
145 * Type 0x0002: Unknown 145 * Type 0x0002: Unknown
146 */ 146 */
147 if (aim_gettlv(innerlist, 0x0002, 1)) { 147 if (aim_tlv_gettlv(innerlist, 0x0002, 1)) {
148 fu16_t classperms; 148 fu16_t classperms;
149 149
150 classperms = aim_gettlv16(innerlist, 0x0002, 1); 150 classperms = aim_tlv_get16(innerlist, 0x0002, 1);
151 151
152 faimdprintf(sess, 1, "faim: class permissions %x\n", classperms); 152 faimdprintf(sess, 1, "faim: class permissions %x\n", classperms);
153 } 153 }
154 154
155 /* 155 /*
159 * 2 Nav Only 159 * 2 Nav Only
160 * 4 Instancing Allowed 160 * 4 Instancing Allowed
161 * 8 Occupant Peek Allowed 161 * 8 Occupant Peek Allowed
162 * 162 *
163 */ 163 */
164 if (aim_gettlv(innerlist, 0x00c9, 1)) 164 if (aim_tlv_gettlv(innerlist, 0x00c9, 1))
165 exchanges[curexchange-1].flags = aim_gettlv16(innerlist, 0x00c9, 1); 165 exchanges[curexchange-1].flags = aim_tlv_get16(innerlist, 0x00c9, 1);
166 166
167 /* 167 /*
168 * Type 0x00ca: Creation Date 168 * Type 0x00ca: Creation Date
169 */ 169 */
170 if (aim_gettlv(innerlist, 0x00ca, 1)) 170 if (aim_tlv_gettlv(innerlist, 0x00ca, 1))
171 ; 171 ;
172 172
173 /* 173 /*
174 * Type 0x00d0: Mandatory Channels? 174 * Type 0x00d0: Mandatory Channels?
175 */ 175 */
176 if (aim_gettlv(innerlist, 0x00d0, 1)) 176 if (aim_tlv_gettlv(innerlist, 0x00d0, 1))
177 ; 177 ;
178 178
179 /* 179 /*
180 * Type 0x00d1: Maximum Message length 180 * Type 0x00d1: Maximum Message length
181 */ 181 */
182 if (aim_gettlv(innerlist, 0x00d1, 1)) 182 if (aim_tlv_gettlv(innerlist, 0x00d1, 1))
183 ; 183 ;
184 184
185 /* 185 /*
186 * Type 0x00d2: Maximum Occupancy? 186 * Type 0x00d2: Maximum Occupancy?
187 */ 187 */
188 if (aim_gettlv(innerlist, 0x00d2, 1)) 188 if (aim_tlv_gettlv(innerlist, 0x00d2, 1))
189 ; 189 ;
190 190
191 /* 191 /*
192 * Type 0x00d3: Exchange Description 192 * Type 0x00d3: Exchange Description
193 */ 193 */
194 if (aim_gettlv(innerlist, 0x00d3, 1)) 194 if (aim_tlv_gettlv(innerlist, 0x00d3, 1))
195 exchanges[curexchange-1].name = aim_gettlv_str(innerlist, 0x00d3, 1); 195 exchanges[curexchange-1].name = aim_tlv_getstr(innerlist, 0x00d3, 1);
196 else 196 else
197 exchanges[curexchange-1].name = NULL; 197 exchanges[curexchange-1].name = NULL;
198 198
199 /* 199 /*
200 * Type 0x00d4: Exchange Description URL 200 * Type 0x00d4: Exchange Description URL
201 */ 201 */
202 if (aim_gettlv(innerlist, 0x00d4, 1)) 202 if (aim_tlv_gettlv(innerlist, 0x00d4, 1))
203 ; 203 ;
204 204
205 /* 205 /*
206 * Type 0x00d5: Creation Permissions 206 * Type 0x00d5: Creation Permissions
207 * 207 *
208 * 0 Creation not allowed 208 * 0 Creation not allowed
209 * 1 Room creation allowed 209 * 1 Room creation allowed
210 * 2 Exchange creation allowed 210 * 2 Exchange creation allowed
211 * 211 *
212 */ 212 */
213 if (aim_gettlv(innerlist, 0x00d5, 1)) { 213 if (aim_tlv_gettlv(innerlist, 0x00d5, 1)) {
214 fu8_t createperms; 214 fu8_t createperms;
215 215
216 createperms = aim_gettlv8(innerlist, 0x00d5, 1); 216 createperms = aim_tlv_get8(innerlist, 0x00d5, 1);
217 } 217 }
218 218
219 /* 219 /*
220 * Type 0x00d6: Character Set (First Time) 220 * Type 0x00d6: Character Set (First Time)
221 */ 221 */
222 if (aim_gettlv(innerlist, 0x00d6, 1)) 222 if (aim_tlv_gettlv(innerlist, 0x00d6, 1))
223 exchanges[curexchange-1].charset1 = aim_gettlv_str(innerlist, 0x00d6, 1); 223 exchanges[curexchange-1].charset1 = aim_tlv_getstr(innerlist, 0x00d6, 1);
224 else 224 else
225 exchanges[curexchange-1].charset1 = NULL; 225 exchanges[curexchange-1].charset1 = NULL;
226 226
227 /* 227 /*
228 * Type 0x00d7: Language (First Time) 228 * Type 0x00d7: Language (First Time)
229 */ 229 */
230 if (aim_gettlv(innerlist, 0x00d7, 1)) 230 if (aim_tlv_gettlv(innerlist, 0x00d7, 1))
231 exchanges[curexchange-1].lang1 = aim_gettlv_str(innerlist, 0x00d7, 1); 231 exchanges[curexchange-1].lang1 = aim_tlv_getstr(innerlist, 0x00d7, 1);
232 else 232 else
233 exchanges[curexchange-1].lang1 = NULL; 233 exchanges[curexchange-1].lang1 = NULL;
234 234
235 /* 235 /*
236 * Type 0x00d8: Character Set (Second Time) 236 * Type 0x00d8: Character Set (Second Time)
237 */ 237 */
238 if (aim_gettlv(innerlist, 0x00d8, 1)) 238 if (aim_tlv_gettlv(innerlist, 0x00d8, 1))
239 exchanges[curexchange-1].charset2 = aim_gettlv_str(innerlist, 0x00d8, 1); 239 exchanges[curexchange-1].charset2 = aim_tlv_getstr(innerlist, 0x00d8, 1);
240 else 240 else
241 exchanges[curexchange-1].charset2 = NULL; 241 exchanges[curexchange-1].charset2 = NULL;
242 242
243 /* 243 /*
244 * Type 0x00d9: Language (Second Time) 244 * Type 0x00d9: Language (Second Time)
245 */ 245 */
246 if (aim_gettlv(innerlist, 0x00d9, 1)) 246 if (aim_tlv_gettlv(innerlist, 0x00d9, 1))
247 exchanges[curexchange-1].lang2 = aim_gettlv_str(innerlist, 0x00d9, 1); 247 exchanges[curexchange-1].lang2 = aim_tlv_getstr(innerlist, 0x00d9, 1);
248 else 248 else
249 exchanges[curexchange-1].lang2 = NULL; 249 exchanges[curexchange-1].lang2 = NULL;
250 250
251 /* 251 /*
252 * Type 0x00da: Unknown 252 * Type 0x00da: Unknown
253 */ 253 */
254 if (aim_gettlv(innerlist, 0x00da, 1)) 254 if (aim_tlv_gettlv(innerlist, 0x00da, 1))
255 ; 255 ;
256 256
257 aim_freetlvchain(&innerlist); 257 aim_tlvlist_free(&innerlist);
258 } 258 }
259 259
260 /* 260 /*
261 * Call client. 261 * Call client.
262 */ 262 */
269 free(exchanges[curexchange].lang1); 269 free(exchanges[curexchange].lang1);
270 free(exchanges[curexchange].charset2); 270 free(exchanges[curexchange].charset2);
271 free(exchanges[curexchange].lang2); 271 free(exchanges[curexchange].lang2);
272 } 272 }
273 free(exchanges); 273 free(exchanges);
274 aim_freetlvchain(&tlvlist); 274 aim_tlvlist_free(&tlvlist);
275 275
276 return ret; 276 return ret;
277 } 277 }
278 278
279 static int parseinfo_create(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs, aim_snac_t *snac2) 279 static int parseinfo_create(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs, aim_snac_t *snac2)
287 int cklen; 287 int cklen;
288 aim_tlv_t *bigblock; 288 aim_tlv_t *bigblock;
289 int ret = 0; 289 int ret = 0;
290 aim_bstream_t bbbs; 290 aim_bstream_t bbbs;
291 291
292 tlvlist = aim_readtlvchain(bs); 292 tlvlist = aim_tlvlist_read(bs);
293 293
294 if (!(bigblock = aim_gettlv(tlvlist, 0x0004, 1))) { 294 if (!(bigblock = aim_tlv_gettlv(tlvlist, 0x0004, 1))) {
295 faimdprintf(sess, 0, "no bigblock in top tlv in create room response\n"); 295 faimdprintf(sess, 0, "no bigblock in top tlv in create room response\n");
296 aim_freetlvchain(&tlvlist); 296 aim_tlvlist_free(&tlvlist);
297 return 0; 297 return 0;
298 } 298 }
299 299
300 aim_bstream_init(&bbbs, bigblock->value, bigblock->length); 300 aim_bstream_init(&bbbs, bigblock->value, bigblock->length);
301 301
305 instance = aimbs_get16(&bbbs); 305 instance = aimbs_get16(&bbbs);
306 detaillevel = aimbs_get8(&bbbs); 306 detaillevel = aimbs_get8(&bbbs);
307 307
308 if (detaillevel != 0x02) { 308 if (detaillevel != 0x02) {
309 faimdprintf(sess, 0, "unknown detaillevel in create room response (0x%02x)\n", detaillevel); 309 faimdprintf(sess, 0, "unknown detaillevel in create room response (0x%02x)\n", detaillevel);
310 aim_freetlvchain(&tlvlist); 310 aim_tlvlist_free(&tlvlist);
311 free(ck); 311 free(ck);
312 return 0; 312 return 0;
313 } 313 }
314 314
315 unknown = aimbs_get16(&bbbs); 315 unknown = aimbs_get16(&bbbs);
316 316
317 innerlist = aim_readtlvchain(&bbbs); 317 innerlist = aim_tlvlist_read(&bbbs);
318 318
319 if (aim_gettlv(innerlist, 0x006a, 1)) 319 if (aim_tlv_gettlv(innerlist, 0x006a, 1))
320 fqcn = aim_gettlv_str(innerlist, 0x006a, 1); 320 fqcn = aim_tlv_getstr(innerlist, 0x006a, 1);
321 321
322 if (aim_gettlv(innerlist, 0x00c9, 1)) 322 if (aim_tlv_gettlv(innerlist, 0x00c9, 1))
323 flags = aim_gettlv16(innerlist, 0x00c9, 1); 323 flags = aim_tlv_get16(innerlist, 0x00c9, 1);
324 324
325 if (aim_gettlv(innerlist, 0x00ca, 1)) 325 if (aim_tlv_gettlv(innerlist, 0x00ca, 1))
326 createtime = aim_gettlv32(innerlist, 0x00ca, 1); 326 createtime = aim_tlv_get32(innerlist, 0x00ca, 1);
327 327
328 if (aim_gettlv(innerlist, 0x00d1, 1)) 328 if (aim_tlv_gettlv(innerlist, 0x00d1, 1))
329 maxmsglen = aim_gettlv16(innerlist, 0x00d1, 1); 329 maxmsglen = aim_tlv_get16(innerlist, 0x00d1, 1);
330 330
331 if (aim_gettlv(innerlist, 0x00d2, 1)) 331 if (aim_tlv_gettlv(innerlist, 0x00d2, 1))
332 maxoccupancy = aim_gettlv16(innerlist, 0x00d2, 1); 332 maxoccupancy = aim_tlv_get16(innerlist, 0x00d2, 1);
333 333
334 if (aim_gettlv(innerlist, 0x00d3, 1)) 334 if (aim_tlv_gettlv(innerlist, 0x00d3, 1))
335 name = aim_gettlv_str(innerlist, 0x00d3, 1); 335 name = aim_tlv_getstr(innerlist, 0x00d3, 1);
336 336
337 if (aim_gettlv(innerlist, 0x00d5, 1)) 337 if (aim_tlv_gettlv(innerlist, 0x00d5, 1))
338 createperms = aim_gettlv8(innerlist, 0x00d5, 1); 338 createperms = aim_tlv_get8(innerlist, 0x00d5, 1);
339 339
340 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) { 340 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
341 ret = userfunc(sess, rx, snac2->type, fqcn, instance, exchange, flags, createtime, maxmsglen, maxoccupancy, createperms, unknown, name, ck); 341 ret = userfunc(sess, rx, snac2->type, fqcn, instance, exchange, flags, createtime, maxmsglen, maxoccupancy, createperms, unknown, name, ck);
342 } 342 }
343 343
344 free(ck); 344 free(ck);
345 free(name); 345 free(name);
346 free(fqcn); 346 free(fqcn);
347 aim_freetlvchain(&innerlist); 347 aim_tlvlist_free(&innerlist);
348 aim_freetlvchain(&tlvlist); 348 aim_tlvlist_free(&tlvlist);
349 349
350 return ret; 350 return ret;
351 } 351 }
352 352
353 /* 353 /*