Mercurial > pidgin.yaz
comparison src/protocols/oscar/chatnav.c @ 2821:9467e4ee81be
[gaim-migrate @ 2834]
new libfaim stuff.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Sat, 01 Dec 2001 00:56:31 +0000 |
parents | c41030cfed76 |
children | 10a2d4d5bcf2 |
comparison
equal
deleted
inserted
replaced
2820:b917845dad3c | 2821:9467e4ee81be |
---|---|
18 return aim_genericreq_n_snacid(sess, conn, 0x000d, 0x0002); | 18 return aim_genericreq_n_snacid(sess, conn, 0x000d, 0x0002); |
19 } | 19 } |
20 | 20 |
21 faim_export int aim_chatnav_createroom(aim_session_t *sess, aim_conn_t *conn, const char *name, fu16_t exchange) | 21 faim_export int aim_chatnav_createroom(aim_session_t *sess, aim_conn_t *conn, const char *name, fu16_t exchange) |
22 { | 22 { |
23 static const char ck[] = {"create"}; | |
24 static const char lang[] = {"en"}; | |
25 static const char charset[] = {"us-ascii"}; | |
23 aim_frame_t *fr; | 26 aim_frame_t *fr; |
24 aim_snacid_t snacid; | 27 aim_snacid_t snacid; |
25 aim_tlvlist_t *tl = NULL; | 28 aim_tlvlist_t *tl = NULL; |
26 | 29 |
27 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+12+strlen("invite")+strlen(name)))) | 30 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 1152))) |
28 return -ENOMEM; | 31 return -ENOMEM; |
29 | 32 |
30 snacid = aim_cachesnac(sess, 0x000d, 0x0008, 0x0000, NULL, 0); | 33 snacid = aim_cachesnac(sess, 0x000d, 0x0008, 0x0000, NULL, 0); |
31 aim_putsnac(&fr->data, 0x000d, 0x0008, 0x0000, snacid); | 34 aim_putsnac(&fr->data, 0x000d, 0x0008, 0x0000, snacid); |
32 | 35 |
33 /* exchange */ | 36 /* exchange */ |
34 aimbs_put16(&fr->data, exchange); | 37 aimbs_put16(&fr->data, exchange); |
35 | 38 |
36 /* room cookie */ | 39 /* action cookie */ |
37 aimbs_put8(&fr->data, strlen("invite")); | 40 aimbs_put8(&fr->data, strlen(ck)); |
38 aimbs_putraw(&fr->data, "invite", strlen("invite")); | 41 aimbs_putraw(&fr->data, ck, strlen(ck)); |
39 | 42 |
40 /* | 43 /* |
41 * instance | 44 * instance |
42 * | 45 * |
43 * Setting this to 0xffff apparently assigns the last instance. | 46 * Setting this to 0xffff apparently assigns the last instance. |
46 aimbs_put16(&fr->data, 0xffff); | 49 aimbs_put16(&fr->data, 0xffff); |
47 | 50 |
48 /* detail level */ | 51 /* detail level */ |
49 aimbs_put8(&fr->data, 0x01); | 52 aimbs_put8(&fr->data, 0x01); |
50 | 53 |
51 /* room name */ | |
52 aim_addtlvtochain_raw(&tl, 0x00d3, strlen(name), name); | 54 aim_addtlvtochain_raw(&tl, 0x00d3, strlen(name), name); |
55 aim_addtlvtochain_raw(&tl, 0x00d6, strlen(charset), charset); | |
56 aim_addtlvtochain_raw(&tl, 0x00d7, strlen(lang), lang); | |
53 | 57 |
54 /* tlvcount */ | 58 /* tlvcount */ |
55 aimbs_put16(&fr->data, aim_counttlvchain(&tl)); | 59 aimbs_put16(&fr->data, aim_counttlvchain(&tl)); |
56 aim_writetlvchain(&fr->data, &tl); | 60 aim_writetlvchain(&fr->data, &tl); |
57 | 61 |
91 aim_bstream_t tbs; | 95 aim_bstream_t tbs; |
92 | 96 |
93 aim_bstream_init(&tbs, exchangetlv->value, exchangetlv->length); | 97 aim_bstream_init(&tbs, exchangetlv->value, exchangetlv->length); |
94 | 98 |
95 curexchange++; | 99 curexchange++; |
96 | 100 |
97 exchanges = realloc(exchanges, curexchange * sizeof(struct aim_chat_exchangeinfo)); | 101 exchanges = realloc(exchanges, curexchange * sizeof(struct aim_chat_exchangeinfo)); |
98 | 102 |
99 /* exchange number */ | 103 /* exchange number */ |
100 exchanges[curexchange-1].number = aimbs_get16(&tbs); | 104 exchanges[curexchange-1].number = aimbs_get16(&tbs); |
101 innerlist = aim_readtlvchain(&tbs); | 105 innerlist = aim_readtlvchain(&tbs); |
106 | |
107 /* | |
108 * Type 0x000a: Unknown. | |
109 * | |
110 * Usually three bytes: 0x0114 (exchange 1) or 0x010f (others). | |
111 * | |
112 */ | |
113 if (aim_gettlv(innerlist, 0x000a, 1)) | |
114 ; | |
102 | 115 |
103 /* | 116 /* |
104 * Type 0x000d: Unknown. | 117 * Type 0x000d: Unknown. |
105 */ | 118 */ |
106 if (aim_gettlv(innerlist, 0x000d, 1)) | 119 if (aim_gettlv(innerlist, 0x000d, 1)) |
122 | 135 |
123 faimdprintf(sess, 1, "faim: class permissions %x\n", classperms); | 136 faimdprintf(sess, 1, "faim: class permissions %x\n", classperms); |
124 } | 137 } |
125 | 138 |
126 /* | 139 /* |
127 * Type 0x00c9: Unknown | 140 * Type 0x00c9: Flags |
141 * | |
142 * 1 Evilable | |
143 * 2 Nav Only | |
144 * 4 Instancing Allowed | |
145 * 8 Occupant Peek Allowed | |
146 * | |
128 */ | 147 */ |
129 if (aim_gettlv(innerlist, 0x00c9, 1)) | 148 if (aim_gettlv(innerlist, 0x00c9, 1)) |
130 ; | 149 exchanges[curexchange-1].flags = aim_gettlv16(innerlist, 0x00c9, 1); |
131 | 150 |
132 /* | 151 /* |
133 * Type 0x00ca: Creation Date | 152 * Type 0x00ca: Creation Date |
134 */ | 153 */ |
135 if (aim_gettlv(innerlist, 0x00ca, 1)) | 154 if (aim_gettlv(innerlist, 0x00ca, 1)) |
152 */ | 171 */ |
153 if (aim_gettlv(innerlist, 0x00d2, 1)) | 172 if (aim_gettlv(innerlist, 0x00d2, 1)) |
154 ; | 173 ; |
155 | 174 |
156 /* | 175 /* |
157 * Type 0x00d3: Exchange Name | 176 * Type 0x00d3: Exchange Description |
158 */ | 177 */ |
159 if (aim_gettlv(innerlist, 0x00d3, 1)) | 178 if (aim_gettlv(innerlist, 0x00d3, 1)) |
160 exchanges[curexchange-1].name = aim_gettlv_str(innerlist, 0x00d3, 1); | 179 exchanges[curexchange-1].name = aim_gettlv_str(innerlist, 0x00d3, 1); |
161 else | 180 else |
162 exchanges[curexchange-1].name = NULL; | 181 exchanges[curexchange-1].name = NULL; |
182 | |
183 /* | |
184 * Type 0x00d4: Exchange Description URL | |
185 */ | |
186 if (aim_gettlv(innerlist, 0x00d4, 1)) | |
187 ; | |
163 | 188 |
164 /* | 189 /* |
165 * Type 0x00d5: Creation Permissions | 190 * Type 0x00d5: Creation Permissions |
166 * | 191 * |
167 * 0 Creation not allowed | 192 * 0 Creation not allowed |
205 if (aim_gettlv(innerlist, 0x00d9, 1)) | 230 if (aim_gettlv(innerlist, 0x00d9, 1)) |
206 exchanges[curexchange-1].lang2 = aim_gettlv_str(innerlist, 0x00d9, 1); | 231 exchanges[curexchange-1].lang2 = aim_gettlv_str(innerlist, 0x00d9, 1); |
207 else | 232 else |
208 exchanges[curexchange-1].lang2 = NULL; | 233 exchanges[curexchange-1].lang2 = NULL; |
209 | 234 |
235 /* | |
236 * Type 0x00da: Unknown | |
237 */ | |
238 if (aim_gettlv(innerlist, 0x00da, 1)) | |
239 ; | |
240 | |
210 aim_freetlvchain(&innerlist); | 241 aim_freetlvchain(&innerlist); |
211 } | 242 } |
212 | 243 |
213 /* | 244 /* |
214 * Call client. | 245 * Call client. |
304 } | 335 } |
305 | 336 |
306 /* | 337 /* |
307 * Since multiple things can trigger this callback, we must lookup the | 338 * Since multiple things can trigger this callback, we must lookup the |
308 * snacid to determine the original snac subtype that was called. | 339 * snacid to determine the original snac subtype that was called. |
340 * | |
341 * XXX This isn't really how this works. But this is: Every d/9 response | |
342 * has a 16bit value at the beginning. That matches to: | |
343 * Short Desc = 1 | |
344 * Full Desc = 2 | |
345 * Instance Info = 4 | |
346 * Nav Short Desc = 8 | |
347 * Nav Instance Info = 16 | |
348 * And then everything is really asynchronous. There is no specific | |
349 * attachment of a response to a create room request, for example. Creating | |
350 * the room yields no different a response than requesting the room's info. | |
351 * | |
309 */ | 352 */ |
310 static int parseinfo(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) | 353 static int parseinfo(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) |
311 { | 354 { |
312 aim_snac_t *snac2; | 355 aim_snac_t *snac2; |
313 int ret = 0; | 356 int ret = 0; |
361 faim_internal int chatnav_modfirst(aim_session_t *sess, aim_module_t *mod) | 404 faim_internal int chatnav_modfirst(aim_session_t *sess, aim_module_t *mod) |
362 { | 405 { |
363 | 406 |
364 mod->family = 0x000d; | 407 mod->family = 0x000d; |
365 mod->version = 0x0001; | 408 mod->version = 0x0001; |
366 mod->toolid = 0x0004; /* XXX this doesn't look right */ | 409 mod->toolid = 0x0010; |
367 mod->toolversion = 0x0001; /* XXX nor does this */ | 410 mod->toolversion = 0x047c; |
368 mod->flags = 0; | 411 mod->flags = 0; |
369 strncpy(mod->name, "chatnav", sizeof(mod->name)); | 412 strncpy(mod->name, "chatnav", sizeof(mod->name)); |
370 mod->snachandler = snachandler; | 413 mod->snachandler = snachandler; |
371 | 414 |
372 return 0; | 415 return 0; |