Mercurial > pidgin.yaz
annotate src/protocols/oscar/chatnav.c @ 13047:473d3a454615
[gaim-migrate @ 15408]
15:52:32 <NSA_> In the system tray, the "Custom Status..." should be changed to
"New Status..." to be more consistent.
committer: Tailor Script <tailor@pidgin.im>
author | Etan Reisner <pidgin@unreliablesource.net> |
---|---|
date | Thu, 26 Jan 2006 20:54:00 +0000 |
parents | 59207955adc2 |
children |
rev | line source |
---|---|
2086 | 1 /* |
3952 | 2 * Family 0x000d - Handle ChatNav. |
2086 | 3 * |
3952 | 4 * The ChatNav(igation) service does various things to keep chat |
5 * alive. It provides room information, room searching and creating, | |
6 * as well as giving users the right ("permission") to use chat. | |
2086 | 7 * |
8 */ | |
9 | |
10 #define FAIM_INTERNAL | |
11 #include <aim.h> | |
12 | |
13 /* | |
3952 | 14 * Subtype 0x0002 |
15 * | |
2086 | 16 * conn must be a chatnav connection! |
3952 | 17 * |
2086 | 18 */ |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
19 faim_export int aim_chatnav_reqrights(aim_session_t *sess, aim_conn_t *conn) |
2086 | 20 { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
21 return aim_genericreq_n_snacid(sess, conn, 0x000d, 0x0002); |
2086 | 22 } |
23 | |
3952 | 24 /* |
25 * Subtype 0x0008 | |
26 */ | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
27 faim_export int aim_chatnav_createroom(aim_session_t *sess, aim_conn_t *conn, const char *name, fu16_t exchange) |
2086 | 28 { |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
29 static const char ck[] = {"create"}; |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
30 static const char lang[] = {"en"}; |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
31 static const char charset[] = {"us-ascii"}; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
32 aim_frame_t *fr; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
33 aim_snacid_t snacid; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
34 aim_tlvlist_t *tl = NULL; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
35 |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
36 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 1152))) |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
37 return -ENOMEM; |
2086 | 38 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
39 snacid = aim_cachesnac(sess, 0x000d, 0x0008, 0x0000, NULL, 0); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
40 aim_putsnac(&fr->data, 0x000d, 0x0008, 0x0000, snacid); |
2086 | 41 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
42 /* exchange */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
43 aimbs_put16(&fr->data, exchange); |
2086 | 44 |
2931 | 45 /* |
46 * This looks to be a big hack. You'll note that this entire | |
47 * SNAC is just a room info structure, but the hard room name, | |
48 * here, is set to "create". | |
49 * | |
50 * Either this goes on the "list of questions concerning | |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
7167
diff
changeset
|
51 * why-the-hell-did-you-do-that", or this value is completely |
2931 | 52 * ignored. Without experimental evidence, but a good knowledge of |
53 * AOL style, I'm going to guess that it is the latter, and that | |
54 * the value of the room name in create requests is ignored. | |
55 */ | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
56 aimbs_put8(&fr->data, strlen(ck)); |
10995 | 57 aimbs_putstr(&fr->data, ck); |
2086 | 58 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
59 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
60 * instance |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
61 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
62 * Setting this to 0xffff apparently assigns the last instance. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
63 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
64 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
65 aimbs_put16(&fr->data, 0xffff); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
66 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
67 /* detail level */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
68 aimbs_put8(&fr->data, 0x01); |
2086 | 69 |
10991 | 70 aim_tlvlist_add_str(&tl, 0x00d3, name); |
71 aim_tlvlist_add_str(&tl, 0x00d6, charset); | |
72 aim_tlvlist_add_str(&tl, 0x00d7, lang); | |
2086 | 73 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
74 /* tlvcount */ |
7167 | 75 aimbs_put16(&fr->data, aim_tlvlist_count(&tl)); |
76 aim_tlvlist_write(&fr->data, &tl); | |
2086 | 77 |
7167 | 78 aim_tlvlist_free(&tl); |
2086 | 79 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
80 aim_tx_enqueue(sess, fr); |
2086 | 81 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
82 return 0; |
2086 | 83 } |
84 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
85 static int parseinfo_perms(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs, aim_snac_t *snac2) |
2086 | 86 { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
87 aim_rxcallback_t userfunc; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
88 int ret = 0; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
89 struct aim_chat_exchangeinfo *exchanges = NULL; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
90 int curexchange; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
91 aim_tlv_t *exchangetlv; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
92 fu8_t maxrooms = 0; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
93 aim_tlvlist_t *tlvlist, *innerlist; |
2086 | 94 |
7167 | 95 tlvlist = aim_tlvlist_read(bs); |
2086 | 96 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
97 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
98 * Type 0x0002: Maximum concurrent rooms. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
99 */ |
7167 | 100 if (aim_tlv_gettlv(tlvlist, 0x0002, 1)) |
101 maxrooms = aim_tlv_get8(tlvlist, 0x0002, 1); | |
2086 | 102 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
103 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
104 * Type 0x0003: Exchange information |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
105 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
106 * There can be any number of these, each one |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
107 * representing another exchange. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
108 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
109 */ |
7167 | 110 for (curexchange = 0; ((exchangetlv = aim_tlv_gettlv(tlvlist, 0x0003, curexchange+1))); ) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
111 aim_bstream_t tbs; |
2086 | 112 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
113 aim_bstream_init(&tbs, exchangetlv->value, exchangetlv->length); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
114 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
115 curexchange++; |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
116 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
117 exchanges = realloc(exchanges, curexchange * sizeof(struct aim_chat_exchangeinfo)); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
118 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
119 /* exchange number */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
120 exchanges[curexchange-1].number = aimbs_get16(&tbs); |
7167 | 121 innerlist = aim_tlvlist_read(&tbs); |
2086 | 122 |
12429
59207955adc2
[gaim-migrate @ 14736]
Richard Laager <rlaager@wiktel.com>
parents:
11253
diff
changeset
|
123 #if 0 |
11253 | 124 /* |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
125 * Type 0x000a: Unknown. |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
126 * |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
127 * Usually three bytes: 0x0114 (exchange 1) or 0x010f (others). |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
128 * |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
129 */ |
12429
59207955adc2
[gaim-migrate @ 14736]
Richard Laager <rlaager@wiktel.com>
parents:
11253
diff
changeset
|
130 if (aim_tlv_gettlv(innerlist, 0x000a, 1)) { |
59207955adc2
[gaim-migrate @ 14736]
Richard Laager <rlaager@wiktel.com>
parents:
11253
diff
changeset
|
131 /* Unhandled */ |
59207955adc2
[gaim-migrate @ 14736]
Richard Laager <rlaager@wiktel.com>
parents:
11253
diff
changeset
|
132 } |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
133 |
11253 | 134 /* |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
135 * Type 0x000d: Unknown. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
136 */ |
12429
59207955adc2
[gaim-migrate @ 14736]
Richard Laager <rlaager@wiktel.com>
parents:
11253
diff
changeset
|
137 if (aim_tlv_gettlv(innerlist, 0x000d, 1)) { |
59207955adc2
[gaim-migrate @ 14736]
Richard Laager <rlaager@wiktel.com>
parents:
11253
diff
changeset
|
138 /* Unhandled */ |
59207955adc2
[gaim-migrate @ 14736]
Richard Laager <rlaager@wiktel.com>
parents:
11253
diff
changeset
|
139 } |
2086 | 140 |
11253 | 141 /* |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
142 * Type 0x0004: Unknown |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
143 */ |
12429
59207955adc2
[gaim-migrate @ 14736]
Richard Laager <rlaager@wiktel.com>
parents:
11253
diff
changeset
|
144 if (aim_tlv_gettlv(innerlist, 0x0004, 1)) { |
59207955adc2
[gaim-migrate @ 14736]
Richard Laager <rlaager@wiktel.com>
parents:
11253
diff
changeset
|
145 /* Unhandled */ |
59207955adc2
[gaim-migrate @ 14736]
Richard Laager <rlaager@wiktel.com>
parents:
11253
diff
changeset
|
146 } |
59207955adc2
[gaim-migrate @ 14736]
Richard Laager <rlaager@wiktel.com>
parents:
11253
diff
changeset
|
147 #endif |
2086 | 148 |
11253 | 149 /* |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
150 * Type 0x0002: Unknown |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
151 */ |
7167 | 152 if (aim_tlv_gettlv(innerlist, 0x0002, 1)) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
153 fu16_t classperms; |
2086 | 154 |
7167 | 155 classperms = aim_tlv_get16(innerlist, 0x0002, 1); |
11253 | 156 |
157 gaim_debug_misc("oscar", "faim: class permissions %x\n", classperms); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
158 } |
2086 | 159 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
160 /* |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
161 * Type 0x00c9: Flags |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
162 * |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
163 * 1 Evilable |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
164 * 2 Nav Only |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
165 * 4 Instancing Allowed |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
166 * 8 Occupant Peek Allowed |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
167 * |
11253 | 168 */ |
7167 | 169 if (aim_tlv_gettlv(innerlist, 0x00c9, 1)) |
170 exchanges[curexchange-1].flags = aim_tlv_get16(innerlist, 0x00c9, 1); | |
11253 | 171 |
12429
59207955adc2
[gaim-migrate @ 14736]
Richard Laager <rlaager@wiktel.com>
parents:
11253
diff
changeset
|
172 #if 0 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
173 /* |
11253 | 174 * Type 0x00ca: Creation Date |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
175 */ |
12429
59207955adc2
[gaim-migrate @ 14736]
Richard Laager <rlaager@wiktel.com>
parents:
11253
diff
changeset
|
176 if (aim_tlv_gettlv(innerlist, 0x00ca, 1)) { |
59207955adc2
[gaim-migrate @ 14736]
Richard Laager <rlaager@wiktel.com>
parents:
11253
diff
changeset
|
177 /* Unhandled */ |
59207955adc2
[gaim-migrate @ 14736]
Richard Laager <rlaager@wiktel.com>
parents:
11253
diff
changeset
|
178 } |
11253 | 179 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
180 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
181 * Type 0x00d0: Mandatory Channels? |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
182 */ |
12429
59207955adc2
[gaim-migrate @ 14736]
Richard Laager <rlaager@wiktel.com>
parents:
11253
diff
changeset
|
183 if (aim_tlv_gettlv(innerlist, 0x00d0, 1)) { |
59207955adc2
[gaim-migrate @ 14736]
Richard Laager <rlaager@wiktel.com>
parents:
11253
diff
changeset
|
184 /* Unhandled */ |
59207955adc2
[gaim-migrate @ 14736]
Richard Laager <rlaager@wiktel.com>
parents:
11253
diff
changeset
|
185 } |
2086 | 186 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
187 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
188 * Type 0x00d1: Maximum Message length |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
189 */ |
12429
59207955adc2
[gaim-migrate @ 14736]
Richard Laager <rlaager@wiktel.com>
parents:
11253
diff
changeset
|
190 if (aim_tlv_gettlv(innerlist, 0x00d1, 1)) { |
59207955adc2
[gaim-migrate @ 14736]
Richard Laager <rlaager@wiktel.com>
parents:
11253
diff
changeset
|
191 /* Unhandled */ |
59207955adc2
[gaim-migrate @ 14736]
Richard Laager <rlaager@wiktel.com>
parents:
11253
diff
changeset
|
192 } |
2086 | 193 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
194 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
195 * Type 0x00d2: Maximum Occupancy? |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
196 */ |
12429
59207955adc2
[gaim-migrate @ 14736]
Richard Laager <rlaager@wiktel.com>
parents:
11253
diff
changeset
|
197 if (aim_tlv_gettlv(innerlist, 0x00d2, 1)) { |
59207955adc2
[gaim-migrate @ 14736]
Richard Laager <rlaager@wiktel.com>
parents:
11253
diff
changeset
|
198 /* Unhandled */ |
59207955adc2
[gaim-migrate @ 14736]
Richard Laager <rlaager@wiktel.com>
parents:
11253
diff
changeset
|
199 } |
59207955adc2
[gaim-migrate @ 14736]
Richard Laager <rlaager@wiktel.com>
parents:
11253
diff
changeset
|
200 #endif |
2086 | 201 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
202 /* |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
203 * Type 0x00d3: Exchange Description |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
204 */ |
7167 | 205 if (aim_tlv_gettlv(innerlist, 0x00d3, 1)) |
206 exchanges[curexchange-1].name = aim_tlv_getstr(innerlist, 0x00d3, 1); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
207 else |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
208 exchanges[curexchange-1].name = NULL; |
2086 | 209 |
12429
59207955adc2
[gaim-migrate @ 14736]
Richard Laager <rlaager@wiktel.com>
parents:
11253
diff
changeset
|
210 #if 0 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
211 /* |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
212 * Type 0x00d4: Exchange Description URL |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
213 */ |
12429
59207955adc2
[gaim-migrate @ 14736]
Richard Laager <rlaager@wiktel.com>
parents:
11253
diff
changeset
|
214 if (aim_tlv_gettlv(innerlist, 0x00d4, 1)) { |
59207955adc2
[gaim-migrate @ 14736]
Richard Laager <rlaager@wiktel.com>
parents:
11253
diff
changeset
|
215 /* Unhandled */ |
59207955adc2
[gaim-migrate @ 14736]
Richard Laager <rlaager@wiktel.com>
parents:
11253
diff
changeset
|
216 } |
59207955adc2
[gaim-migrate @ 14736]
Richard Laager <rlaager@wiktel.com>
parents:
11253
diff
changeset
|
217 #endif |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
218 |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
219 /* |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
220 * Type 0x00d5: Creation Permissions |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
221 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
222 * 0 Creation not allowed |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
223 * 1 Room creation allowed |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
224 * 2 Exchange creation allowed |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
225 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
226 */ |
7167 | 227 if (aim_tlv_gettlv(innerlist, 0x00d5, 1)) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
228 fu8_t createperms; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
229 |
7167 | 230 createperms = aim_tlv_get8(innerlist, 0x00d5, 1); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
231 } |
2086 | 232 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
233 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
234 * Type 0x00d6: Character Set (First Time) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
235 */ |
7167 | 236 if (aim_tlv_gettlv(innerlist, 0x00d6, 1)) |
237 exchanges[curexchange-1].charset1 = aim_tlv_getstr(innerlist, 0x00d6, 1); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
238 else |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
239 exchanges[curexchange-1].charset1 = NULL; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
240 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
241 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
242 * Type 0x00d7: Language (First Time) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
243 */ |
7167 | 244 if (aim_tlv_gettlv(innerlist, 0x00d7, 1)) |
245 exchanges[curexchange-1].lang1 = aim_tlv_getstr(innerlist, 0x00d7, 1); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
246 else |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
247 exchanges[curexchange-1].lang1 = NULL; |
2086 | 248 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
249 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
250 * Type 0x00d8: Character Set (Second Time) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
251 */ |
7167 | 252 if (aim_tlv_gettlv(innerlist, 0x00d8, 1)) |
253 exchanges[curexchange-1].charset2 = aim_tlv_getstr(innerlist, 0x00d8, 1); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
254 else |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
255 exchanges[curexchange-1].charset2 = NULL; |
2086 | 256 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
257 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
258 * Type 0x00d9: Language (Second Time) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
259 */ |
7167 | 260 if (aim_tlv_gettlv(innerlist, 0x00d9, 1)) |
261 exchanges[curexchange-1].lang2 = aim_tlv_getstr(innerlist, 0x00d9, 1); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
262 else |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
263 exchanges[curexchange-1].lang2 = NULL; |
12429
59207955adc2
[gaim-migrate @ 14736]
Richard Laager <rlaager@wiktel.com>
parents:
11253
diff
changeset
|
264 |
59207955adc2
[gaim-migrate @ 14736]
Richard Laager <rlaager@wiktel.com>
parents:
11253
diff
changeset
|
265 #if 0 |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
266 /* |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
267 * Type 0x00da: Unknown |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
268 */ |
12429
59207955adc2
[gaim-migrate @ 14736]
Richard Laager <rlaager@wiktel.com>
parents:
11253
diff
changeset
|
269 if (aim_tlv_gettlv(innerlist, 0x00da, 1)) { |
59207955adc2
[gaim-migrate @ 14736]
Richard Laager <rlaager@wiktel.com>
parents:
11253
diff
changeset
|
270 /* Unhandled */ |
59207955adc2
[gaim-migrate @ 14736]
Richard Laager <rlaager@wiktel.com>
parents:
11253
diff
changeset
|
271 } |
59207955adc2
[gaim-migrate @ 14736]
Richard Laager <rlaager@wiktel.com>
parents:
11253
diff
changeset
|
272 #endif |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
273 |
7167 | 274 aim_tlvlist_free(&innerlist); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
275 } |
2086 | 276 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
277 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
278 * Call client. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
279 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
280 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
281 ret = userfunc(sess, rx, snac2->type, maxrooms, curexchange, exchanges); |
2086 | 282 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
283 for (curexchange--; curexchange >= 0; curexchange--) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
284 free(exchanges[curexchange].name); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
285 free(exchanges[curexchange].charset1); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
286 free(exchanges[curexchange].lang1); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
287 free(exchanges[curexchange].charset2); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
288 free(exchanges[curexchange].lang2); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
289 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
290 free(exchanges); |
7167 | 291 aim_tlvlist_free(&tlvlist); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
292 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
293 return ret; |
2086 | 294 } |
295 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
296 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) |
2086 | 297 { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
298 aim_rxcallback_t userfunc; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
299 aim_tlvlist_t *tlvlist, *innerlist; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
300 char *ck = NULL, *fqcn = NULL, *name = NULL; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
301 fu16_t exchange = 0, instance = 0, unknown = 0, flags = 0, maxmsglen = 0, maxoccupancy = 0; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
302 fu32_t createtime = 0; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
303 fu8_t createperms = 0, detaillevel; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
304 int cklen; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
305 aim_tlv_t *bigblock; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
306 int ret = 0; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
307 aim_bstream_t bbbs; |
2086 | 308 |
7167 | 309 tlvlist = aim_tlvlist_read(bs); |
2086 | 310 |
7167 | 311 if (!(bigblock = aim_tlv_gettlv(tlvlist, 0x0004, 1))) { |
11253 | 312 gaim_debug_misc("oscar", "no bigblock in top tlv in create room response\n"); |
7167 | 313 aim_tlvlist_free(&tlvlist); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
314 return 0; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
315 } |
2086 | 316 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
317 aim_bstream_init(&bbbs, bigblock->value, bigblock->length); |
2086 | 318 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
319 exchange = aimbs_get16(&bbbs); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
320 cklen = aimbs_get8(&bbbs); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
321 ck = aimbs_getstr(&bbbs, cklen); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
322 instance = aimbs_get16(&bbbs); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
323 detaillevel = aimbs_get8(&bbbs); |
2086 | 324 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
325 if (detaillevel != 0x02) { |
11253 | 326 gaim_debug_misc("oscar", "unknown detaillevel in create room response (0x%02x)\n", detaillevel); |
7167 | 327 aim_tlvlist_free(&tlvlist); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
328 free(ck); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
329 return 0; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
330 } |
2086 | 331 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
332 unknown = aimbs_get16(&bbbs); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
333 |
7167 | 334 innerlist = aim_tlvlist_read(&bbbs); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
335 |
7167 | 336 if (aim_tlv_gettlv(innerlist, 0x006a, 1)) |
337 fqcn = aim_tlv_getstr(innerlist, 0x006a, 1); | |
2086 | 338 |
7167 | 339 if (aim_tlv_gettlv(innerlist, 0x00c9, 1)) |
340 flags = aim_tlv_get16(innerlist, 0x00c9, 1); | |
2086 | 341 |
7167 | 342 if (aim_tlv_gettlv(innerlist, 0x00ca, 1)) |
343 createtime = aim_tlv_get32(innerlist, 0x00ca, 1); | |
2086 | 344 |
7167 | 345 if (aim_tlv_gettlv(innerlist, 0x00d1, 1)) |
346 maxmsglen = aim_tlv_get16(innerlist, 0x00d1, 1); | |
2086 | 347 |
7167 | 348 if (aim_tlv_gettlv(innerlist, 0x00d2, 1)) |
349 maxoccupancy = aim_tlv_get16(innerlist, 0x00d2, 1); | |
2086 | 350 |
7167 | 351 if (aim_tlv_gettlv(innerlist, 0x00d3, 1)) |
352 name = aim_tlv_getstr(innerlist, 0x00d3, 1); | |
2086 | 353 |
7167 | 354 if (aim_tlv_gettlv(innerlist, 0x00d5, 1)) |
355 createperms = aim_tlv_get8(innerlist, 0x00d5, 1); | |
2086 | 356 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
357 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
358 ret = userfunc(sess, rx, snac2->type, fqcn, instance, exchange, flags, createtime, maxmsglen, maxoccupancy, createperms, unknown, name, ck); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
359 } |
2086 | 360 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
361 free(ck); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
362 free(name); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
363 free(fqcn); |
7167 | 364 aim_tlvlist_free(&innerlist); |
365 aim_tlvlist_free(&tlvlist); | |
2086 | 366 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
367 return ret; |
2086 | 368 } |
369 | |
370 /* | |
3952 | 371 * Subtype 0x0009 |
372 * | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
373 * Since multiple things can trigger this callback, we must lookup the |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
374 * snacid to determine the original snac subtype that was called. |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
375 * |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
376 * XXX This isn't really how this works. But this is: Every d/9 response |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
377 * has a 16bit value at the beginning. That matches to: |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
378 * Short Desc = 1 |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
379 * Full Desc = 2 |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
380 * Instance Info = 4 |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
381 * Nav Short Desc = 8 |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
382 * Nav Instance Info = 16 |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
383 * And then everything is really asynchronous. There is no specific |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
384 * attachment of a response to a create room request, for example. Creating |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
385 * the room yields no different a response than requesting the room's info. |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
386 * |
2086 | 387 */ |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
388 static int parseinfo(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) |
2086 | 389 { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
390 aim_snac_t *snac2; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
391 int ret = 0; |
2086 | 392 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
393 if (!(snac2 = aim_remsnac(sess, snac->id))) { |
11253 | 394 gaim_debug_misc("oscar", "faim: chatnav_parse_info: received response to unknown request! (%08lx)\n", snac->id); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
395 return 0; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
396 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
397 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
398 if (snac2->family != 0x000d) { |
11253 | 399 gaim_debug_misc("oscar", "faim: chatnav_parse_info: recieved response that maps to corrupt request! (fam=%04x)\n", snac2->family); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
400 return 0; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
401 } |
2086 | 402 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
403 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
404 * We now know what the original SNAC subtype was. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
405 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
406 if (snac2->type == 0x0002) /* request chat rights */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
407 ret = parseinfo_perms(sess, mod, rx, snac, bs, snac2); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
408 else if (snac2->type == 0x0003) /* request exchange info */ |
11253 | 409 gaim_debug_misc("oscar", "chatnav_parse_info: resposne to exchange info\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
410 else if (snac2->type == 0x0004) /* request room info */ |
11253 | 411 gaim_debug_misc("oscar", "chatnav_parse_info: response to room info\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
412 else if (snac2->type == 0x0005) /* request more room info */ |
11253 | 413 gaim_debug_misc("oscar", "chatnav_parse_info: response to more room info\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
414 else if (snac2->type == 0x0006) /* request occupant list */ |
11253 | 415 gaim_debug_misc("oscar", "chatnav_parse_info: response to occupant info\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
416 else if (snac2->type == 0x0007) /* search for a room */ |
11253 | 417 gaim_debug_misc("oscar", "chatnav_parse_info: search results\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
418 else if (snac2->type == 0x0008) /* create room */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
419 ret = parseinfo_create(sess, mod, rx, snac, bs, snac2); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
420 else |
11253 | 421 gaim_debug_misc("oscar", "chatnav_parse_info: unknown request subtype (%04x)\n", snac2->type); |
2086 | 422 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
423 if (snac2) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
424 free(snac2->data); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
425 free(snac2); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
426 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
427 return ret; |
2086 | 428 } |
429 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
430 static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) |
2086 | 431 { |
432 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
433 if (snac->subtype == 0x0009) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
434 return parseinfo(sess, mod, rx, snac, bs); |
2086 | 435 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
436 return 0; |
2086 | 437 } |
438 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
439 faim_internal int chatnav_modfirst(aim_session_t *sess, aim_module_t *mod) |
2086 | 440 { |
441 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
442 mod->family = 0x000d; |
4071 | 443 mod->version = 0x0001; |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
444 mod->toolid = 0x0010; |
4071 | 445 mod->toolversion = 0x0629; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
446 mod->flags = 0; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
447 strncpy(mod->name, "chatnav", sizeof(mod->name)); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
448 mod->snachandler = snachandler; |
2086 | 449 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
450 return 0; |
2086 | 451 } |