Wed, 13 May 2009 20:29:03 +0000
Support custom smileys in MUCs (when all participants support BoB and a maximum
of 10 participants are in the chat).
Always announce support for BoB, since disable custom smileys will still turn
off fetching them, and BoB can be used for other purposes further on.
| 13235 | 1 | /* |
| 15884 | 2 | * Purple's oscar protocol plugin |
| 13235 | 3 | * This file is the legal property of its developers. |
| 4 | * Please see the AUTHORS file distributed alongside this file. | |
| 5 | * | |
| 6 | * This library is free software; you can redistribute it and/or | |
| 7 | * modify it under the terms of the GNU Lesser General Public | |
| 8 | * License as published by the Free Software Foundation; either | |
| 9 | * version 2 of the License, or (at your option) any later version. | |
| 10 | * | |
| 11 | * This library is distributed in the hope that it will be useful, | |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 14 | * Lesser General Public License for more details. | |
| 15 | * | |
| 16 | * You should have received a copy of the GNU Lesser General Public | |
| 17 | * License along with this library; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19832
diff
changeset
|
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 13235 | 19 | */ |
| 20 | ||
| 21 | /* | |
| 22 | * Family 0x0004 - Routines for sending/receiving Instant Messages. | |
| 23 | * | |
| 24 | * Note the term ICBM (Inter-Client Basic Message) which blankets | |
| 25 | * all types of generically routed through-server messages. Within | |
| 26 | * the ICBM types (family 4), a channel is defined. Each channel | |
| 27 | * represents a different type of message. Channel 1 is used for | |
| 28 | * what would commonly be called an "instant message". Channel 2 | |
| 29 | * is used for negotiating "rendezvous". These transactions end in | |
| 30 | * something more complex happening, such as a chat invitation, or | |
| 31 | * a file transfer. Channel 3 is used for chat messages (not in | |
| 32 | * the same family as these channels). Channel 4 is used for | |
| 33 | * various ICQ messages. Examples are normal messages, URLs, and | |
| 34 | * old-style authorization. | |
| 35 | * | |
| 36 | * In addition to the channel, every ICBM contains a cookie. For | |
| 37 | * standard IMs, these are only used for error messages. However, | |
| 38 | * the more complex rendezvous messages make suitably more complex | |
| 39 | * use of this field. | |
| 40 | * | |
| 41 | * TODO: Split this up into an im.c file an an icbm.c file. It | |
| 42 | * will be beautiful, you'll see. | |
| 43 | * | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
44 | * Make sure flap_connection_findbygroup is used by all functions. |
| 13235 | 45 | */ |
| 46 | ||
| 47 | #include "oscar.h" | |
| 48 | #include "peer.h" | |
| 49 | ||
| 50 | #ifdef _WIN32 | |
| 51 | #include "win32dep.h" | |
| 52 | #endif | |
| 53 | ||
|
22125
57b7d398c30e
Partial support for reading ICQ 6 status notes. The status note will
Mark Doliner <markdoliner@pidgin.im>
parents:
21841
diff
changeset
|
54 | #include "util.h" |
|
57b7d398c30e
Partial support for reading ICQ 6 status notes. The status note will
Mark Doliner <markdoliner@pidgin.im>
parents:
21841
diff
changeset
|
55 | |
|
57b7d398c30e
Partial support for reading ICQ 6 status notes. The status note will
Mark Doliner <markdoliner@pidgin.im>
parents:
21841
diff
changeset
|
56 | |
| 13235 | 57 | /** |
| 58 | * Add a standard ICBM header to the given bstream with the given | |
| 59 | * information. | |
| 60 | * | |
| 61 | * @param bs The bstream to write the ICBM header to. | |
| 62 | * @param c c is for cookie, and cookie is for me. | |
| 63 | * @param channel The ICBM channel (1 through 4). | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
64 | * @param bn Null-terminated scrizeen nizame. |
| 13235 | 65 | * @return The number of bytes written. It's really not useful. |
| 66 | */ | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
67 | static int aim_im_puticbm(ByteStream *bs, const guchar *c, guint16 channel, const char *bn) |
| 13235 | 68 | { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
69 | byte_stream_putraw(bs, c, 8); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
70 | byte_stream_put16(bs, channel); |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
71 | byte_stream_put8(bs, strlen(bn)); |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
72 | byte_stream_putstr(bs, bn); |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
73 | return 8+2+1+strlen(bn); |
| 13235 | 74 | } |
| 75 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
76 | /** |
| 13235 | 77 | * Generates a random ICBM cookie in a character array of length 8 |
| 78 | * and copies it into the variable passed as cookie | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
79 | * TODO: Maybe we should stop limiting our characters to the visible range? |
| 13235 | 80 | */ |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
81 | void aim_icbm_makecookie(guchar *cookie) |
| 13235 | 82 | { |
| 83 | int i; | |
| 84 | ||
| 85 | /* Should be like "21CBF95" and null terminated */ | |
| 86 | for (i = 0; i < 7; i++) | |
| 87 | cookie[i] = 0x30 + ((guchar)rand() % 10); | |
| 88 | cookie[7] = '\0'; | |
| 89 | } | |
| 90 | ||
| 91 | /* | |
| 92 | * Takes a msghdr (and a length) and returns a client type | |
| 93 | * code. Note that this is *only a guess* and has a low likelihood | |
| 94 | * of actually being accurate. | |
| 95 | * | |
| 96 | * Its based on experimental data, with the help of Eric Warmenhoven | |
| 97 | * who seems to have collected a wide variety of different AIM clients. | |
| 98 | * | |
| 99 | * | |
| 100 | * Heres the current collection: | |
| 101 | * 0501 0003 0101 0101 01 AOL Mobile Communicator, WinAIM 1.0.414 | |
| 102 | * 0501 0003 0101 0201 01 WinAIM 2.0.847, 2.1.1187, 3.0.1464, | |
| 103 | * 4.3.2229, 4.4.2286 | |
| 104 | * 0501 0004 0101 0102 0101 WinAIM 4.1.2010, libfaim (right here) | |
| 105 | * 0501 0003 0101 02 WinAIM 5 | |
| 106 | * 0501 0001 01 iChat x.x, mobile buddies | |
| 107 | * 0501 0001 0101 01 AOL v6.0, CompuServe 2000 v6.0, any TOC client | |
| 108 | * 0501 0002 0106 WinICQ 5.45.1.3777.85 | |
| 109 | * | |
| 110 | * Note that in this function, only the feature bytes are tested, since | |
| 111 | * the rest will always be the same. | |
| 112 | * | |
| 113 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
114 | guint16 aim_im_fingerprint(const guint8 *msghdr, int len) |
| 13235 | 115 | { |
| 116 | static const struct { | |
| 117 | guint16 clientid; | |
| 118 | int len; | |
| 119 | guint8 data[10]; | |
| 120 | } fingerprints[] = { | |
| 121 | /* AOL Mobile Communicator, WinAIM 1.0.414 */ | |
| 122 | { AIM_CLIENTTYPE_MC, | |
| 123 | 3, {0x01, 0x01, 0x01}}, | |
| 124 | ||
| 125 | /* WinAIM 2.0.847, 2.1.1187, 3.0.1464, 4.3.2229, 4.4.2286 */ | |
| 126 | { AIM_CLIENTTYPE_WINAIM, | |
| 127 | 3, {0x01, 0x01, 0x02}}, | |
| 128 | ||
| 129 | /* WinAIM 4.1.2010, libfaim */ | |
| 130 | { AIM_CLIENTTYPE_WINAIM41, | |
| 131 | 4, {0x01, 0x01, 0x01, 0x02}}, | |
| 132 | ||
| 133 | /* AOL v6.0, CompuServe 2000 v6.0, any TOC client */ | |
| 134 | { AIM_CLIENTTYPE_AOL_TOC, | |
| 135 | 1, {0x01}}, | |
| 136 | ||
| 137 | { 0, 0, {0x00}} | |
| 138 | }; | |
| 139 | int i; | |
| 140 | ||
| 141 | if (!msghdr || (len <= 0)) | |
| 142 | return AIM_CLIENTTYPE_UNKNOWN; | |
| 143 | ||
| 144 | for (i = 0; fingerprints[i].len; i++) { | |
| 145 | if (fingerprints[i].len != len) | |
| 146 | continue; | |
| 147 | if (memcmp(fingerprints[i].data, msghdr, fingerprints[i].len) == 0) | |
| 148 | return fingerprints[i].clientid; | |
| 149 | } | |
| 150 | ||
| 151 | return AIM_CLIENTTYPE_UNKNOWN; | |
| 152 | } | |
| 153 | ||
| 154 | /** | |
| 155 | * Subtype 0x0002 - Set ICBM parameters. | |
| 156 | * | |
| 157 | * I definitely recommend sending this. If you don't, you'll be stuck | |
| 158 | * with the rather unreasonable defaults. | |
| 159 | * | |
| 160 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
161 | int aim_im_setparams(OscarData *od, struct aim_icbmparameters *params) |
| 13235 | 162 | { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
163 | FlapConnection *conn; |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
164 | ByteStream bs; |
| 13235 | 165 | aim_snacid_t snacid; |
| 166 | ||
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
167 | if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM))) |
| 13235 | 168 | return -EINVAL; |
| 169 | ||
| 170 | if (!params) | |
| 171 | return -EINVAL; | |
| 172 | ||
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
173 | byte_stream_new(&bs, 16); |
| 13235 | 174 | |
| 175 | /* This is read-only (see Parameter Reply). Must be set to zero here. */ | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
176 | byte_stream_put16(&bs, 0x0000); |
| 13235 | 177 | |
| 178 | /* These are all read-write */ | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
179 | byte_stream_put32(&bs, params->flags); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
180 | byte_stream_put16(&bs, params->maxmsglen); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
181 | byte_stream_put16(&bs, params->maxsenderwarn); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
182 | byte_stream_put16(&bs, params->maxrecverwarn); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
183 | byte_stream_put32(&bs, params->minmsginterval); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
184 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
185 | snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0002, 0x0000, NULL, 0); |
|
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
186 | flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0002, 0x0000, snacid, &bs); |
|
23004
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22862
diff
changeset
|
187 | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
188 | byte_stream_destroy(&bs); |
|
23004
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22862
diff
changeset
|
189 | |
| 13235 | 190 | return 0; |
| 191 | } | |
| 192 | ||
| 193 | /** | |
| 194 | * Subtype 0x0004 - Request ICBM parameter information. | |
| 195 | * | |
| 196 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
197 | int aim_im_reqparams(OscarData *od) |
| 13235 | 198 | { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
199 | FlapConnection *conn; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
200 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
201 | if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM))) |
| 13235 | 202 | return -EINVAL; |
| 203 | ||
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
204 | aim_genericreq_n_snacid(od, conn, SNAC_FAMILY_ICBM, 0x0004); |
|
13610
b2c15a312144
[gaim-migrate @ 15995]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
205 | |
|
b2c15a312144
[gaim-migrate @ 15995]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
206 | return 0; |
| 13235 | 207 | } |
| 208 | ||
| 209 | /** | |
| 210 | * Subtype 0x0005 - Receive parameter information. | |
| 211 | * | |
| 212 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
213 | static int aim_im_paraminfo(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
| 13235 | 214 | { |
| 215 | struct aim_icbmparameters params; | |
| 216 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
217 | params.maxchan = byte_stream_get16(bs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
218 | params.flags = byte_stream_get32(bs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
219 | params.maxmsglen = byte_stream_get16(bs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
220 | params.maxsenderwarn = byte_stream_get16(bs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
221 | params.maxrecverwarn = byte_stream_get16(bs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
222 | params.minmsginterval = byte_stream_get32(bs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
223 | |
|
22479
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
224 | params.flags = 0x0000000b | AIM_IMPARAM_FLAG_SUPPORT_OFFLINEMSGS; |
|
21840
e92b7114fb8b
Get rid of one little userfunc callback and just call aim_im_setparams()
Mark Doliner <markdoliner@pidgin.im>
parents:
19859
diff
changeset
|
225 | params.maxmsglen = 8000; |
|
e92b7114fb8b
Get rid of one little userfunc callback and just call aim_im_setparams()
Mark Doliner <markdoliner@pidgin.im>
parents:
19859
diff
changeset
|
226 | params.minmsginterval = 0; |
|
e92b7114fb8b
Get rid of one little userfunc callback and just call aim_im_setparams()
Mark Doliner <markdoliner@pidgin.im>
parents:
19859
diff
changeset
|
227 | |
|
e92b7114fb8b
Get rid of one little userfunc callback and just call aim_im_setparams()
Mark Doliner <markdoliner@pidgin.im>
parents:
19859
diff
changeset
|
228 | aim_im_setparams(od, ¶ms); |
| 13235 | 229 | |
| 230 | return 0; | |
| 231 | } | |
| 232 | ||
| 233 | /** | |
| 234 | * Subtype 0x0006 - Send an ICBM (instant message). | |
| 235 | * | |
| 236 | * | |
| 237 | * Possible flags: | |
| 238 | * AIM_IMFLAGS_AWAY -- Marks the message as an autoresponse | |
| 239 | * AIM_IMFLAGS_ACK -- Requests that the server send an ack | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
240 | * when the message is received (of type SNAC_FAMILY_ICBM/0x000c) |
| 13235 | 241 | * AIM_IMFLAGS_OFFLINE--If destination is offline, store it until they are |
| 242 | * online (probably ICQ only). | |
| 243 | * | |
| 244 | * Generally, you should use the lowest encoding possible to send | |
| 245 | * your message. If you only use basic punctuation and the generic | |
| 246 | * Latin alphabet, use ASCII7 (no flags). If you happen to use non-ASCII7 | |
| 247 | * characters, but they are all clearly defined in ISO-8859-1, then | |
| 248 | * use that. Keep in mind that not all characters in the PC ASCII8 | |
| 249 | * character set are defined in the ISO standard. For those cases (most | |
| 250 | * notably when the (r) symbol is used), you must use the full UNICODE | |
| 251 | * encoding for your message. In UNICODE mode, _all_ characters must | |
| 252 | * occupy 16bits, including ones that are not special. (Remember that | |
| 253 | * the first 128 UNICODE symbols are equivalent to ASCII7, however they | |
| 254 | * must be prefixed with a zero high order byte.) | |
| 255 | * | |
| 256 | * I strongly discourage the use of UNICODE mode, mainly because none | |
| 257 | * of the clients I use can parse those messages (and besides that, | |
| 258 | * wchars are difficult and non-portable to handle in most UNIX environments). | |
| 259 | * If you really need to include special characters, use the HTML UNICODE | |
| 260 | * entities. These are of the form ߪ where 2026 is the hex | |
| 261 | * representation of the UNICODE index (in this case, UNICODE | |
| 262 | * "Horizontal Ellipsis", or 133 in in ASCII8). | |
| 263 | * | |
| 264 | * Implementation note: Since this is one of the most-used functions | |
| 265 | * in all of libfaim, it is written with performance in mind. As such, | |
| 266 | * it is not as clear as it could be in respect to how this message is | |
| 267 | * supposed to be layed out. Most obviously, tlvlists should be used | |
| 268 | * instead of writing out the bytes manually. | |
| 269 | * | |
| 270 | * XXX - more precise verification that we never send SNACs larger than 8192 | |
| 271 | * XXX - check SNAC size for multipart | |
| 272 | * | |
| 273 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
274 | int aim_im_sendch1_ext(OscarData *od, struct aim_sendimext_args *args) |
| 13235 | 275 | { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
276 | FlapConnection *conn; |
| 13235 | 277 | aim_snacid_t snacid; |
|
15150
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
278 | ByteStream data; |
| 13235 | 279 | guchar cookie[8]; |
| 280 | int msgtlvlen; | |
| 281 | static const guint8 deffeatures[] = { 0x01, 0x01, 0x01, 0x02 }; | |
| 282 | ||
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
283 | if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM))) |
| 13235 | 284 | return -EINVAL; |
| 285 | ||
| 286 | if (!args) | |
| 287 | return -EINVAL; | |
| 288 | ||
| 289 | if (args->flags & AIM_IMFLAGS_MULTIPART) { | |
| 290 | if (args->mpmsg->numparts == 0) | |
| 291 | return -EINVAL; | |
| 292 | } else { | |
| 293 | if (!args->msg || (args->msglen <= 0)) | |
| 294 | return -EINVAL; | |
| 295 | ||
|
21841
e01435637d1d
The current oscar max message size appears to be 2544. I don't know
Mark Doliner <markdoliner@pidgin.im>
parents:
21840
diff
changeset
|
296 | if (args->msglen > MAXMSGLEN) |
| 13235 | 297 | return -E2BIG; |
| 298 | } | |
| 299 | ||
| 300 | /* Painfully calculate the size of the message TLV */ | |
| 301 | msgtlvlen = 1 + 1; /* 0501 */ | |
| 302 | ||
| 303 | if (args->flags & AIM_IMFLAGS_CUSTOMFEATURES) | |
| 304 | msgtlvlen += 2 + args->featureslen; | |
| 305 | else | |
| 306 | msgtlvlen += 2 + sizeof(deffeatures); | |
| 307 | ||
| 308 | if (args->flags & AIM_IMFLAGS_MULTIPART) { | |
| 309 | aim_mpmsg_section_t *sec; | |
| 310 | ||
| 311 | for (sec = args->mpmsg->parts; sec; sec = sec->next) { | |
| 312 | msgtlvlen += 2 /* 0101 */ + 2 /* block len */; | |
| 313 | msgtlvlen += 4 /* charset */ + sec->datalen; | |
| 314 | } | |
| 315 | ||
| 316 | } else { | |
| 317 | msgtlvlen += 2 /* 0101 */ + 2 /* block len */; | |
| 318 | msgtlvlen += 4 /* charset */ + args->msglen; | |
| 319 | } | |
| 320 | ||
|
15151
bb985812fefa
[gaim-migrate @ 17875]
Mark Doliner <markdoliner@pidgin.im>
parents:
15150
diff
changeset
|
321 | byte_stream_new(&data, msgtlvlen + 128); |
| 13235 | 322 | |
| 323 | /* Generate an ICBM cookie */ | |
| 324 | aim_icbm_makecookie(cookie); | |
| 325 | ||
| 326 | /* ICBM header */ | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
327 | aim_im_puticbm(&data, cookie, 0x0001, args->destbn); |
| 13235 | 328 | |
| 329 | /* Message TLV (type 0x0002) */ | |
|
15150
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
330 | byte_stream_put16(&data, 0x0002); |
|
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
331 | byte_stream_put16(&data, msgtlvlen); |
| 13235 | 332 | |
| 333 | /* Features TLV (type 0x0501) */ | |
|
15150
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
334 | byte_stream_put16(&data, 0x0501); |
| 13235 | 335 | if (args->flags & AIM_IMFLAGS_CUSTOMFEATURES) { |
|
15150
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
336 | byte_stream_put16(&data, args->featureslen); |
|
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
337 | byte_stream_putraw(&data, args->features, args->featureslen); |
| 13235 | 338 | } else { |
|
15150
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
339 | byte_stream_put16(&data, sizeof(deffeatures)); |
|
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
340 | byte_stream_putraw(&data, deffeatures, sizeof(deffeatures)); |
| 13235 | 341 | } |
| 342 | ||
| 343 | if (args->flags & AIM_IMFLAGS_MULTIPART) { | |
| 344 | aim_mpmsg_section_t *sec; | |
| 345 | ||
| 346 | /* Insert each message part in a TLV (type 0x0101) */ | |
| 347 | for (sec = args->mpmsg->parts; sec; sec = sec->next) { | |
|
15150
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
348 | byte_stream_put16(&data, 0x0101); |
|
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
349 | byte_stream_put16(&data, sec->datalen + 4); |
|
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
350 | byte_stream_put16(&data, sec->charset); |
|
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
351 | byte_stream_put16(&data, sec->charsubset); |
|
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
352 | byte_stream_putraw(&data, (guchar *)sec->data, sec->datalen); |
| 13235 | 353 | } |
| 354 | ||
| 355 | } else { | |
| 356 | ||
| 357 | /* Insert message text in a TLV (type 0x0101) */ | |
|
15150
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
358 | byte_stream_put16(&data, 0x0101); |
| 13235 | 359 | |
| 360 | /* Message block length */ | |
|
15150
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
361 | byte_stream_put16(&data, args->msglen + 0x04); |
| 13235 | 362 | |
| 363 | /* Character set */ | |
|
15150
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
364 | byte_stream_put16(&data, args->charset); |
|
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
365 | byte_stream_put16(&data, args->charsubset); |
| 13235 | 366 | |
| 367 | /* Message. Not terminated */ | |
|
15150
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
368 | byte_stream_putraw(&data, (guchar *)args->msg, args->msglen); |
| 13235 | 369 | } |
| 370 | ||
| 371 | /* Set the Autoresponse flag */ | |
| 372 | if (args->flags & AIM_IMFLAGS_AWAY) { | |
|
15150
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
373 | byte_stream_put16(&data, 0x0004); |
|
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
374 | byte_stream_put16(&data, 0x0000); |
|
22487
295c94bc4822
* Don't flag outgoing oscar messages as "offline deliverable" if the
Mark Doliner <markdoliner@pidgin.im>
parents:
22479
diff
changeset
|
375 | } else { |
|
295c94bc4822
* Don't flag outgoing oscar messages as "offline deliverable" if the
Mark Doliner <markdoliner@pidgin.im>
parents:
22479
diff
changeset
|
376 | if (args->flags & AIM_IMFLAGS_ACK) { |
|
295c94bc4822
* Don't flag outgoing oscar messages as "offline deliverable" if the
Mark Doliner <markdoliner@pidgin.im>
parents:
22479
diff
changeset
|
377 | /* Set the Request Acknowledge flag */ |
|
295c94bc4822
* Don't flag outgoing oscar messages as "offline deliverable" if the
Mark Doliner <markdoliner@pidgin.im>
parents:
22479
diff
changeset
|
378 | byte_stream_put16(&data, 0x0003); |
|
295c94bc4822
* Don't flag outgoing oscar messages as "offline deliverable" if the
Mark Doliner <markdoliner@pidgin.im>
parents:
22479
diff
changeset
|
379 | byte_stream_put16(&data, 0x0000); |
|
295c94bc4822
* Don't flag outgoing oscar messages as "offline deliverable" if the
Mark Doliner <markdoliner@pidgin.im>
parents:
22479
diff
changeset
|
380 | } |
|
295c94bc4822
* Don't flag outgoing oscar messages as "offline deliverable" if the
Mark Doliner <markdoliner@pidgin.im>
parents:
22479
diff
changeset
|
381 | |
|
295c94bc4822
* Don't flag outgoing oscar messages as "offline deliverable" if the
Mark Doliner <markdoliner@pidgin.im>
parents:
22479
diff
changeset
|
382 | if (args->flags & AIM_IMFLAGS_OFFLINE) { |
|
295c94bc4822
* Don't flag outgoing oscar messages as "offline deliverable" if the
Mark Doliner <markdoliner@pidgin.im>
parents:
22479
diff
changeset
|
383 | /* Allow this message to be queued as an offline message */ |
|
295c94bc4822
* Don't flag outgoing oscar messages as "offline deliverable" if the
Mark Doliner <markdoliner@pidgin.im>
parents:
22479
diff
changeset
|
384 | byte_stream_put16(&data, 0x0006); |
|
295c94bc4822
* Don't flag outgoing oscar messages as "offline deliverable" if the
Mark Doliner <markdoliner@pidgin.im>
parents:
22479
diff
changeset
|
385 | byte_stream_put16(&data, 0x0000); |
|
295c94bc4822
* Don't flag outgoing oscar messages as "offline deliverable" if the
Mark Doliner <markdoliner@pidgin.im>
parents:
22479
diff
changeset
|
386 | } |
| 13235 | 387 | } |
| 388 | ||
| 389 | /* | |
| 390 | * Set the I HAVE A REALLY PURTY ICON flag. | |
| 391 | * XXX - This should really only be sent on initial | |
| 392 | * IMs and when you change your icon. | |
| 393 | */ | |
| 394 | if (args->flags & AIM_IMFLAGS_HASICON) { | |
|
15150
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
395 | byte_stream_put16(&data, 0x0008); |
|
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
396 | byte_stream_put16(&data, 0x000c); |
|
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
397 | byte_stream_put32(&data, args->iconlen); |
|
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
398 | byte_stream_put16(&data, 0x0001); |
|
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
399 | byte_stream_put16(&data, args->iconsum); |
|
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
400 | byte_stream_put32(&data, args->iconstamp); |
| 13235 | 401 | } |
| 402 | ||
| 403 | /* | |
| 404 | * Set the Buddy Icon Requested flag. | |
| 405 | * XXX - Every time? Surely not... | |
| 406 | */ | |
| 407 | if (args->flags & AIM_IMFLAGS_BUDDYREQ) { | |
|
15150
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
408 | byte_stream_put16(&data, 0x0009); |
|
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
409 | byte_stream_put16(&data, 0x0000); |
| 13235 | 410 | } |
| 411 | ||
|
15150
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
412 | /* XXX - should be optional */ |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
413 | snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, args->destbn, strlen(args->destbn)+1); |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
414 | |
|
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
415 | flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &data); |
|
22862
24f8ae1208ca
Fixed the final stragglers in need of byte_stream_destroy()
Evan Schoenberg <evands@pidgin.im>
parents:
22860
diff
changeset
|
416 | byte_stream_destroy(&data); |
| 13235 | 417 | |
| 418 | /* clean out SNACs over 60sec old */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
419 | aim_cleansnacs(od, 60); |
| 13235 | 420 | |
| 421 | return 0; | |
| 422 | } | |
| 423 | ||
| 424 | /* | |
| 425 | * Simple wrapper for aim_im_sendch1_ext() | |
| 426 | * | |
| 427 | * You cannot use aim_send_im if you need the HASICON flag. You must | |
| 428 | * use aim_im_sendch1_ext directly for that. | |
| 429 | * | |
| 430 | * aim_send_im also cannot be used if you require UNICODE messages, because | |
| 431 | * that requires an explicit message length. Use aim_im_sendch1_ext(). | |
| 432 | * | |
| 433 | */ | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
434 | int aim_im_sendch1(OscarData *od, const char *bn, guint16 flags, const char *msg) |
| 13235 | 435 | { |
| 436 | struct aim_sendimext_args args; | |
| 437 | ||
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
438 | args.destbn = bn; |
| 13235 | 439 | args.flags = flags; |
| 440 | args.msg = msg; | |
| 441 | args.msglen = strlen(msg); | |
| 442 | args.charset = 0x0000; | |
| 443 | args.charsubset = 0x0000; | |
| 444 | ||
| 445 | /* Make these don't get set by accident -- they need aim_im_sendch1_ext */ | |
| 446 | args.flags &= ~(AIM_IMFLAGS_CUSTOMFEATURES | AIM_IMFLAGS_HASICON | AIM_IMFLAGS_MULTIPART); | |
| 447 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
448 | return aim_im_sendch1_ext(od, &args); |
| 13235 | 449 | } |
| 450 | ||
| 451 | /* | |
| 452 | * Subtype 0x0006 - Send a chat invitation. | |
| 453 | */ | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
454 | int aim_im_sendch2_chatinvite(OscarData *od, const char *bn, const char *msg, guint16 exchange, const char *roomname, guint16 instance) |
| 13235 | 455 | { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
456 | FlapConnection *conn; |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
457 | ByteStream bs; |
| 13235 | 458 | aim_snacid_t snacid; |
|
13240
db5187cc40d1
[gaim-migrate @ 15605]
Mark Doliner <markdoliner@pidgin.im>
parents:
13235
diff
changeset
|
459 | IcbmCookie *msgcookie; |
| 13235 | 460 | struct aim_invite_priv *priv; |
| 461 | guchar cookie[8]; | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
462 | GSList *outer_tlvlist = NULL, *inner_tlvlist = NULL; |
|
13240
db5187cc40d1
[gaim-migrate @ 15605]
Mark Doliner <markdoliner@pidgin.im>
parents:
13235
diff
changeset
|
463 | ByteStream hdrbs; |
| 13235 | 464 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
465 | if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM))) |
| 13235 | 466 | return -EINVAL; |
| 467 | ||
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
468 | if (!bn || !msg || !roomname) |
| 13235 | 469 | return -EINVAL; |
| 470 | ||
| 471 | aim_icbm_makecookie(cookie); | |
| 472 | ||
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
473 | byte_stream_new(&bs, 1142+strlen(bn)+strlen(roomname)+strlen(msg)); |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
474 | |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
475 | snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, bn, strlen(bn)+1); |
| 13235 | 476 | |
| 477 | /* XXX should be uncached by an unwritten 'invite accept' handler */ | |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
478 | priv = g_malloc(sizeof(struct aim_invite_priv)); |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
479 | priv->bn = g_strdup(bn); |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
480 | priv->roomname = g_strdup(roomname); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
481 | priv->exchange = exchange; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
482 | priv->instance = instance; |
| 13235 | 483 | |
| 484 | if ((msgcookie = aim_mkcookie(cookie, AIM_COOKIETYPE_INVITE, priv))) | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
485 | aim_cachecookie(od, msgcookie); |
| 13235 | 486 | else |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
487 | g_free(priv); |
| 13235 | 488 | |
| 489 | /* ICBM Header */ | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
490 | aim_im_puticbm(&bs, cookie, 0x0002, bn); |
| 13235 | 491 | |
| 492 | /* | |
| 493 | * TLV t(0005) | |
| 494 | * | |
| 495 | * Everything else is inside this TLV. | |
| 496 | * | |
| 497 | * Sigh. AOL was rather inconsistent right here. So we have | |
| 498 | * to play some minor tricks. Right inside the type 5 is some | |
| 499 | * raw data, followed by a series of TLVs. | |
| 500 | * | |
| 501 | */ | |
|
15151
bb985812fefa
[gaim-migrate @ 17875]
Mark Doliner <markdoliner@pidgin.im>
parents:
15150
diff
changeset
|
502 | byte_stream_new(&hdrbs, 2+8+16+6+4+4+strlen(msg)+4+2+1+strlen(roomname)+2); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
503 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
504 | byte_stream_put16(&hdrbs, 0x0000); /* Unknown! */ |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
505 | byte_stream_putraw(&hdrbs, cookie, sizeof(cookie)); /* I think... */ |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
506 | byte_stream_putcaps(&hdrbs, OSCAR_CAPABILITY_CHAT); |
| 13235 | 507 | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
508 | aim_tlvlist_add_16(&inner_tlvlist, 0x000a, 0x0001); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
509 | aim_tlvlist_add_noval(&inner_tlvlist, 0x000f); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
510 | aim_tlvlist_add_str(&inner_tlvlist, 0x000c, msg); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
511 | aim_tlvlist_add_chatroom(&inner_tlvlist, 0x2711, exchange, roomname, instance); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
512 | aim_tlvlist_write(&hdrbs, &inner_tlvlist); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
513 | |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
514 | aim_tlvlist_add_raw(&outer_tlvlist, 0x0005, byte_stream_curpos(&hdrbs), hdrbs.data); |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
515 | byte_stream_destroy(&hdrbs); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
516 | |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
517 | aim_tlvlist_write(&bs, &outer_tlvlist); |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
518 | |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
519 | aim_tlvlist_free(inner_tlvlist); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
520 | aim_tlvlist_free(outer_tlvlist); |
| 13235 | 521 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
522 | flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs); |
|
23004
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22862
diff
changeset
|
523 | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
524 | byte_stream_destroy(&bs); |
| 13235 | 525 | |
| 526 | return 0; | |
| 527 | } | |
| 528 | ||
| 529 | /** | |
| 530 | * Subtype 0x0006 - Send your icon to a given user. | |
| 531 | * | |
| 532 | * This is also performance sensitive. (If you can believe it...) | |
| 533 | * | |
| 534 | */ | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
535 | int aim_im_sendch2_icon(OscarData *od, const char *bn, const guint8 *icon, int iconlen, time_t stamp, guint16 iconsum) |
| 13235 | 536 | { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
537 | FlapConnection *conn; |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
538 | ByteStream bs; |
| 13235 | 539 | aim_snacid_t snacid; |
| 540 | guchar cookie[8]; | |
| 541 | ||
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
542 | if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM))) |
| 13235 | 543 | return -EINVAL; |
| 544 | ||
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
545 | if (!bn || !icon || (iconlen <= 0) || (iconlen >= MAXICONLEN)) |
| 13235 | 546 | return -EINVAL; |
| 547 | ||
| 548 | aim_icbm_makecookie(cookie); | |
| 549 | ||
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
550 | byte_stream_new(&bs, 8+2+1+strlen(bn)+2+2+2+8+16+2+2+2+2+2+2+2+4+4+4+iconlen+strlen(AIM_ICONIDENT)+2+2); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
551 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
552 | snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0); |
| 13235 | 553 | |
| 554 | /* ICBM header */ | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
555 | aim_im_puticbm(&bs, cookie, 0x0002, bn); |
| 13235 | 556 | |
| 557 | /* | |
| 558 | * TLV t(0005) | |
| 559 | * | |
| 560 | * Encompasses everything below. | |
| 561 | */ | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
562 | byte_stream_put16(&bs, 0x0005); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
563 | byte_stream_put16(&bs, 2+8+16+6+4+4+iconlen+4+4+4+strlen(AIM_ICONIDENT)); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
564 | |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
565 | byte_stream_put16(&bs, 0x0000); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
566 | byte_stream_putraw(&bs, cookie, 8); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
567 | byte_stream_putcaps(&bs, OSCAR_CAPABILITY_BUDDYICON); |
| 13235 | 568 | |
| 569 | /* TLV t(000a) */ | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
570 | byte_stream_put16(&bs, 0x000a); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
571 | byte_stream_put16(&bs, 0x0002); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
572 | byte_stream_put16(&bs, 0x0001); |
| 13235 | 573 | |
| 574 | /* TLV t(000f) */ | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
575 | byte_stream_put16(&bs, 0x000f); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
576 | byte_stream_put16(&bs, 0x0000); |
| 13235 | 577 | |
| 578 | /* TLV t(2711) */ | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
579 | byte_stream_put16(&bs, 0x2711); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
580 | byte_stream_put16(&bs, 4+4+4+iconlen+strlen(AIM_ICONIDENT)); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
581 | byte_stream_put16(&bs, 0x0000); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
582 | byte_stream_put16(&bs, iconsum); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
583 | byte_stream_put32(&bs, iconlen); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
584 | byte_stream_put32(&bs, stamp); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
585 | byte_stream_putraw(&bs, icon, iconlen); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
586 | byte_stream_putstr(&bs, AIM_ICONIDENT); |
| 13235 | 587 | |
| 588 | /* TLV t(0003) */ | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
589 | byte_stream_put16(&bs, 0x0003); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
590 | byte_stream_put16(&bs, 0x0000); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
591 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
592 | flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs); |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
593 | |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
594 | byte_stream_destroy(&bs); |
|
23004
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22862
diff
changeset
|
595 | |
| 13235 | 596 | return 0; |
| 597 | } | |
| 598 | ||
| 599 | /* | |
| 600 | * Subtype 0x0006 - Send a rich text message. | |
| 601 | * | |
| 602 | * This only works for ICQ 2001b (thats 2001 not 2000). Better, only | |
| 603 | * send it to clients advertising the RTF capability. In fact, if you send | |
| 604 | * it to a client that doesn't support that capability, the server will gladly | |
| 605 | * bounce it back to you. | |
| 606 | * | |
| 607 | * You'd think this would be in icq.c, but, well, I'm trying to stick with | |
| 608 | * the one-group-per-file scheme as much as possible. This could easily | |
| 609 | * be an exception, since Rendezvous IMs are external of the Oscar core, | |
| 610 | * and therefore are undefined. Really I just need to think of a good way to | |
| 611 | * make an interface similar to what AOL actually uses. But I'm not using COM. | |
| 612 | * | |
| 613 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
614 | int aim_im_sendch2_rtfmsg(OscarData *od, struct aim_sendrtfmsg_args *args) |
| 13235 | 615 | { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
616 | FlapConnection *conn; |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
617 | ByteStream bs; |
| 13235 | 618 | aim_snacid_t snacid; |
| 619 | guchar cookie[8]; | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
620 | const char rtfcap[] = {"{97B12751-243C-4334-AD22-D6ABF73F1492}"}; /* OSCAR_CAPABILITY_ICQRTF capability in string form */ |
| 13235 | 621 | int servdatalen; |
| 622 | ||
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
623 | if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM))) |
| 13235 | 624 | return -EINVAL; |
| 625 | ||
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
626 | if (!args || !args->destbn || !args->rtfmsg) |
| 13235 | 627 | return -EINVAL; |
| 628 | ||
| 629 | servdatalen = 2+2+16+2+4+1+2 + 2+2+4+4+4 + 2+4+2+strlen(args->rtfmsg)+1 + 4+4+4+strlen(rtfcap)+1; | |
| 630 | ||
| 631 | aim_icbm_makecookie(cookie); | |
| 632 | ||
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
633 | byte_stream_new(&bs, 128+servdatalen); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
634 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
635 | snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0); |
| 13235 | 636 | |
| 637 | /* ICBM header */ | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
638 | aim_im_puticbm(&bs, cookie, 0x0002, args->destbn); |
| 13235 | 639 | |
| 640 | /* TLV t(0005) - Encompasses everything below. */ | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
641 | byte_stream_put16(&bs, 0x0005); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
642 | byte_stream_put16(&bs, 2+8+16 + 2+2+2 + 2+2 + 2+2+servdatalen); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
643 | |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
644 | byte_stream_put16(&bs, 0x0000); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
645 | byte_stream_putraw(&bs, cookie, 8); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
646 | byte_stream_putcaps(&bs, OSCAR_CAPABILITY_ICQSERVERRELAY); |
| 13235 | 647 | |
| 648 | /* t(000a) l(0002) v(0001) */ | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
649 | byte_stream_put16(&bs, 0x000a); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
650 | byte_stream_put16(&bs, 0x0002); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
651 | byte_stream_put16(&bs, 0x0001); |
| 13235 | 652 | |
| 653 | /* t(000f) l(0000) v() */ | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
654 | byte_stream_put16(&bs, 0x000f); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
655 | byte_stream_put16(&bs, 0x0000); |
| 13235 | 656 | |
| 657 | /* Service Data TLV */ | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
658 | byte_stream_put16(&bs, 0x2711); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
659 | byte_stream_put16(&bs, servdatalen); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
660 | |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
661 | byte_stream_putle16(&bs, 11 + 16 /* 11 + (sizeof CLSID) */); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
662 | byte_stream_putle16(&bs, 9); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
663 | byte_stream_putcaps(&bs, OSCAR_CAPABILITY_EMPTY); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
664 | byte_stream_putle16(&bs, 0); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
665 | byte_stream_putle32(&bs, 0); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
666 | byte_stream_putle8(&bs, 0); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
667 | byte_stream_putle16(&bs, 0x03ea); /* trid1 */ |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
668 | |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
669 | byte_stream_putle16(&bs, 14); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
670 | byte_stream_putle16(&bs, 0x03eb); /* trid2 */ |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
671 | byte_stream_putle32(&bs, 0); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
672 | byte_stream_putle32(&bs, 0); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
673 | byte_stream_putle32(&bs, 0); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
674 | |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
675 | byte_stream_putle16(&bs, 0x0001); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
676 | byte_stream_putle32(&bs, 0); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
677 | byte_stream_putle16(&bs, strlen(args->rtfmsg)+1); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
678 | byte_stream_putraw(&bs, (const guint8 *)args->rtfmsg, strlen(args->rtfmsg)+1); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
679 | |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
680 | byte_stream_putle32(&bs, args->fgcolor); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
681 | byte_stream_putle32(&bs, args->bgcolor); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
682 | byte_stream_putle32(&bs, strlen(rtfcap)+1); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
683 | byte_stream_putraw(&bs, (const guint8 *)rtfcap, strlen(rtfcap)+1); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
684 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
685 | flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs); |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
686 | |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
687 | byte_stream_destroy(&bs); |
|
23004
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22862
diff
changeset
|
688 | |
| 13235 | 689 | return 0; |
| 690 | } | |
| 691 | ||
| 692 | /** | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
693 | * Cancel a rendezvous invitation. It could be an invitation to |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
694 | * establish a direct connection, or a file-send, or a chat invite. |
| 13235 | 695 | */ |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
696 | void |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
697 | aim_im_sendch2_cancel(PeerConnection *peer_conn) |
| 13235 | 698 | { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
699 | OscarData *od; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
700 | FlapConnection *conn; |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
701 | ByteStream bs; |
| 13235 | 702 | aim_snacid_t snacid; |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
703 | GSList *outer_tlvlist = NULL, *inner_tlvlist = NULL; |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
704 | ByteStream hdrbs; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
705 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
706 | od = peer_conn->od; |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
707 | conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
708 | if (conn == NULL) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
709 | return; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
710 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
711 | byte_stream_new(&bs, 118+strlen(peer_conn->bn)); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
712 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
713 | snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
714 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
715 | /* ICBM header */ |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
716 | aim_im_puticbm(&bs, peer_conn->cookie, 0x0002, peer_conn->bn); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
717 | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
718 | aim_tlvlist_add_noval(&outer_tlvlist, 0x0003); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
719 | |
|
15151
bb985812fefa
[gaim-migrate @ 17875]
Mark Doliner <markdoliner@pidgin.im>
parents:
15150
diff
changeset
|
720 | byte_stream_new(&hdrbs, 64); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
721 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
722 | byte_stream_put16(&hdrbs, AIM_RENDEZVOUS_CANCEL); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
723 | byte_stream_putraw(&hdrbs, peer_conn->cookie, 8); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
724 | byte_stream_putcaps(&hdrbs, peer_conn->type); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
725 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
726 | /* This TLV means "cancel!" */ |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
727 | aim_tlvlist_add_16(&inner_tlvlist, 0x000b, 0x0001); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
728 | aim_tlvlist_write(&hdrbs, &inner_tlvlist); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
729 | |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
730 | aim_tlvlist_add_raw(&outer_tlvlist, 0x0005, byte_stream_curpos(&hdrbs), hdrbs.data); |
|
23004
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22862
diff
changeset
|
731 | byte_stream_destroy(&hdrbs); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
732 | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
733 | aim_tlvlist_write(&bs, &outer_tlvlist); |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
734 | |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
735 | aim_tlvlist_free(inner_tlvlist); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
736 | aim_tlvlist_free(outer_tlvlist); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
737 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
738 | flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs); |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
739 | |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
740 | byte_stream_destroy(&bs); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
741 | } |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
742 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
743 | /** |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
744 | * Subtype 0x0006 - Send an "I accept and I've connected to |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
745 | * you" message. |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
746 | */ |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
747 | void |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
748 | aim_im_sendch2_connected(PeerConnection *peer_conn) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
749 | { |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
750 | OscarData *od; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
751 | FlapConnection *conn; |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
752 | ByteStream bs; |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
753 | aim_snacid_t snacid; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
754 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
755 | od = peer_conn->od; |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
756 | conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
757 | if (conn == NULL) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
758 | return; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
759 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
760 | byte_stream_new(&bs, 11+strlen(peer_conn->bn) + 4+2+8+16); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
761 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
762 | snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
763 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
764 | /* ICBM header */ |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
765 | aim_im_puticbm(&bs, peer_conn->cookie, 0x0002, peer_conn->bn); |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
766 | |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
767 | byte_stream_put16(&bs, 0x0005); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
768 | byte_stream_put16(&bs, 0x001a); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
769 | byte_stream_put16(&bs, AIM_RENDEZVOUS_CONNECTED); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
770 | byte_stream_putraw(&bs, peer_conn->cookie, 8); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
771 | byte_stream_putcaps(&bs, peer_conn->type); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
772 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
773 | flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs); |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
774 | |
|
23004
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22862
diff
changeset
|
775 | byte_stream_destroy(&bs); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
776 | } |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
777 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
778 | /** |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
779 | * Subtype 0x0006 - Send a direct connect rendezvous ICBM. This |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
780 | * could have a number of meanings, depending on the content: |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
781 | * "I want you to connect to me" |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
782 | * "I want to connect to you" |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
783 | * "I want to connect through a proxy server" |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
784 | */ |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
785 | void |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
786 | aim_im_sendch2_odc_requestdirect(OscarData *od, guchar *cookie, const char *bn, const guint8 *ip, guint16 port, guint16 requestnumber) |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
787 | { |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
788 | FlapConnection *conn; |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
789 | ByteStream bs; |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
790 | aim_snacid_t snacid; |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
791 | GSList *outer_tlvlist = NULL, *inner_tlvlist = NULL; |
|
13240
db5187cc40d1
[gaim-migrate @ 15605]
Mark Doliner <markdoliner@pidgin.im>
parents:
13235
diff
changeset
|
792 | ByteStream hdrbs; |
| 13235 | 793 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
794 | conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
795 | if (conn == NULL) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
796 | return; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
797 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
798 | byte_stream_new(&bs, 246+strlen(bn)); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
799 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
800 | snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0); |
| 13235 | 801 | |
| 802 | /* ICBM header */ | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
803 | aim_im_puticbm(&bs, cookie, 0x0002, bn); |
| 13235 | 804 | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
805 | aim_tlvlist_add_noval(&outer_tlvlist, 0x0003); |
| 13235 | 806 | |
|
15151
bb985812fefa
[gaim-migrate @ 17875]
Mark Doliner <markdoliner@pidgin.im>
parents:
15150
diff
changeset
|
807 | byte_stream_new(&hdrbs, 128); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
808 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
809 | byte_stream_put16(&hdrbs, AIM_RENDEZVOUS_PROPOSE); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
810 | byte_stream_putraw(&hdrbs, cookie, 8); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
811 | byte_stream_putcaps(&hdrbs, OSCAR_CAPABILITY_DIRECTIM); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
812 | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
813 | aim_tlvlist_add_raw(&inner_tlvlist, 0x0002, 4, ip); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
814 | aim_tlvlist_add_raw(&inner_tlvlist, 0x0003, 4, ip); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
815 | aim_tlvlist_add_16(&inner_tlvlist, 0x0005, port); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
816 | aim_tlvlist_add_16(&inner_tlvlist, 0x000a, requestnumber); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
817 | aim_tlvlist_add_noval(&inner_tlvlist, 0x000f); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
818 | aim_tlvlist_write(&hdrbs, &inner_tlvlist); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
819 | |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
820 | aim_tlvlist_add_raw(&outer_tlvlist, 0x0005, byte_stream_curpos(&hdrbs), hdrbs.data); |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
821 | byte_stream_destroy(&hdrbs); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
822 | |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
823 | aim_tlvlist_write(&bs, &outer_tlvlist); |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
824 | |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
825 | aim_tlvlist_free(inner_tlvlist); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
826 | aim_tlvlist_free(outer_tlvlist); |
| 13235 | 827 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
828 | flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs); |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
829 | |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
830 | byte_stream_destroy(&bs); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
831 | } |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
832 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
833 | /** |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
834 | * Subtype 0x0006 - Send a direct connect rendezvous ICBM asking the |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
835 | * remote user to connect to us via a proxy server. |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
836 | */ |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
837 | void |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
838 | aim_im_sendch2_odc_requestproxy(OscarData *od, guchar *cookie, const char *bn, const guint8 *ip, guint16 pin, guint16 requestnumber) |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
839 | { |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
840 | FlapConnection *conn; |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
841 | ByteStream bs; |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
842 | aim_snacid_t snacid; |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
843 | GSList *outer_tlvlist = NULL, *inner_tlvlist = NULL; |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
844 | ByteStream hdrbs; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
845 | guint8 ip_comp[4]; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
846 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
847 | conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
848 | if (conn == NULL) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
849 | return; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
850 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
851 | byte_stream_new(&bs, 246+strlen(bn)); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
852 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
853 | snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
854 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
855 | /* ICBM header */ |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
856 | aim_im_puticbm(&bs, cookie, 0x0002, bn); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
857 | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
858 | aim_tlvlist_add_noval(&outer_tlvlist, 0x0003); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
859 | |
|
15151
bb985812fefa
[gaim-migrate @ 17875]
Mark Doliner <markdoliner@pidgin.im>
parents:
15150
diff
changeset
|
860 | byte_stream_new(&hdrbs, 128); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
861 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
862 | byte_stream_put16(&hdrbs, AIM_RENDEZVOUS_PROPOSE); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
863 | byte_stream_putraw(&hdrbs, cookie, 8); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
864 | byte_stream_putcaps(&hdrbs, OSCAR_CAPABILITY_DIRECTIM); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
865 | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
866 | aim_tlvlist_add_raw(&inner_tlvlist, 0x0002, 4, ip); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
867 | aim_tlvlist_add_raw(&inner_tlvlist, 0x0003, 4, ip); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
868 | aim_tlvlist_add_16(&inner_tlvlist, 0x0005, pin); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
869 | aim_tlvlist_add_16(&inner_tlvlist, 0x000a, requestnumber); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
870 | aim_tlvlist_add_noval(&inner_tlvlist, 0x000f); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
871 | aim_tlvlist_add_noval(&inner_tlvlist, 0x0010); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
872 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
873 | /* Send the bitwise complement of the port and ip. As a check? */ |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
874 | ip_comp[0] = ~ip[0]; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
875 | ip_comp[1] = ~ip[1]; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
876 | ip_comp[2] = ~ip[2]; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
877 | ip_comp[3] = ~ip[3]; |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
878 | aim_tlvlist_add_raw(&inner_tlvlist, 0x0016, 4, ip_comp); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
879 | aim_tlvlist_add_16(&inner_tlvlist, 0x0017, ~pin); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
880 | |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
881 | aim_tlvlist_write(&hdrbs, &inner_tlvlist); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
882 | |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
883 | aim_tlvlist_add_raw(&outer_tlvlist, 0x0005, byte_stream_curpos(&hdrbs), hdrbs.data); |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
884 | byte_stream_destroy(&hdrbs); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
885 | |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
886 | aim_tlvlist_write(&bs, &outer_tlvlist); |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
887 | |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
888 | aim_tlvlist_free(inner_tlvlist); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
889 | aim_tlvlist_free(outer_tlvlist); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
890 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
891 | flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs); |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
892 | |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
893 | byte_stream_destroy(&bs); |
| 13235 | 894 | } |
| 895 | ||
| 896 | /** | |
| 897 | * Subtype 0x0006 - Send an "I want to send you this file" message | |
| 898 | * | |
| 899 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
900 | void |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
901 | aim_im_sendch2_sendfile_requestdirect(OscarData *od, guchar *cookie, const char *bn, const guint8 *ip, guint16 port, guint16 requestnumber, const gchar *filename, guint32 size, guint16 numfiles) |
| 13235 | 902 | { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
903 | FlapConnection *conn; |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
904 | ByteStream bs; |
| 13235 | 905 | aim_snacid_t snacid; |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
906 | GSList *outer_tlvlist = NULL, *inner_tlvlist = NULL; |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
907 | ByteStream hdrbs; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
908 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
909 | conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
910 | if (conn == NULL) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
911 | return; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
912 | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
913 | byte_stream_new(&bs, 1014); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
914 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
915 | snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0); |
| 13235 | 916 | |
| 917 | /* ICBM header */ | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
918 | aim_im_puticbm(&bs, cookie, 0x0002, bn); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
919 | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
920 | aim_tlvlist_add_noval(&outer_tlvlist, 0x0003); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
921 | |
|
15151
bb985812fefa
[gaim-migrate @ 17875]
Mark Doliner <markdoliner@pidgin.im>
parents:
15150
diff
changeset
|
922 | byte_stream_new(&hdrbs, 512); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
923 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
924 | byte_stream_put16(&hdrbs, AIM_RENDEZVOUS_PROPOSE); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
925 | byte_stream_putraw(&hdrbs, cookie, 8); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
926 | byte_stream_putcaps(&hdrbs, OSCAR_CAPABILITY_SENDFILE); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
927 | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
928 | aim_tlvlist_add_raw(&inner_tlvlist, 0x0002, 4, ip); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
929 | aim_tlvlist_add_raw(&inner_tlvlist, 0x0003, 4, ip); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
930 | aim_tlvlist_add_16(&inner_tlvlist, 0x0005, port); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
931 | aim_tlvlist_add_16(&inner_tlvlist, 0x000a, requestnumber); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
932 | aim_tlvlist_add_noval(&inner_tlvlist, 0x000f); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
933 | /* TODO: Send 0x0016 and 0x0017 */ |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
934 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
935 | #if 0 |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
936 | /* TODO: If the following is ever enabled, ensure that it is |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
937 | * not sent with a receive redirect or stage 3 proxy |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
938 | * redirect for a file receive (same conditions for |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
939 | * sending 0x000f above) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
940 | */ |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
941 | aim_tlvlist_add_raw(&inner_tlvlist, 0x000e, 2, "en"); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
942 | aim_tlvlist_add_raw(&inner_tlvlist, 0x000d, 8, "us-ascii"); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
943 | aim_tlvlist_add_raw(&inner_tlvlist, 0x000c, 24, "Please accept this file."); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
944 | #endif |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
945 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
946 | if (filename != NULL) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
947 | { |
|
23004
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22862
diff
changeset
|
948 | ByteStream inner_bs; |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
949 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
950 | /* Begin TLV t(2711) */ |
|
23004
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22862
diff
changeset
|
951 | byte_stream_new(&inner_bs, 2+2+4+strlen(filename)+1); |
|
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22862
diff
changeset
|
952 | byte_stream_put16(&inner_bs, (numfiles > 1) ? 0x0002 : 0x0001); |
|
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22862
diff
changeset
|
953 | byte_stream_put16(&inner_bs, numfiles); |
|
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22862
diff
changeset
|
954 | byte_stream_put32(&inner_bs, size); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
955 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
956 | /* Filename - NULL terminated, for some odd reason */ |
|
23004
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22862
diff
changeset
|
957 | byte_stream_putstr(&inner_bs, filename); |
|
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22862
diff
changeset
|
958 | byte_stream_put8(&inner_bs, 0x00); |
|
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22862
diff
changeset
|
959 | |
|
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22862
diff
changeset
|
960 | aim_tlvlist_add_raw(&inner_tlvlist, 0x2711, inner_bs.len, inner_bs.data); |
|
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22862
diff
changeset
|
961 | byte_stream_destroy(&inner_bs); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
962 | /* End TLV t(2711) */ |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
963 | } |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
964 | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
965 | aim_tlvlist_write(&hdrbs, &inner_tlvlist); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
966 | aim_tlvlist_add_raw(&outer_tlvlist, 0x0005, byte_stream_curpos(&hdrbs), hdrbs.data); |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
967 | byte_stream_destroy(&hdrbs); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
968 | |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
969 | aim_tlvlist_write(&bs, &outer_tlvlist); |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
970 | |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
971 | aim_tlvlist_free(inner_tlvlist); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
972 | aim_tlvlist_free(outer_tlvlist); |
| 13235 | 973 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
974 | flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs); |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
975 | |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
976 | byte_stream_destroy(&bs); |
| 13235 | 977 | } |
| 978 | ||
| 979 | /** | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
980 | * Subtype 0x0006 - Send a sendfile connect rendezvous ICBM asking the |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
981 | * remote user to connect to us via a proxy server. |
| 13235 | 982 | */ |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
983 | void |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
984 | aim_im_sendch2_sendfile_requestproxy(OscarData *od, guchar *cookie, const char *bn, const guint8 *ip, guint16 pin, guint16 requestnumber, const gchar *filename, guint32 size, guint16 numfiles) |
| 13235 | 985 | { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
986 | FlapConnection *conn; |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
987 | ByteStream bs; |
| 13235 | 988 | aim_snacid_t snacid; |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
989 | GSList *outer_tlvlist = NULL, *inner_tlvlist = NULL; |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
990 | ByteStream hdrbs; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
991 | guint8 ip_comp[4]; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
992 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
993 | conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
994 | if (conn == NULL) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
995 | return; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
996 | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
997 | byte_stream_new(&bs, 1014); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
998 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
999 | snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0); |
| 13235 | 1000 | |
| 1001 | /* ICBM header */ | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
1002 | aim_im_puticbm(&bs, cookie, 0x0002, bn); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1003 | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1004 | aim_tlvlist_add_noval(&outer_tlvlist, 0x0003); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1005 | |
|
15151
bb985812fefa
[gaim-migrate @ 17875]
Mark Doliner <markdoliner@pidgin.im>
parents:
15150
diff
changeset
|
1006 | byte_stream_new(&hdrbs, 512); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1007 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1008 | byte_stream_put16(&hdrbs, AIM_RENDEZVOUS_PROPOSE); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1009 | byte_stream_putraw(&hdrbs, cookie, 8); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1010 | byte_stream_putcaps(&hdrbs, OSCAR_CAPABILITY_SENDFILE); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1011 | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1012 | aim_tlvlist_add_raw(&inner_tlvlist, 0x0002, 4, ip); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1013 | aim_tlvlist_add_raw(&inner_tlvlist, 0x0003, 4, ip); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1014 | aim_tlvlist_add_16(&inner_tlvlist, 0x0005, pin); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1015 | aim_tlvlist_add_16(&inner_tlvlist, 0x000a, requestnumber); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1016 | aim_tlvlist_add_noval(&inner_tlvlist, 0x000f); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1017 | aim_tlvlist_add_noval(&inner_tlvlist, 0x0010); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1018 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1019 | /* Send the bitwise complement of the port and ip. As a check? */ |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1020 | ip_comp[0] = ~ip[0]; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1021 | ip_comp[1] = ~ip[1]; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1022 | ip_comp[2] = ~ip[2]; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1023 | ip_comp[3] = ~ip[3]; |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1024 | aim_tlvlist_add_raw(&inner_tlvlist, 0x0016, 4, ip_comp); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1025 | aim_tlvlist_add_16(&inner_tlvlist, 0x0017, ~pin); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1026 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1027 | #if 0 |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1028 | /* TODO: If the following is ever enabled, ensure that it is |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1029 | * not sent with a receive redirect or stage 3 proxy |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1030 | * redirect for a file receive (same conditions for |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1031 | * sending 0x000f above) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1032 | */ |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1033 | aim_tlvlist_add_raw(&inner_tlvlist, 0x000e, 2, "en"); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1034 | aim_tlvlist_add_raw(&inner_tlvlist, 0x000d, 8, "us-ascii"); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1035 | aim_tlvlist_add_raw(&inner_tlvlist, 0x000c, 24, "Please accept this file."); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1036 | #endif |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1037 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1038 | if (filename != NULL) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1039 | { |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1040 | ByteStream filename_bs; |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1041 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1042 | /* Begin TLV t(2711) */ |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1043 | byte_stream_new(&filename_bs, 2+2+4+strlen(filename)+1); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1044 | byte_stream_put16(&filename_bs, (numfiles > 1) ? 0x0002 : 0x0001); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1045 | byte_stream_put16(&filename_bs, numfiles); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1046 | byte_stream_put32(&filename_bs, size); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1047 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1048 | /* Filename - NULL terminated, for some odd reason */ |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1049 | byte_stream_putstr(&filename_bs, filename); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1050 | byte_stream_put8(&filename_bs, 0x00); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1051 | |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1052 | aim_tlvlist_add_raw(&inner_tlvlist, 0x2711, filename_bs.len, filename_bs.data); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1053 | byte_stream_destroy(&filename_bs); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1054 | /* End TLV t(2711) */ |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1055 | } |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1056 | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1057 | aim_tlvlist_write(&hdrbs, &inner_tlvlist); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1058 | |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1059 | aim_tlvlist_add_raw(&outer_tlvlist, 0x0005, byte_stream_curpos(&hdrbs), hdrbs.data); |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1060 | byte_stream_destroy(&hdrbs); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1061 | |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1062 | aim_tlvlist_write(&bs, &outer_tlvlist); |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1063 | |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1064 | aim_tlvlist_free(inner_tlvlist); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1065 | aim_tlvlist_free(outer_tlvlist); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1066 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
1067 | flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs); |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1068 | |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1069 | byte_stream_destroy(&bs); |
| 13235 | 1070 | } |
| 1071 | ||
| 1072 | /** | |
| 1073 | * Subtype 0x0006 - Request the status message of the given ICQ user. | |
| 1074 | * | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1075 | * @param od The oscar session. |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
1076 | * @param bn The UIN of the user of whom you wish to request info. |
| 13235 | 1077 | * @param type The type of info you wish to request. This should be the current |
| 1078 | * state of the user, as one of the AIM_ICQ_STATE_* defines. | |
| 1079 | * @return Return 0 if no errors, otherwise return the error number. | |
| 1080 | */ | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
1081 | int aim_im_sendch2_geticqaway(OscarData *od, const char *bn, int type) |
| 13235 | 1082 | { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1083 | FlapConnection *conn; |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1084 | ByteStream bs; |
| 13235 | 1085 | aim_snacid_t snacid; |
| 1086 | guchar cookie[8]; | |
| 1087 | ||
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
1088 | if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM)) || !bn) |
| 13235 | 1089 | return -EINVAL; |
| 1090 | ||
| 1091 | aim_icbm_makecookie(cookie); | |
| 1092 | ||
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
1093 | byte_stream_new(&bs, 8+2+1+strlen(bn) + 4+0x5e + 4); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1094 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
1095 | snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0); |
| 13235 | 1096 | |
| 1097 | /* ICBM header */ | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
1098 | aim_im_puticbm(&bs, cookie, 0x0002, bn); |
| 13235 | 1099 | |
| 1100 | /* TLV t(0005) - Encompasses almost everything below. */ | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1101 | byte_stream_put16(&bs, 0x0005); /* T */ |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1102 | byte_stream_put16(&bs, 0x005e); /* L */ |
| 13235 | 1103 | { /* V */ |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1104 | byte_stream_put16(&bs, 0x0000); |
| 13235 | 1105 | |
| 1106 | /* Cookie */ | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1107 | byte_stream_putraw(&bs, cookie, 8); |
| 13235 | 1108 | |
| 1109 | /* Put the 16 byte server relay capability */ | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1110 | byte_stream_putcaps(&bs, OSCAR_CAPABILITY_ICQSERVERRELAY); |
| 13235 | 1111 | |
| 1112 | /* TLV t(000a) */ | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1113 | byte_stream_put16(&bs, 0x000a); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1114 | byte_stream_put16(&bs, 0x0002); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1115 | byte_stream_put16(&bs, 0x0001); |
| 13235 | 1116 | |
| 1117 | /* TLV t(000f) */ | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1118 | byte_stream_put16(&bs, 0x000f); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1119 | byte_stream_put16(&bs, 0x0000); |
| 13235 | 1120 | |
| 1121 | /* TLV t(2711) */ | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1122 | byte_stream_put16(&bs, 0x2711); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1123 | byte_stream_put16(&bs, 0x0036); |
| 13235 | 1124 | { /* V */ |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1125 | byte_stream_putle16(&bs, 0x001b); /* L */ |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1126 | byte_stream_putle16(&bs, 0x0009); /* Protocol version */ |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1127 | byte_stream_putcaps(&bs, OSCAR_CAPABILITY_EMPTY); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1128 | byte_stream_putle16(&bs, 0x0000); /* Unknown */ |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1129 | byte_stream_putle16(&bs, 0x0001); /* Client features? */ |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1130 | byte_stream_putle16(&bs, 0x0000); /* Unknown */ |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1131 | byte_stream_putle8(&bs, 0x00); /* Unkizown */ |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1132 | byte_stream_putle16(&bs, 0xffff); /* Sequence number? XXX - This should decrement by 1 with each request */ |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1133 | |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1134 | byte_stream_putle16(&bs, 0x000e); /* L */ |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1135 | byte_stream_putle16(&bs, 0xffff); /* Sequence number? XXX - This should decrement by 1 with each request */ |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1136 | byte_stream_putle32(&bs, 0x00000000); /* Unknown */ |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1137 | byte_stream_putle32(&bs, 0x00000000); /* Unknown */ |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1138 | byte_stream_putle32(&bs, 0x00000000); /* Unknown */ |
| 13235 | 1139 | |
| 1140 | /* The type of status message being requested */ | |
| 1141 | if (type & AIM_ICQ_STATE_CHAT) | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1142 | byte_stream_putle16(&bs, 0x03ec); |
| 13235 | 1143 | else if(type & AIM_ICQ_STATE_DND) |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1144 | byte_stream_putle16(&bs, 0x03eb); |
| 13235 | 1145 | else if(type & AIM_ICQ_STATE_OUT) |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1146 | byte_stream_putle16(&bs, 0x03ea); |
| 13235 | 1147 | else if(type & AIM_ICQ_STATE_BUSY) |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1148 | byte_stream_putle16(&bs, 0x03e9); |
| 13235 | 1149 | else if(type & AIM_ICQ_STATE_AWAY) |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1150 | byte_stream_putle16(&bs, 0x03e8); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1151 | |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1152 | byte_stream_putle16(&bs, 0x0001); /* Status? */ |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1153 | byte_stream_putle16(&bs, 0x0001); /* Priority of this message? */ |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1154 | byte_stream_putle16(&bs, 0x0001); /* L */ |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1155 | byte_stream_putle8(&bs, 0x00); /* String of length L */ |
| 13235 | 1156 | } /* End TLV t(2711) */ |
| 1157 | } /* End TLV t(0005) */ | |
| 1158 | ||
| 1159 | /* TLV t(0003) */ | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1160 | byte_stream_put16(&bs, 0x0003); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1161 | byte_stream_put16(&bs, 0x0000); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1162 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
1163 | flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs); |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1164 | |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1165 | byte_stream_destroy(&bs); |
|
23004
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22862
diff
changeset
|
1166 | |
| 13235 | 1167 | return 0; |
| 1168 | } | |
| 1169 | ||
| 1170 | /** | |
| 1171 | * Subtype 0x0006 - Send an ICQ-esque ICBM. | |
| 1172 | * | |
| 1173 | * This can be used to send an ICQ authorization reply (deny or grant). It is the "old way." | |
| 1174 | * The new way is to use SSI. I like the new way a lot better. This seems like such a hack, | |
| 1175 | * mostly because it's in network byte order. Figuring this stuff out sometimes takes a while, | |
| 1176 | * but thats ok, because it gives me time to try to figure out what kind of drugs the AOL people | |
| 1177 | * were taking when they merged the two protocols. | |
| 1178 | * | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
1179 | * @param bn The destination buddy name. |
| 13235 | 1180 | * @param type The type of message. 0x0007 for authorization denied. 0x0008 for authorization granted. |
| 1181 | * @param message The message you want to send, it should be null terminated. | |
| 1182 | * @return Return 0 if no errors, otherwise return the error number. | |
| 1183 | */ | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
1184 | int aim_im_sendch4(OscarData *od, const char *bn, guint16 type, const char *message) |
| 13235 | 1185 | { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1186 | FlapConnection *conn; |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1187 | ByteStream bs; |
| 13235 | 1188 | aim_snacid_t snacid; |
| 1189 | guchar cookie[8]; | |
| 1190 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1191 | if (!od || !(conn = flap_connection_findbygroup(od, 0x0002))) |
| 13235 | 1192 | return -EINVAL; |
| 1193 | ||
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
1194 | if (!bn || !type || !message) |
| 13235 | 1195 | return -EINVAL; |
| 1196 | ||
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
1197 | byte_stream_new(&bs, 8+3+strlen(bn)+12+strlen(message)+1+4); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1198 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
1199 | snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0); |
| 13235 | 1200 | |
| 1201 | aim_icbm_makecookie(cookie); | |
| 1202 | ||
| 1203 | /* ICBM header */ | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
1204 | aim_im_puticbm(&bs, cookie, 0x0004, bn); |
| 13235 | 1205 | |
| 1206 | /* | |
| 1207 | * TLV t(0005) | |
| 1208 | * | |
| 1209 | * ICQ data (the UIN and the message). | |
| 1210 | */ | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1211 | byte_stream_put16(&bs, 0x0005); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1212 | byte_stream_put16(&bs, 4 + 2+2+strlen(message)+1); |
| 13235 | 1213 | |
| 1214 | /* | |
| 1215 | * Your UIN | |
| 1216 | */ | |
|
25086
fb94ee60a4f2
Minor cleanup: remove od->sn, since it's the same as PurpleAccount->username
Mark Doliner <markdoliner@pidgin.im>
parents:
23456
diff
changeset
|
1217 | byte_stream_putuid(&bs, od); |
| 13235 | 1218 | |
| 1219 | /* | |
| 1220 | * TLV t(type) l(strlen(message)+1) v(message+NULL) | |
| 1221 | */ | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1222 | byte_stream_putle16(&bs, type); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1223 | byte_stream_putle16(&bs, strlen(message)+1); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1224 | byte_stream_putraw(&bs, (const guint8 *)message, strlen(message)+1); |
| 13235 | 1225 | |
| 1226 | /* | |
| 1227 | * TLV t(0006) l(0000) v() | |
| 1228 | */ | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1229 | byte_stream_put16(&bs, 0x0006); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1230 | byte_stream_put16(&bs, 0x0000); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1231 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
1232 | flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs); |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1233 | |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
1234 | byte_stream_destroy(&bs); |
|
23004
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22862
diff
changeset
|
1235 | |
| 13235 | 1236 | return 0; |
| 1237 | } | |
| 1238 | ||
| 1239 | /* | |
| 1240 | * XXX - I don't see when this would ever get called... | |
| 1241 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1242 | static int outgoingim(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
| 13235 | 1243 | { |
| 1244 | int ret = 0; | |
| 1245 | aim_rxcallback_t userfunc; | |
| 1246 | guchar cookie[8]; | |
| 1247 | guint16 channel; | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1248 | GSList *tlvlist; |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
1249 | char *bn; |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
1250 | int bnlen; |
| 13235 | 1251 | guint16 icbmflags = 0; |
| 1252 | guint8 flag1 = 0, flag2 = 0; | |
| 1253 | gchar *msg = NULL; | |
| 1254 | aim_tlv_t *msgblock; | |
| 1255 | ||
| 1256 | /* ICBM Cookie. */ | |
| 1257 | aim_icbm_makecookie(cookie); | |
| 1258 | ||
| 1259 | /* Channel ID */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1260 | channel = byte_stream_get16(bs); |
| 13235 | 1261 | |
| 1262 | if (channel != 0x01) { | |
| 15884 | 1263 | purple_debug_misc("oscar", "icbm: ICBM recieved on unsupported channel. Ignoring. (chan = %04x)\n", channel); |
| 13235 | 1264 | return 0; |
| 1265 | } | |
| 1266 | ||
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
1267 | bnlen = byte_stream_get8(bs); |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
1268 | bn = byte_stream_getstr(bs, bnlen); |
| 13235 | 1269 | |
| 1270 | tlvlist = aim_tlvlist_read(bs); | |
| 1271 | ||
| 1272 | if (aim_tlv_gettlv(tlvlist, 0x0003, 1)) | |
| 1273 | icbmflags |= AIM_IMFLAGS_ACK; | |
| 1274 | if (aim_tlv_gettlv(tlvlist, 0x0004, 1)) | |
| 1275 | icbmflags |= AIM_IMFLAGS_AWAY; | |
| 1276 | ||
| 1277 | if ((msgblock = aim_tlv_gettlv(tlvlist, 0x0002, 1))) { | |
|
13240
db5187cc40d1
[gaim-migrate @ 15605]
Mark Doliner <markdoliner@pidgin.im>
parents:
13235
diff
changeset
|
1278 | ByteStream mbs; |
| 13235 | 1279 | int featurelen, msglen; |
| 1280 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1281 | byte_stream_init(&mbs, msgblock->value, msgblock->length); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1282 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1283 | byte_stream_get8(&mbs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1284 | byte_stream_get8(&mbs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1285 | for (featurelen = byte_stream_get16(&mbs); featurelen; featurelen--) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1286 | byte_stream_get8(&mbs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1287 | byte_stream_get8(&mbs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1288 | byte_stream_get8(&mbs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1289 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1290 | msglen = byte_stream_get16(&mbs) - 4; /* final block length */ |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1291 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1292 | flag1 = byte_stream_get16(&mbs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1293 | flag2 = byte_stream_get16(&mbs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1294 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1295 | msg = byte_stream_getstr(&mbs, msglen); |
| 13235 | 1296 | } |
| 1297 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1298 | if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
1299 | ret = userfunc(od, conn, frame, channel, bn, msg, icbmflags, flag1, flag2); |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
1300 | |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
1301 | g_free(bn); |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
1302 | g_free(msg); |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1303 | aim_tlvlist_free(tlvlist); |
| 13235 | 1304 | |
| 1305 | return ret; | |
| 1306 | } | |
| 1307 | ||
| 1308 | /* | |
| 1309 | * Ahh, the joys of nearly ridiculous over-engineering. | |
| 1310 | * | |
| 1311 | * Not only do AIM ICBM's support multiple channels. Not only do they | |
| 1312 | * support multiple character sets. But they support multiple character | |
| 1313 | * sets / encodings within the same ICBM. | |
| 1314 | * | |
| 1315 | * These multipart messages allow for complex space savings techniques, which | |
| 1316 | * seem utterly unnecessary by today's standards. In fact, there is only | |
| 1317 | * one client still in popular use that still uses this method: AOL for the | |
| 1318 | * Macintosh, Version 5.0. Obscure, yes, I know. | |
| 1319 | * | |
| 1320 | * In modern (non-"legacy") clients, if the user tries to send a character | |
| 1321 | * that is not ISO-8859-1 or ASCII, the client will send the entire message | |
| 1322 | * as UNICODE, meaning that every character in the message will occupy the | |
| 1323 | * full 16 bit UNICODE field, even if the high order byte would be zero. | |
| 1324 | * Multipart messages prevent this wasted space by allowing the client to | |
| 1325 | * only send the characters in UNICODE that need to be sent that way, and | |
| 1326 | * the rest of the message can be sent in whatever the native character | |
| 1327 | * set is (probably ASCII). | |
| 1328 | * | |
| 1329 | * An important note is that sections will be displayed in the order that | |
| 1330 | * they appear in the ICBM. There is no facility for merging or rearranging | |
| 1331 | * sections at run time. So if you have, say, ASCII then UNICODE then ASCII, | |
| 1332 | * you must supply two ASCII sections with a UNICODE in the middle, and incur | |
| 1333 | * the associated overhead. | |
| 1334 | * | |
| 1335 | * Normally I would have laughed and given a firm 'no' to supporting this | |
| 1336 | * seldom-used feature, but something is attracting me to it. In the future, | |
| 1337 | * it may be possible to abuse this to send mixed-media messages to other | |
| 1338 | * open source clients (like encryption or something) -- see faimtest for | |
| 1339 | * examples of how to do this. | |
| 1340 | * | |
| 1341 | * I would definitely recommend avoiding this feature unless you really | |
| 1342 | * know what you are doing, and/or you have something neat to do with it. | |
| 1343 | * | |
| 1344 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1345 | int aim_mpmsg_init(OscarData *od, aim_mpmsg_t *mpm) |
| 13235 | 1346 | { |
| 1347 | ||
| 1348 | memset(mpm, 0, sizeof(aim_mpmsg_t)); | |
| 1349 | ||
| 1350 | return 0; | |
| 1351 | } | |
| 1352 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1353 | static int mpmsg_addsection(OscarData *od, aim_mpmsg_t *mpm, guint16 charset, guint16 charsubset, gchar *data, guint16 datalen) |
| 13235 | 1354 | { |
| 1355 | aim_mpmsg_section_t *sec; | |
| 1356 | ||
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
1357 | sec = g_malloc(sizeof(aim_mpmsg_section_t)); |
| 13235 | 1358 | |
| 1359 | sec->charset = charset; | |
| 1360 | sec->charsubset = charsubset; | |
| 1361 | sec->data = data; | |
| 1362 | sec->datalen = datalen; | |
| 1363 | sec->next = NULL; | |
| 1364 | ||
| 1365 | if (!mpm->parts) | |
| 1366 | mpm->parts = sec; | |
| 1367 | else { | |
| 1368 | aim_mpmsg_section_t *cur; | |
| 1369 | ||
| 1370 | for (cur = mpm->parts; cur->next; cur = cur->next) | |
| 1371 | ; | |
| 1372 | cur->next = sec; | |
| 1373 | } | |
| 1374 | ||
| 1375 | mpm->numparts++; | |
| 1376 | ||
| 1377 | return 0; | |
| 1378 | } | |
| 1379 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1380 | int aim_mpmsg_addraw(OscarData *od, aim_mpmsg_t *mpm, guint16 charset, guint16 charsubset, const gchar *data, guint16 datalen) |
| 13235 | 1381 | { |
| 1382 | gchar *dup; | |
| 1383 | ||
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
1384 | dup = g_malloc(datalen); |
| 13235 | 1385 | memcpy(dup, data, datalen); |
| 1386 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1387 | if (mpmsg_addsection(od, mpm, charset, charsubset, dup, datalen) == -1) { |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
1388 | g_free(dup); |
| 13235 | 1389 | return -1; |
| 1390 | } | |
| 1391 | ||
| 1392 | return 0; | |
| 1393 | } | |
| 1394 | ||
| 1395 | /* XXX - should provide a way of saying ISO-8859-1 specifically */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1396 | int aim_mpmsg_addascii(OscarData *od, aim_mpmsg_t *mpm, const char *ascii) |
| 13235 | 1397 | { |
| 1398 | gchar *dup; | |
| 1399 | ||
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
1400 | if (!(dup = g_strdup(ascii))) |
| 13235 | 1401 | return -1; |
| 1402 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1403 | if (mpmsg_addsection(od, mpm, 0x0000, 0x0000, dup, strlen(ascii)) == -1) { |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
1404 | g_free(dup); |
| 13235 | 1405 | return -1; |
| 1406 | } | |
| 1407 | ||
| 1408 | return 0; | |
| 1409 | } | |
| 1410 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1411 | int aim_mpmsg_addunicode(OscarData *od, aim_mpmsg_t *mpm, const guint16 *unicode, guint16 unicodelen) |
| 13235 | 1412 | { |
| 1413 | gchar *buf; | |
|
13240
db5187cc40d1
[gaim-migrate @ 15605]
Mark Doliner <markdoliner@pidgin.im>
parents:
13235
diff
changeset
|
1414 | ByteStream bs; |
| 13235 | 1415 | int i; |
| 1416 | ||
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
1417 | buf = g_malloc(unicodelen * 2); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1418 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1419 | byte_stream_init(&bs, (guchar *)buf, unicodelen * 2); |
| 13235 | 1420 | |
| 1421 | /* We assume unicode is in /host/ byte order -- convert to network */ | |
| 1422 | for (i = 0; i < unicodelen; i++) | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1423 | byte_stream_put16(&bs, unicode[i]); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1424 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1425 | if (mpmsg_addsection(od, mpm, 0x0002, 0x0000, buf, byte_stream_curpos(&bs)) == -1) { |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
1426 | g_free(buf); |
| 13235 | 1427 | return -1; |
| 1428 | } | |
| 1429 | ||
| 1430 | return 0; | |
| 1431 | } | |
| 1432 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1433 | void aim_mpmsg_free(OscarData *od, aim_mpmsg_t *mpm) |
| 13235 | 1434 | { |
| 1435 | aim_mpmsg_section_t *cur; | |
| 1436 | ||
| 1437 | for (cur = mpm->parts; cur; ) { | |
| 1438 | aim_mpmsg_section_t *tmp; | |
| 1439 | ||
| 1440 | tmp = cur->next; | |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
1441 | g_free(cur->data); |
|
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
1442 | g_free(cur); |
| 13235 | 1443 | cur = tmp; |
| 1444 | } | |
| 1445 | ||
| 1446 | mpm->numparts = 0; | |
| 1447 | mpm->parts = NULL; | |
| 1448 | ||
| 1449 | return; | |
| 1450 | } | |
| 1451 | ||
| 1452 | /* | |
| 1453 | * Start by building the multipart structures, then pick the first | |
| 1454 | * human-readable section and stuff it into args->msg so no one gets | |
| 1455 | * suspicious. | |
| 1456 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1457 | static int incomingim_ch1_parsemsgs(OscarData *od, aim_userinfo_t *userinfo, guint8 *data, int len, struct aim_incomingim_ch1_args *args) |
| 13235 | 1458 | { |
| 1459 | /* Should this be ASCII -> UNICODE -> Custom */ | |
| 1460 | static const guint16 charsetpri[] = { | |
| 1461 | AIM_CHARSET_ASCII, /* ASCII first */ | |
| 1462 | AIM_CHARSET_CUSTOM, /* then ISO-8859-1 */ | |
| 1463 | AIM_CHARSET_UNICODE, /* UNICODE as last resort */ | |
| 1464 | }; | |
| 1465 | static const int charsetpricount = 3; | |
| 1466 | int i; | |
|
13240
db5187cc40d1
[gaim-migrate @ 15605]
Mark Doliner <markdoliner@pidgin.im>
parents:
13235
diff
changeset
|
1467 | ByteStream mbs; |
| 13235 | 1468 | aim_mpmsg_section_t *sec; |
| 1469 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1470 | byte_stream_init(&mbs, data, len); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1471 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1472 | while (byte_stream_empty(&mbs)) { |
| 13235 | 1473 | guint16 msglen, flag1, flag2; |
| 1474 | gchar *msgbuf; | |
| 1475 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1476 | byte_stream_get8(&mbs); /* 01 */ |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1477 | byte_stream_get8(&mbs); /* 01 */ |
| 13235 | 1478 | |
| 1479 | /* Message string length, including character set info. */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1480 | msglen = byte_stream_get16(&mbs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1481 | if (msglen > byte_stream_empty(&mbs)) |
| 13235 | 1482 | { |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
1483 | purple_debug_misc("oscar", "Received an IM containing an invalid message part from %s. They are probably trying to do something malicious.\n", userinfo->bn); |
| 13235 | 1484 | break; |
| 1485 | } | |
| 1486 | ||
| 1487 | /* Character set info */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1488 | flag1 = byte_stream_get16(&mbs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1489 | flag2 = byte_stream_get16(&mbs); |
| 13235 | 1490 | |
| 1491 | /* Message. */ | |
| 1492 | msglen -= 4; | |
| 1493 | ||
| 1494 | /* | |
| 1495 | * For now, we don't care what the encoding is. Just copy | |
| 1496 | * it into a multipart struct and deal with it later. However, | |
| 1497 | * always pad the ending with a NULL. This makes it easier | |
| 1498 | * to treat ASCII sections as strings. It won't matter for | |
| 1499 | * UNICODE or binary data, as you should never read past | |
| 1500 | * the specified data length, which will not include the pad. | |
| 1501 | * | |
| 1502 | * XXX - There's an API bug here. For sending, the UNICODE is | |
| 1503 | * given in host byte order (aim_mpmsg_addunicode), but here | |
| 1504 | * the received messages are given in network byte order. | |
| 1505 | * | |
| 1506 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1507 | msgbuf = (gchar *)byte_stream_getraw(&mbs, msglen); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1508 | mpmsg_addsection(od, &args->mpmsg, flag1, flag2, msgbuf, msglen); |
| 13235 | 1509 | |
| 1510 | } /* while */ | |
| 1511 | ||
| 1512 | args->icbmflags |= AIM_IMFLAGS_MULTIPART; /* always set */ | |
| 1513 | ||
| 1514 | /* | |
| 1515 | * Clients that support multiparts should never use args->msg, as it | |
| 1516 | * will point to an arbitrary section. | |
| 1517 | * | |
| 1518 | * Here, we attempt to provide clients that do not support multipart | |
| 1519 | * messages with something to look at -- hopefully a human-readable | |
| 1520 | * string. But, failing that, a UNICODE message, or nothing at all. | |
| 1521 | * | |
| 1522 | * Which means that even if args->msg is NULL, it does not mean the | |
| 1523 | * message was blank. | |
| 1524 | * | |
| 1525 | */ | |
| 1526 | for (i = 0; i < charsetpricount; i++) { | |
| 1527 | for (sec = args->mpmsg.parts; sec; sec = sec->next) { | |
| 1528 | ||
| 1529 | if (sec->charset != charsetpri[i]) | |
| 1530 | continue; | |
| 1531 | ||
| 1532 | /* Great. We found one. Fill it in. */ | |
| 1533 | args->charset = sec->charset; | |
| 1534 | args->charsubset = sec->charsubset; | |
| 1535 | ||
| 1536 | /* Set up the simple flags */ | |
| 1537 | switch (args->charsubset) | |
| 1538 | { | |
| 1539 | case 0x0000: | |
| 1540 | /* standard subencoding? */ | |
| 1541 | break; | |
| 1542 | case 0x000b: | |
| 1543 | args->icbmflags |= AIM_IMFLAGS_SUBENC_MACINTOSH; | |
| 1544 | break; | |
| 1545 | case 0xffff: | |
| 1546 | /* no subencoding */ | |
| 1547 | break; | |
| 1548 | default: | |
| 1549 | break; | |
| 1550 | } | |
| 1551 | ||
| 1552 | args->msg = sec->data; | |
| 1553 | args->msglen = sec->datalen; | |
| 1554 | ||
| 1555 | return 0; | |
| 1556 | } | |
| 1557 | } | |
| 1558 | ||
| 1559 | /* No human-readable sections found. Oh well. */ | |
| 1560 | args->charset = args->charsubset = 0xffff; | |
| 1561 | args->msg = NULL; | |
| 1562 | args->msglen = 0; | |
| 1563 | ||
| 1564 | return 0; | |
| 1565 | } | |
| 1566 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1567 | static int incomingim_ch1(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, guint16 channel, aim_userinfo_t *userinfo, ByteStream *bs, guint8 *cookie) |
| 13235 | 1568 | { |
|
25599
aee799d2188a
Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
David Jedelsky <david.jedelsky@gmail.com>
parents:
25086
diff
changeset
|
1569 | guint16 type, length, magic1, msglen; |
| 13235 | 1570 | aim_rxcallback_t userfunc; |
| 1571 | int ret = 0; | |
|
25599
aee799d2188a
Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
David Jedelsky <david.jedelsky@gmail.com>
parents:
25086
diff
changeset
|
1572 | int rev = 0; |
| 13235 | 1573 | struct aim_incomingim_ch1_args args; |
| 1574 | unsigned int endpos; | |
| 1575 | ||
| 1576 | memset(&args, 0, sizeof(args)); | |
| 1577 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1578 | aim_mpmsg_init(od, &args.mpmsg); |
| 13235 | 1579 | |
| 1580 | /* | |
| 1581 | * This used to be done using tlvchains. For performance reasons, | |
| 1582 | * I've changed it to process the TLVs in-place. This avoids lots | |
| 1583 | * of per-IM memory allocations. | |
| 1584 | */ | |
|
14154
8efcb9fa5190
[gaim-migrate @ 16717]
Mark Doliner <markdoliner@pidgin.im>
parents:
14030
diff
changeset
|
1585 | while (byte_stream_empty(bs) >= 4) |
| 13235 | 1586 | { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1587 | type = byte_stream_get16(bs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1588 | length = byte_stream_get16(bs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1589 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1590 | if (length > byte_stream_empty(bs)) |
| 13235 | 1591 | { |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
1592 | purple_debug_misc("oscar", "Received an IM containing an invalid message part from %s. They are probably trying to do something malicious.\n", userinfo->bn); |
| 13235 | 1593 | break; |
| 1594 | } | |
| 1595 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1596 | endpos = byte_stream_curpos(bs) + length; |
| 13235 | 1597 | |
| 1598 | if (type == 0x0002) { /* Message Block */ | |
| 1599 | ||
| 1600 | /* | |
| 1601 | * This TLV consists of the following: | |
| 1602 | * - 0501 -- Unknown | |
| 1603 | * - Features: Don't know how to interpret these | |
| 1604 | * - 0101 -- Unknown | |
| 1605 | * - Message | |
| 1606 | * | |
|
25599
aee799d2188a
Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
David Jedelsky <david.jedelsky@gmail.com>
parents:
25086
diff
changeset
|
1607 | * Slick and possible others reverse 'Features' and 'Messages' section. |
|
aee799d2188a
Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
David Jedelsky <david.jedelsky@gmail.com>
parents:
25086
diff
changeset
|
1608 | * Thus, the TLV could have following layout: |
|
aee799d2188a
Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
David Jedelsky <david.jedelsky@gmail.com>
parents:
25086
diff
changeset
|
1609 | * - 0101 -- Unknown (possibly magic for message section) |
|
aee799d2188a
Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
David Jedelsky <david.jedelsky@gmail.com>
parents:
25086
diff
changeset
|
1610 | * - Message |
|
aee799d2188a
Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
David Jedelsky <david.jedelsky@gmail.com>
parents:
25086
diff
changeset
|
1611 | * - 0501 -- Unknown (possibly magic for features section) |
|
aee799d2188a
Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
David Jedelsky <david.jedelsky@gmail.com>
parents:
25086
diff
changeset
|
1612 | * - Features: Don't know how to interpret these |
| 13235 | 1613 | */ |
| 1614 | ||
|
25599
aee799d2188a
Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
David Jedelsky <david.jedelsky@gmail.com>
parents:
25086
diff
changeset
|
1615 | magic1 = byte_stream_get16(bs); /* 0501 or 0101 */ |
|
aee799d2188a
Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
David Jedelsky <david.jedelsky@gmail.com>
parents:
25086
diff
changeset
|
1616 | if (magic1 == 0x101) /* Bad, message comes before attributes */ |
|
aee799d2188a
Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
David Jedelsky <david.jedelsky@gmail.com>
parents:
25086
diff
changeset
|
1617 | { |
|
aee799d2188a
Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
David Jedelsky <david.jedelsky@gmail.com>
parents:
25086
diff
changeset
|
1618 | /* Jump to the features section */ |
|
aee799d2188a
Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
David Jedelsky <david.jedelsky@gmail.com>
parents:
25086
diff
changeset
|
1619 | msglen = byte_stream_get16(bs); |
|
aee799d2188a
Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
David Jedelsky <david.jedelsky@gmail.com>
parents:
25086
diff
changeset
|
1620 | bs->offset += msglen; |
|
aee799d2188a
Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
David Jedelsky <david.jedelsky@gmail.com>
parents:
25086
diff
changeset
|
1621 | rev = 1; |
|
aee799d2188a
Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
David Jedelsky <david.jedelsky@gmail.com>
parents:
25086
diff
changeset
|
1622 | |
|
aee799d2188a
Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
David Jedelsky <david.jedelsky@gmail.com>
parents:
25086
diff
changeset
|
1623 | magic1 = byte_stream_get16(bs); /* 0501 */ |
|
aee799d2188a
Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
David Jedelsky <david.jedelsky@gmail.com>
parents:
25086
diff
changeset
|
1624 | } |
|
aee799d2188a
Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
David Jedelsky <david.jedelsky@gmail.com>
parents:
25086
diff
changeset
|
1625 | |
|
aee799d2188a
Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
David Jedelsky <david.jedelsky@gmail.com>
parents:
25086
diff
changeset
|
1626 | if (magic1 != 0x501) |
|
aee799d2188a
Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
David Jedelsky <david.jedelsky@gmail.com>
parents:
25086
diff
changeset
|
1627 | { |
|
25913
3d5e1dfea10a
Fix compile errors from the merge. Untested protocols: msnp9, sametime,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1628 | purple_debug_misc("oscar", "Received an IM containing an invalid message part from %s. They are probably trying to do something malicious.\n", userinfo->bn); |
|
25599
aee799d2188a
Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
David Jedelsky <david.jedelsky@gmail.com>
parents:
25086
diff
changeset
|
1629 | break; |
|
aee799d2188a
Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
David Jedelsky <david.jedelsky@gmail.com>
parents:
25086
diff
changeset
|
1630 | } |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1631 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1632 | args.featureslen = byte_stream_get16(bs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1633 | if (args.featureslen > byte_stream_empty(bs)) |
| 13235 | 1634 | { |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
1635 | purple_debug_misc("oscar", "Received an IM containing an invalid message part from %s. They are probably trying to do something malicious.\n", userinfo->bn); |
| 13235 | 1636 | break; |
| 1637 | } | |
| 1638 | if (args.featureslen == 0) | |
| 1639 | { | |
| 1640 | args.features = NULL; | |
| 1641 | } | |
| 1642 | else | |
| 1643 | { | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1644 | args.features = byte_stream_getraw(bs, args.featureslen); |
| 13235 | 1645 | args.icbmflags |= AIM_IMFLAGS_CUSTOMFEATURES; |
| 1646 | } | |
| 1647 | ||
|
25599
aee799d2188a
Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
David Jedelsky <david.jedelsky@gmail.com>
parents:
25086
diff
changeset
|
1648 | if (rev) |
|
aee799d2188a
Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
David Jedelsky <david.jedelsky@gmail.com>
parents:
25086
diff
changeset
|
1649 | { |
|
aee799d2188a
Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
David Jedelsky <david.jedelsky@gmail.com>
parents:
25086
diff
changeset
|
1650 | /* Fix buffer back to message */ |
|
aee799d2188a
Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
David Jedelsky <david.jedelsky@gmail.com>
parents:
25086
diff
changeset
|
1651 | bs->offset -= args.featureslen + 2 + 2 + msglen + 2 + 2; |
|
aee799d2188a
Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
David Jedelsky <david.jedelsky@gmail.com>
parents:
25086
diff
changeset
|
1652 | } |
|
aee799d2188a
Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
David Jedelsky <david.jedelsky@gmail.com>
parents:
25086
diff
changeset
|
1653 | |
|
aee799d2188a
Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
David Jedelsky <david.jedelsky@gmail.com>
parents:
25086
diff
changeset
|
1654 | magic1 = byte_stream_get16(bs); /* 01 01 */ |
|
aee799d2188a
Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
David Jedelsky <david.jedelsky@gmail.com>
parents:
25086
diff
changeset
|
1655 | if (magic1 != 0x101) /* Bad, message comes before attributes */ |
|
aee799d2188a
Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
David Jedelsky <david.jedelsky@gmail.com>
parents:
25086
diff
changeset
|
1656 | { |
|
25913
3d5e1dfea10a
Fix compile errors from the merge. Untested protocols: msnp9, sametime,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1657 | purple_debug_misc("oscar", "Received an IM containing an invalid message part from %s. They are probably trying to do something malicious.\n", userinfo->bn); |
|
25599
aee799d2188a
Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
David Jedelsky <david.jedelsky@gmail.com>
parents:
25086
diff
changeset
|
1658 | break; |
|
aee799d2188a
Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
David Jedelsky <david.jedelsky@gmail.com>
parents:
25086
diff
changeset
|
1659 | } |
|
aee799d2188a
Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
David Jedelsky <david.jedelsky@gmail.com>
parents:
25086
diff
changeset
|
1660 | msglen = byte_stream_get16(bs); |
|
aee799d2188a
Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
David Jedelsky <david.jedelsky@gmail.com>
parents:
25086
diff
changeset
|
1661 | |
| 13235 | 1662 | /* |
| 1663 | * The rest of the TLV contains one or more message | |
| 1664 | * blocks... | |
| 1665 | */ | |
|
25599
aee799d2188a
Fix recipt of ICQ messages from the mobile client "Slick." Fixes #7084, #7595.
David Jedelsky <david.jedelsky@gmail.com>
parents:
25086
diff
changeset
|
1666 | incomingim_ch1_parsemsgs(od, userinfo, bs->data + bs->offset - 2 - 2 /* XXX evil!!! */, msglen + 2 + 2, &args); |
| 13235 | 1667 | |
| 1668 | } else if (type == 0x0003) { /* Server Ack Requested */ | |
| 1669 | ||
| 1670 | args.icbmflags |= AIM_IMFLAGS_ACK; | |
| 1671 | ||
| 1672 | } else if (type == 0x0004) { /* Message is Auto Response */ | |
| 1673 | ||
| 1674 | args.icbmflags |= AIM_IMFLAGS_AWAY; | |
| 1675 | ||
| 1676 | } else if (type == 0x0006) { /* Message was received offline. */ | |
| 1677 | ||
|
22479
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
1678 | /* |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
1679 | * This flag is set on incoming offline messages for both |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
1680 | * AIM and ICQ accounts. |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
1681 | */ |
| 13235 | 1682 | args.icbmflags |= AIM_IMFLAGS_OFFLINE; |
| 1683 | ||
| 1684 | } else if (type == 0x0008) { /* I-HAVE-A-REALLY-PURTY-ICON Flag */ | |
| 1685 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1686 | args.iconlen = byte_stream_get32(bs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1687 | byte_stream_get16(bs); /* 0x0001 */ |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1688 | args.iconsum = byte_stream_get16(bs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1689 | args.iconstamp = byte_stream_get32(bs); |
| 13235 | 1690 | |
| 1691 | /* | |
| 1692 | * This looks to be a client bug. MacAIM 4.3 will | |
| 1693 | * send this tag, but with all zero values, in the | |
| 1694 | * first message of a conversation. This makes no | |
| 1695 | * sense whatsoever, so I'm going to say its a bug. | |
| 1696 | * | |
| 1697 | * You really shouldn't advertise a zero-length icon | |
| 1698 | * anyway. | |
| 1699 | * | |
| 1700 | */ | |
| 1701 | if (args.iconlen) | |
| 1702 | args.icbmflags |= AIM_IMFLAGS_HASICON; | |
| 1703 | ||
| 1704 | } else if (type == 0x0009) { | |
| 1705 | ||
| 1706 | args.icbmflags |= AIM_IMFLAGS_BUDDYREQ; | |
| 1707 | ||
| 1708 | } else if (type == 0x000b) { /* Non-direct connect typing notification */ | |
| 1709 | ||
| 1710 | args.icbmflags |= AIM_IMFLAGS_TYPINGNOT; | |
| 1711 | ||
|
22479
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
1712 | } else if (type == 0x0016) { |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
1713 | |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
1714 | /* |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
1715 | * UTC timestamp for when the message was sent. Only |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
1716 | * provided for offline messages. |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
1717 | */ |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
1718 | args.timestamp = byte_stream_get32(bs); |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
1719 | |
| 13235 | 1720 | } else if (type == 0x0017) { |
| 1721 | ||
|
13654
f304c18511d3
[gaim-migrate @ 16055]
Mark Doliner <markdoliner@pidgin.im>
parents:
13610
diff
changeset
|
1722 | if (length > byte_stream_empty(bs)) |
| 13235 | 1723 | { |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
1724 | purple_debug_misc("oscar", "Received an IM containing an invalid message part from %s. They are probably trying to do something malicious.\n", userinfo->bn); |
| 13235 | 1725 | break; |
| 1726 | } | |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
1727 | g_free(args.extdata); |
|
13654
f304c18511d3
[gaim-migrate @ 16055]
Mark Doliner <markdoliner@pidgin.im>
parents:
13610
diff
changeset
|
1728 | args.extdatalen = length; |
| 13235 | 1729 | if (args.extdatalen == 0) |
| 1730 | args.extdata = NULL; | |
| 1731 | else | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1732 | args.extdata = byte_stream_getraw(bs, args.extdatalen); |
| 13235 | 1733 | |
| 1734 | } else { | |
| 15884 | 1735 | purple_debug_misc("oscar", "incomingim_ch1: unknown TLV 0x%04x (len %d)\n", type, length); |
| 13235 | 1736 | } |
| 1737 | ||
| 1738 | /* | |
| 1739 | * This is here to protect ourselves from ourselves. That | |
| 1740 | * is, if something above doesn't completely parse its value | |
| 1741 | * section, or, worse, overparses it, this will set the | |
| 1742 | * stream where it needs to be in order to land on the next | |
| 1743 | * TLV when the loop continues. | |
| 1744 | * | |
| 1745 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1746 | byte_stream_setpos(bs, endpos); |
| 13235 | 1747 | } |
| 1748 | ||
| 1749 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1750 | if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1751 | ret = userfunc(od, conn, frame, channel, userinfo, &args); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1752 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1753 | aim_mpmsg_free(od, &args.mpmsg); |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
1754 | g_free(args.features); |
|
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
1755 | g_free(args.extdata); |
| 13235 | 1756 | |
| 1757 | return ret; | |
| 1758 | } | |
| 1759 | ||
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1760 | static void |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1761 | incomingim_ch2_buddylist(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, aim_userinfo_t *userinfo, IcbmArgsCh2 *args, ByteStream *servdata) |
| 13235 | 1762 | { |
| 1763 | /* | |
| 1764 | * This goes like this... | |
| 1765 | * | |
| 1766 | * group name length | |
| 1767 | * group name | |
| 1768 | * num of buddies in group | |
| 1769 | * buddy name length | |
| 1770 | * buddy name | |
| 1771 | * buddy name length | |
| 1772 | * buddy name | |
| 1773 | * ... | |
| 1774 | * group name length | |
| 1775 | * group name | |
| 1776 | * num of buddies in group | |
| 1777 | * buddy name length | |
| 1778 | * buddy name | |
| 1779 | * ... | |
| 1780 | * ... | |
| 1781 | */ | |
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1782 | while (byte_stream_empty(servdata)) |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1783 | { |
| 13235 | 1784 | guint16 gnlen, numb; |
| 1785 | int i; | |
| 1786 | char *gn; | |
| 1787 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1788 | gnlen = byte_stream_get16(servdata); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1789 | gn = byte_stream_getstr(servdata, gnlen); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1790 | numb = byte_stream_get16(servdata); |
| 13235 | 1791 | |
| 1792 | for (i = 0; i < numb; i++) { | |
| 1793 | guint16 bnlen; | |
| 1794 | char *bn; | |
| 1795 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1796 | bnlen = byte_stream_get16(servdata); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1797 | bn = byte_stream_getstr(servdata, bnlen); |
| 13235 | 1798 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
1799 | purple_debug_misc("oscar", "got a buddy list from %s: group %s, buddy %s\n", userinfo->bn, gn, bn); |
| 13235 | 1800 | |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
1801 | g_free(bn); |
| 13235 | 1802 | } |
| 1803 | ||
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
1804 | g_free(gn); |
| 13235 | 1805 | } |
| 1806 | ||
| 1807 | return; | |
| 1808 | } | |
| 1809 | ||
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1810 | static void |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1811 | incomingim_ch2_buddyicon_free(OscarData *od, IcbmArgsCh2 *args) |
| 13235 | 1812 | { |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
1813 | g_free(args->info.icon.icon); |
| 13235 | 1814 | |
| 1815 | return; | |
| 1816 | } | |
| 1817 | ||
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1818 | static void |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1819 | incomingim_ch2_buddyicon(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, aim_userinfo_t *userinfo, IcbmArgsCh2 *args, ByteStream *servdata) |
| 13235 | 1820 | { |
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1821 | args->info.icon.checksum = byte_stream_get32(servdata); |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1822 | args->info.icon.length = byte_stream_get32(servdata); |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1823 | args->info.icon.timestamp = byte_stream_get32(servdata); |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1824 | args->info.icon.icon = byte_stream_getraw(servdata, args->info.icon.length); |
| 13235 | 1825 | |
| 1826 | args->destructor = (void *)incomingim_ch2_buddyicon_free; | |
| 1827 | ||
| 1828 | return; | |
| 1829 | } | |
| 1830 | ||
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1831 | static void |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1832 | incomingim_ch2_chat_free(OscarData *od, IcbmArgsCh2 *args) |
| 13235 | 1833 | { |
| 1834 | /* XXX - aim_chat_roominfo_free() */ | |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
1835 | g_free(args->info.chat.roominfo.name); |
| 13235 | 1836 | |
| 1837 | return; | |
| 1838 | } | |
| 1839 | ||
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1840 | static void |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1841 | incomingim_ch2_chat(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, aim_userinfo_t *userinfo, IcbmArgsCh2 *args, ByteStream *servdata) |
| 13235 | 1842 | { |
| 1843 | /* | |
| 1844 | * Chat room info. | |
| 1845 | */ | |
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1846 | aim_chat_readroominfo(servdata, &args->info.chat.roominfo); |
| 13235 | 1847 | |
| 1848 | args->destructor = (void *)incomingim_ch2_chat_free; | |
| 1849 | } | |
| 1850 | ||
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1851 | static void |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1852 | incomingim_ch2_icqserverrelay_free(OscarData *od, IcbmArgsCh2 *args) |
| 13235 | 1853 | { |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
1854 | g_free((char *)args->info.rtfmsg.rtfmsg); |
| 13235 | 1855 | } |
| 1856 | ||
| 1857 | /* | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1858 | * The relationship between OSCAR_CAPABILITY_ICQSERVERRELAY and OSCAR_CAPABILITY_ICQRTF is |
| 13235 | 1859 | * kind of odd. This sends the client ICQRTF since that is all that I've seen |
| 1860 | * SERVERRELAY used for. | |
| 1861 | * | |
| 1862 | * Note that this is all little-endian. Cringe. | |
| 1863 | * | |
| 1864 | */ | |
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1865 | static void |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1866 | incomingim_ch2_icqserverrelay(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, aim_userinfo_t *userinfo, IcbmArgsCh2 *args, ByteStream *servdata) |
| 13235 | 1867 | { |
| 1868 | guint16 hdrlen, anslen, msglen; | |
| 1869 | ||
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1870 | if (byte_stream_empty(servdata) < 24) |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1871 | /* Someone sent us a short server relay ICBM. Weird. (Maybe?) */ |
|
13663
de16367fd001
[gaim-migrate @ 16064]
Mark Doliner <markdoliner@pidgin.im>
parents:
13654
diff
changeset
|
1872 | return; |
|
de16367fd001
[gaim-migrate @ 16064]
Mark Doliner <markdoliner@pidgin.im>
parents:
13654
diff
changeset
|
1873 | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1874 | hdrlen = byte_stream_getle16(servdata); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1875 | byte_stream_advance(servdata, hdrlen); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1876 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1877 | hdrlen = byte_stream_getle16(servdata); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1878 | byte_stream_advance(servdata, hdrlen); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1879 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1880 | args->info.rtfmsg.msgtype = byte_stream_getle16(servdata); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1881 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1882 | anslen = byte_stream_getle32(servdata); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1883 | byte_stream_advance(servdata, anslen); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1884 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1885 | msglen = byte_stream_getle16(servdata); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1886 | args->info.rtfmsg.rtfmsg = byte_stream_getstr(servdata, msglen); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1887 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1888 | args->info.rtfmsg.fgcolor = byte_stream_getle32(servdata); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1889 | args->info.rtfmsg.bgcolor = byte_stream_getle32(servdata); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1890 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1891 | hdrlen = byte_stream_getle32(servdata); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1892 | byte_stream_advance(servdata, hdrlen); |
| 13235 | 1893 | |
| 1894 | args->destructor = (void *)incomingim_ch2_icqserverrelay_free; | |
| 1895 | } | |
| 1896 | ||
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1897 | static void |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1898 | incomingim_ch2_sendfile_free(OscarData *od, IcbmArgsCh2 *args) |
| 13235 | 1899 | { |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
1900 | g_free(args->info.sendfile.filename); |
| 13235 | 1901 | } |
| 1902 | ||
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1903 | /* Someone is sending us a file */ |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1904 | static void |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1905 | incomingim_ch2_sendfile(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, aim_userinfo_t *userinfo, IcbmArgsCh2 *args, ByteStream *servdata) |
| 13235 | 1906 | { |
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1907 | int flen; |
| 13235 | 1908 | |
| 1909 | args->destructor = (void *)incomingim_ch2_sendfile_free; | |
| 1910 | ||
| 1911 | /* Maybe there is a better way to tell what kind of sendfile | |
| 1912 | * this is? Maybe TLV t(000a)? */ | |
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1913 | |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1914 | /* subtype is one of AIM_OFT_SUBTYPE_* */ |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1915 | args->info.sendfile.subtype = byte_stream_get16(servdata); |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1916 | args->info.sendfile.totfiles = byte_stream_get16(servdata); |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1917 | args->info.sendfile.totsize = byte_stream_get32(servdata); |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1918 | |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1919 | /* |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1920 | * I hope to God I'm right when I guess that there is a |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1921 | * 32 char max filename length for single files. I think |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1922 | * OFT tends to do that. Gotta love inconsistency. I saw |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1923 | * a 26 byte filename? |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1924 | */ |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1925 | /* AAA - create an byte_stream_getnullstr function (don't anymore)(maybe) */ |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1926 | /* Use an inelegant way of getting the null-terminated filename, |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1927 | * since there's no easy bstream routine. */ |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1928 | for (flen = 0; byte_stream_get8(servdata); flen++); |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1929 | byte_stream_advance(servdata, -flen -1); |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1930 | args->info.sendfile.filename = byte_stream_getstr(servdata, flen); |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1931 | |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1932 | /* There is sometimes more after the null-terminated filename, |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1933 | * but I'm unsure of its format. */ |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1934 | /* I don't believe him. */ |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1935 | /* There is sometimes a null byte inside a unicode filename, |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1936 | * but as far as I can tell the filename is the last |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1937 | * piece of data that will be in this message. --Jonathan */ |
| 13235 | 1938 | } |
| 1939 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1940 | typedef void (*ch2_args_destructor_t)(OscarData *od, IcbmArgsCh2 *args); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1941 | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1942 | static int incomingim_ch2(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, guint16 channel, aim_userinfo_t *userinfo, GSList *tlvlist, guint8 *cookie) |
| 13235 | 1943 | { |
| 1944 | aim_rxcallback_t userfunc; | |
| 1945 | aim_tlv_t *block1, *servdatatlv; | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1946 | GSList *list2; |
|
13665
c8984bccd64c
[gaim-migrate @ 16066]
Mark Doliner <markdoliner@pidgin.im>
parents:
13663
diff
changeset
|
1947 | aim_tlv_t *tlv; |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1948 | IcbmArgsCh2 args; |
|
13240
db5187cc40d1
[gaim-migrate @ 15605]
Mark Doliner <markdoliner@pidgin.im>
parents:
13235
diff
changeset
|
1949 | ByteStream bbs, sdbs, *sdbsptr = NULL; |
| 13235 | 1950 | guint8 *cookie2; |
| 1951 | int ret = 0; | |
| 1952 | ||
| 1953 | char proxyip[30] = {""}; | |
| 1954 | char clientip[30] = {""}; | |
| 1955 | char verifiedip[30] = {""}; | |
| 1956 | ||
| 1957 | memset(&args, 0, sizeof(args)); | |
| 1958 | ||
| 1959 | /* | |
| 1960 | * There's another block of TLVs embedded in the type 5 here. | |
| 1961 | */ | |
| 1962 | block1 = aim_tlv_gettlv(tlvlist, 0x0005, 1); | |
|
13663
de16367fd001
[gaim-migrate @ 16064]
Mark Doliner <markdoliner@pidgin.im>
parents:
13654
diff
changeset
|
1963 | if (block1 == NULL) |
|
de16367fd001
[gaim-migrate @ 16064]
Mark Doliner <markdoliner@pidgin.im>
parents:
13654
diff
changeset
|
1964 | { |
|
de16367fd001
[gaim-migrate @ 16064]
Mark Doliner <markdoliner@pidgin.im>
parents:
13654
diff
changeset
|
1965 | /* The server sent us ch2 ICBM without ch2 info? Weird. */ |
|
de16367fd001
[gaim-migrate @ 16064]
Mark Doliner <markdoliner@pidgin.im>
parents:
13654
diff
changeset
|
1966 | return 1; |
|
de16367fd001
[gaim-migrate @ 16064]
Mark Doliner <markdoliner@pidgin.im>
parents:
13654
diff
changeset
|
1967 | } |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1968 | byte_stream_init(&bbs, block1->value, block1->length); |
| 13235 | 1969 | |
| 1970 | /* | |
| 1971 | * First two bytes represent the status of the connection. | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1972 | * One of the AIM_RENDEZVOUS_ defines. |
| 13235 | 1973 | * |
| 1974 | * 0 is a request, 1 is a cancel, 2 is an accept | |
| 1975 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1976 | args.status = byte_stream_get16(&bbs); |
| 13235 | 1977 | |
| 1978 | /* | |
| 1979 | * Next comes the cookie. Should match the ICBM cookie. | |
| 1980 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1981 | cookie2 = byte_stream_getraw(&bbs, 8); |
| 13235 | 1982 | if (memcmp(cookie, cookie2, 8) != 0) |
|
15308
2bfe4510454e
[gaim-migrate @ 18036]
Mark Doliner <markdoliner@pidgin.im>
parents:
15151
diff
changeset
|
1983 | { |
| 15884 | 1984 | purple_debug_warning("oscar", |
|
15308
2bfe4510454e
[gaim-migrate @ 18036]
Mark Doliner <markdoliner@pidgin.im>
parents:
15151
diff
changeset
|
1985 | "Cookies don't match in rendezvous ICBM, bailing out.\n"); |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
1986 | g_free(cookie2); |
|
15308
2bfe4510454e
[gaim-migrate @ 18036]
Mark Doliner <markdoliner@pidgin.im>
parents:
15151
diff
changeset
|
1987 | return 1; |
|
2bfe4510454e
[gaim-migrate @ 18036]
Mark Doliner <markdoliner@pidgin.im>
parents:
15151
diff
changeset
|
1988 | } |
| 13235 | 1989 | memcpy(args.cookie, cookie2, 8); |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
1990 | g_free(cookie2); |
| 13235 | 1991 | |
| 1992 | /* | |
| 1993 | * The next 16bytes are a capability block so we can | |
| 1994 | * identify what type of rendezvous this is. | |
| 1995 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1996 | args.type = aim_locate_getcaps(od, &bbs, 0x10); |
| 13235 | 1997 | |
| 1998 | /* | |
| 1999 | * What follows may be TLVs or nothing, depending on the | |
| 2000 | * purpose of the message. | |
| 2001 | * | |
| 2002 | * Ack packets for instance have nothing more to them. | |
| 2003 | */ | |
| 2004 | list2 = aim_tlvlist_read(&bbs); | |
| 2005 | ||
| 2006 | /* | |
| 2007 | * IP address to proxy the file transfer through. | |
| 2008 | * | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2009 | * TODO: I don't like this. Maybe just read in an int? Or inet_ntoa... |
| 13235 | 2010 | */ |
|
13665
c8984bccd64c
[gaim-migrate @ 16066]
Mark Doliner <markdoliner@pidgin.im>
parents:
13663
diff
changeset
|
2011 | tlv = aim_tlv_gettlv(list2, 0x0002, 1); |
|
c8984bccd64c
[gaim-migrate @ 16066]
Mark Doliner <markdoliner@pidgin.im>
parents:
13663
diff
changeset
|
2012 | if ((tlv != NULL) && (tlv->length == 4)) |
|
c8984bccd64c
[gaim-migrate @ 16066]
Mark Doliner <markdoliner@pidgin.im>
parents:
13663
diff
changeset
|
2013 | snprintf(proxyip, sizeof(proxyip), "%hhu.%hhu.%hhu.%hhu", |
|
c8984bccd64c
[gaim-migrate @ 16066]
Mark Doliner <markdoliner@pidgin.im>
parents:
13663
diff
changeset
|
2014 | tlv->value[0], tlv->value[1], |
|
c8984bccd64c
[gaim-migrate @ 16066]
Mark Doliner <markdoliner@pidgin.im>
parents:
13663
diff
changeset
|
2015 | tlv->value[2], tlv->value[3]); |
| 13235 | 2016 | |
| 2017 | /* | |
| 2018 | * IP address from the perspective of the client. | |
| 2019 | */ | |
|
13665
c8984bccd64c
[gaim-migrate @ 16066]
Mark Doliner <markdoliner@pidgin.im>
parents:
13663
diff
changeset
|
2020 | tlv = aim_tlv_gettlv(list2, 0x0003, 1); |
|
c8984bccd64c
[gaim-migrate @ 16066]
Mark Doliner <markdoliner@pidgin.im>
parents:
13663
diff
changeset
|
2021 | if ((tlv != NULL) && (tlv->length == 4)) |
|
c8984bccd64c
[gaim-migrate @ 16066]
Mark Doliner <markdoliner@pidgin.im>
parents:
13663
diff
changeset
|
2022 | snprintf(clientip, sizeof(clientip), "%hhu.%hhu.%hhu.%hhu", |
|
c8984bccd64c
[gaim-migrate @ 16066]
Mark Doliner <markdoliner@pidgin.im>
parents:
13663
diff
changeset
|
2023 | tlv->value[0], tlv->value[1], |
|
c8984bccd64c
[gaim-migrate @ 16066]
Mark Doliner <markdoliner@pidgin.im>
parents:
13663
diff
changeset
|
2024 | tlv->value[2], tlv->value[3]); |
| 13235 | 2025 | |
| 2026 | /* | |
| 2027 | * Verified IP address (from the perspective of Oscar). | |
| 2028 | * | |
| 2029 | * This is added by the server. | |
| 2030 | */ | |
|
13665
c8984bccd64c
[gaim-migrate @ 16066]
Mark Doliner <markdoliner@pidgin.im>
parents:
13663
diff
changeset
|
2031 | tlv = aim_tlv_gettlv(list2, 0x0004, 1); |
|
c8984bccd64c
[gaim-migrate @ 16066]
Mark Doliner <markdoliner@pidgin.im>
parents:
13663
diff
changeset
|
2032 | if ((tlv != NULL) && (tlv->length == 4)) |
|
c8984bccd64c
[gaim-migrate @ 16066]
Mark Doliner <markdoliner@pidgin.im>
parents:
13663
diff
changeset
|
2033 | snprintf(verifiedip, sizeof(verifiedip), "%hhu.%hhu.%hhu.%hhu", |
|
c8984bccd64c
[gaim-migrate @ 16066]
Mark Doliner <markdoliner@pidgin.im>
parents:
13663
diff
changeset
|
2034 | tlv->value[0], tlv->value[1], |
|
c8984bccd64c
[gaim-migrate @ 16066]
Mark Doliner <markdoliner@pidgin.im>
parents:
13663
diff
changeset
|
2035 | tlv->value[2], tlv->value[3]); |
| 13235 | 2036 | |
| 2037 | /* | |
| 2038 | * Port number for something. | |
| 2039 | */ | |
| 2040 | if (aim_tlv_gettlv(list2, 0x0005, 1)) | |
| 2041 | args.port = aim_tlv_get16(list2, 0x0005, 1); | |
| 2042 | ||
| 2043 | /* | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2044 | * File transfer "request number": |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2045 | * 0x0001 - Initial file transfer request for no proxy or stage 1 proxy |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2046 | * 0x0002 - "Reply request" for a stage 2 proxy (receiver wants to use proxy) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2047 | * 0x0003 - A third request has been sent; applies only to stage 3 proxied transfers |
| 13235 | 2048 | */ |
| 2049 | if (aim_tlv_gettlv(list2, 0x000a, 1)) | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2050 | args.requestnumber = aim_tlv_get16(list2, 0x000a, 1); |
| 13235 | 2051 | |
| 2052 | /* | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2053 | * Terminate connection/error code. 0x0001 means the other user |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2054 | * canceled the connection. |
| 13235 | 2055 | */ |
| 2056 | if (aim_tlv_gettlv(list2, 0x000b, 1)) | |
| 2057 | args.errorcode = aim_tlv_get16(list2, 0x000b, 1); | |
| 2058 | ||
| 2059 | /* | |
| 2060 | * Invitation message / chat description. | |
| 2061 | */ | |
| 2062 | if (aim_tlv_gettlv(list2, 0x000c, 1)) { | |
| 2063 | args.msg = aim_tlv_getstr(list2, 0x000c, 1); | |
| 2064 | args.msglen = aim_tlv_getlength(list2, 0x000c, 1); | |
| 2065 | } | |
| 2066 | ||
| 2067 | /* | |
| 2068 | * Character set. | |
| 2069 | */ | |
| 2070 | if (aim_tlv_gettlv(list2, 0x000d, 1)) | |
| 2071 | args.encoding = aim_tlv_getstr(list2, 0x000d, 1); | |
| 2072 | ||
| 2073 | /* | |
| 2074 | * Language. | |
| 2075 | */ | |
| 2076 | if (aim_tlv_gettlv(list2, 0x000e, 1)) | |
| 2077 | args.language = aim_tlv_getstr(list2, 0x000e, 1); | |
| 2078 | ||
| 2079 | #if 0 | |
| 2080 | /* | |
| 2081 | * Unknown -- no value | |
| 2082 | * | |
| 2083 | * Maybe means we should connect directly to transfer the file? | |
| 2084 | * Also used in ICQ Lite Beta 4.0 URLs. Also empty. | |
| 2085 | */ | |
| 2086 | /* I don't think this indicates a direct transfer; this flag is | |
| 2087 | * also present in a stage 1 proxied file send request -- Jonathan */ | |
| 2088 | if (aim_tlv_gettlv(list2, 0x000f, 1)) { | |
| 2089 | /* Unhandled */ | |
| 2090 | } | |
| 2091 | #endif | |
| 2092 | ||
| 2093 | /* | |
| 2094 | * Flag meaning we should proxy the file transfer through an AIM server | |
| 2095 | */ | |
| 2096 | if (aim_tlv_gettlv(list2, 0x0010, 1)) | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2097 | args.use_proxy = TRUE; |
| 13235 | 2098 | |
| 2099 | if (strlen(proxyip)) | |
| 2100 | args.proxyip = (char *)proxyip; | |
| 2101 | if (strlen(clientip)) | |
| 2102 | args.clientip = (char *)clientip; | |
| 2103 | if (strlen(verifiedip)) | |
| 2104 | args.verifiedip = (char *)verifiedip; | |
| 2105 | ||
| 2106 | /* | |
| 2107 | * This must be present in PROPOSALs, but will probably not | |
| 2108 | * exist in CANCELs and ACCEPTs. Also exists in ICQ Lite | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2109 | * Beta 4.0 URLs (OSCAR_CAPABILITY_ICQSERVERRELAY). |
| 13235 | 2110 | * |
| 2111 | * Service Data blocks are module-specific in format. | |
| 2112 | */ | |
| 2113 | if ((servdatatlv = aim_tlv_gettlv(list2, 0x2711 /* 10001 */, 1))) { | |
| 2114 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2115 | byte_stream_init(&sdbs, servdatatlv->value, servdatatlv->length); |
| 13235 | 2116 | sdbsptr = &sdbs; |
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
2117 | |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
2118 | /* |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
2119 | * The rest of the handling depends on what type it is. |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
2120 | * |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
2121 | * Not all of them have special handling (yet). |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
2122 | */ |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
2123 | if (args.type & OSCAR_CAPABILITY_BUDDYICON) |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
2124 | incomingim_ch2_buddyicon(od, conn, mod, frame, snac, userinfo, &args, sdbsptr); |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
2125 | else if (args.type & OSCAR_CAPABILITY_SENDBUDDYLIST) |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
2126 | incomingim_ch2_buddylist(od, conn, mod, frame, snac, userinfo, &args, sdbsptr); |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
2127 | else if (args.type & OSCAR_CAPABILITY_CHAT) |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
2128 | incomingim_ch2_chat(od, conn, mod, frame, snac, userinfo, &args, sdbsptr); |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
2129 | else if (args.type & OSCAR_CAPABILITY_ICQSERVERRELAY) |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
2130 | incomingim_ch2_icqserverrelay(od, conn, mod, frame, snac, userinfo, &args, sdbsptr); |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
2131 | else if (args.type & OSCAR_CAPABILITY_SENDFILE) |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
2132 | incomingim_ch2_sendfile(od, conn, mod, frame, snac, userinfo, &args, sdbsptr); |
| 13235 | 2133 | } |
| 2134 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2135 | if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2136 | ret = userfunc(od, conn, frame, channel, userinfo, &args); |
| 13235 | 2137 | |
| 2138 | ||
| 2139 | if (args.destructor) | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2140 | ((ch2_args_destructor_t)args.destructor)(od, &args); |
| 13235 | 2141 | |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
2142 | g_free((char *)args.msg); |
|
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
2143 | g_free((char *)args.encoding); |
|
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
2144 | g_free((char *)args.language); |
| 13235 | 2145 | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
2146 | aim_tlvlist_free(list2); |
| 13235 | 2147 | |
| 2148 | return ret; | |
| 2149 | } | |
| 2150 | ||
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
2151 | static int incomingim_ch4(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, guint16 channel, aim_userinfo_t *userinfo, GSList *tlvlist, guint8 *cookie) |
| 13235 | 2152 | { |
|
13240
db5187cc40d1
[gaim-migrate @ 15605]
Mark Doliner <markdoliner@pidgin.im>
parents:
13235
diff
changeset
|
2153 | ByteStream meat; |
| 13235 | 2154 | aim_rxcallback_t userfunc; |
| 2155 | aim_tlv_t *block; | |
| 2156 | struct aim_incomingim_ch4_args args; | |
| 2157 | int ret = 0; | |
| 2158 | ||
| 2159 | /* | |
| 2160 | * Make a bstream for the meaty part. Yum. Meat. | |
| 2161 | */ | |
| 2162 | if (!(block = aim_tlv_gettlv(tlvlist, 0x0005, 1))) | |
| 2163 | return -1; | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2164 | byte_stream_init(&meat, block->value, block->length); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2165 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2166 | args.uin = byte_stream_getle32(&meat); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2167 | args.type = byte_stream_getle8(&meat); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2168 | args.flags = byte_stream_getle8(&meat); |
|
19819
e9d8873f4d27
Add non-US SMS support for ICQ. This is a patch from DB42.
Mark Doliner <markdoliner@pidgin.im>
parents:
17443
diff
changeset
|
2169 | if (args.type == 0x1a) |
|
e9d8873f4d27
Add non-US SMS support for ICQ. This is a patch from DB42.
Mark Doliner <markdoliner@pidgin.im>
parents:
17443
diff
changeset
|
2170 | /* There seems to be a problem with the length in SMS msgs from server, this fixed it */ |
|
e9d8873f4d27
Add non-US SMS support for ICQ. This is a patch from DB42.
Mark Doliner <markdoliner@pidgin.im>
parents:
17443
diff
changeset
|
2171 | args.msglen = block->length - 6; |
|
e9d8873f4d27
Add non-US SMS support for ICQ. This is a patch from DB42.
Mark Doliner <markdoliner@pidgin.im>
parents:
17443
diff
changeset
|
2172 | else |
|
e9d8873f4d27
Add non-US SMS support for ICQ. This is a patch from DB42.
Mark Doliner <markdoliner@pidgin.im>
parents:
17443
diff
changeset
|
2173 | args.msglen = byte_stream_getle16(&meat); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2174 | args.msg = (gchar *)byte_stream_getraw(&meat, args.msglen); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2175 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2176 | if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2177 | ret = userfunc(od, conn, frame, channel, userinfo, &args); |
| 13235 | 2178 | |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
2179 | g_free(args.msg); |
| 13235 | 2180 | |
| 2181 | return ret; | |
| 2182 | } | |
| 2183 | ||
| 2184 | /* | |
| 2185 | * Subtype 0x0007 | |
| 2186 | * | |
| 2187 | * It can easily be said that parsing ICBMs is THE single | |
| 2188 | * most difficult thing to do in the in AIM protocol. In | |
| 2189 | * fact, I think I just did say that. | |
| 2190 | * | |
| 2191 | * Below is the best damned solution I've come up with | |
| 2192 | * over the past sixteen months of battling with it. This | |
| 2193 | * can parse both away and normal messages from every client | |
| 2194 | * I have access to. Its not fast, its not clean. But it works. | |
| 2195 | * | |
| 2196 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2197 | static int incomingim(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
| 13235 | 2198 | { |
| 2199 | int ret = 0; | |
| 2200 | guchar *cookie; | |
| 2201 | guint16 channel; | |
| 2202 | aim_userinfo_t userinfo; | |
| 2203 | ||
| 2204 | memset(&userinfo, 0x00, sizeof(aim_userinfo_t)); | |
| 2205 | ||
| 2206 | /* | |
| 2207 | * Read ICBM Cookie. | |
| 2208 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2209 | cookie = byte_stream_getraw(bs, 8); |
| 13235 | 2210 | |
| 2211 | /* | |
| 2212 | * Channel ID. | |
| 2213 | * | |
| 2214 | * Channel 0x0001 is the message channel. It is | |
| 2215 | * used to send basic ICBMs. | |
| 2216 | * | |
| 2217 | * Channel 0x0002 is the Rendezvous channel, which | |
| 2218 | * is where Chat Invitiations and various client-client | |
| 2219 | * connection negotiations come from. | |
| 2220 | * | |
| 2221 | * Channel 0x0003 is used for chat messages. | |
| 2222 | * | |
| 2223 | * Channel 0x0004 is used for ICQ authorization, or | |
| 2224 | * possibly any system notice. | |
| 2225 | * | |
| 2226 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2227 | channel = byte_stream_get16(bs); |
| 13235 | 2228 | |
| 2229 | /* | |
| 2230 | * Extract the standard user info block. | |
| 2231 | * | |
| 2232 | * Note that although this contains TLVs that appear contiguous | |
| 2233 | * with the TLVs read below, they are two different pieces. The | |
| 2234 | * userinfo block contains the number of TLVs that contain user | |
| 2235 | * information, the rest are not even though there is no separation. | |
| 2236 | * You can start reading the message TLVs after aim_info_extract() | |
| 2237 | * parses out the standard userinfo block. | |
| 2238 | * | |
| 2239 | * That also means that TLV types can be duplicated between the | |
| 2240 | * userinfo block and the rest of the message, however there should | |
| 2241 | * never be two TLVs of the same type in one block. | |
| 2242 | * | |
| 2243 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2244 | aim_info_extract(od, bs, &userinfo); |
| 13235 | 2245 | |
| 2246 | /* | |
| 2247 | * From here on, its depends on what channel we're on. | |
| 2248 | * | |
| 2249 | * Technically all channels have a TLV list have this, however, | |
| 2250 | * for the common channel 1 case, in-place parsing is used for | |
| 2251 | * performance reasons (less memory allocation). | |
| 2252 | */ | |
| 2253 | if (channel == 1) { | |
| 2254 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2255 | ret = incomingim_ch1(od, conn, mod, frame, snac, channel, &userinfo, bs, cookie); |
| 13235 | 2256 | |
| 2257 | } else if (channel == 2) { | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
2258 | GSList *tlvlist; |
| 13235 | 2259 | |
| 2260 | /* | |
| 2261 | * Read block of TLVs (not including the userinfo data). All | |
| 2262 | * further data is derived from what is parsed here. | |
| 2263 | */ | |
| 2264 | tlvlist = aim_tlvlist_read(bs); | |
| 2265 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2266 | ret = incomingim_ch2(od, conn, mod, frame, snac, channel, &userinfo, tlvlist, cookie); |
| 13235 | 2267 | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
2268 | aim_tlvlist_free(tlvlist); |
| 13235 | 2269 | |
| 2270 | } else if (channel == 4) { | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
2271 | GSList *tlvlist; |
| 13235 | 2272 | |
| 2273 | tlvlist = aim_tlvlist_read(bs); | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2274 | ret = incomingim_ch4(od, conn, mod, frame, snac, channel, &userinfo, tlvlist, cookie); |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
2275 | aim_tlvlist_free(tlvlist); |
| 13235 | 2276 | |
| 2277 | } else { | |
| 15884 | 2278 | purple_debug_misc("oscar", "icbm: ICBM received on an unsupported channel. Ignoring. (chan = %04x)\n", channel); |
| 13235 | 2279 | } |
| 2280 | ||
| 2281 | aim_info_free(&userinfo); | |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
2282 | g_free(cookie); |
| 13235 | 2283 | |
| 2284 | return ret; | |
| 2285 | } | |
| 2286 | ||
| 2287 | /* | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2288 | * Subtype 0x0008 - Send a warning to bn. |
| 13235 | 2289 | * |
| 2290 | * Flags: | |
| 2291 | * AIM_WARN_ANON Send as an anonymous (doesn't count as much) | |
| 2292 | * | |
| 2293 | * returns -1 on error (couldn't alloc packet), 0 on success. | |
| 2294 | * | |
| 2295 | */ | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2296 | int aim_im_warn(OscarData *od, FlapConnection *conn, const char *bn, guint32 flags) |
| 13235 | 2297 | { |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
2298 | ByteStream bs; |
| 13235 | 2299 | aim_snacid_t snacid; |
| 2300 | ||
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2301 | if (!od || !conn || !bn) |
| 13235 | 2302 | return -EINVAL; |
| 2303 | ||
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2304 | byte_stream_new(&bs, strlen(bn)+3); |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2305 | |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2306 | snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0008, 0x0000, bn, strlen(bn)+1); |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
2307 | |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
2308 | byte_stream_put16(&bs, (flags & AIM_WARN_ANON) ? 0x0001 : 0x0000); |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2309 | byte_stream_put8(&bs, strlen(bn)); |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2310 | byte_stream_putstr(&bs, bn); |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
2311 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
2312 | flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0008, 0x0000, snacid, &bs); |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
2313 | |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
2314 | byte_stream_destroy(&bs); |
| 13235 | 2315 | |
| 2316 | return 0; | |
| 2317 | } | |
| 2318 | ||
| 2319 | /* Subtype 0x000a */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2320 | static int missedcall(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
| 13235 | 2321 | { |
| 2322 | int ret = 0; | |
| 2323 | aim_rxcallback_t userfunc; | |
| 2324 | guint16 channel, nummissed, reason; | |
| 2325 | aim_userinfo_t userinfo; | |
| 2326 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2327 | while (byte_stream_empty(bs)) { |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2328 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2329 | channel = byte_stream_get16(bs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2330 | aim_info_extract(od, bs, &userinfo); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2331 | nummissed = byte_stream_get16(bs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2332 | reason = byte_stream_get16(bs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2333 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2334 | if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2335 | ret = userfunc(od, conn, frame, channel, &userinfo, nummissed, reason); |
| 13235 | 2336 | |
| 2337 | aim_info_free(&userinfo); | |
| 2338 | } | |
| 2339 | ||
| 2340 | return ret; | |
| 2341 | } | |
| 2342 | ||
| 2343 | /* | |
| 2344 | * Subtype 0x000b | |
| 2345 | * | |
| 2346 | * Possible codes: | |
| 2347 | * AIM_TRANSFER_DENY_NOTSUPPORTED -- "client does not support" | |
| 2348 | * AIM_TRANSFER_DENY_DECLINE -- "client has declined transfer" | |
| 2349 | * AIM_TRANSFER_DENY_NOTACCEPTING -- "client is not accepting transfers" | |
| 2350 | * | |
| 2351 | */ | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2352 | int aim_im_denytransfer(OscarData *od, const char *bn, const guchar *cookie, guint16 code) |
| 13235 | 2353 | { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2354 | FlapConnection *conn; |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
2355 | ByteStream bs; |
| 13235 | 2356 | aim_snacid_t snacid; |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
2357 | GSList *tlvlist = NULL; |
| 13235 | 2358 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
2359 | if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM))) |
| 13235 | 2360 | return -EINVAL; |
| 2361 | ||
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2362 | byte_stream_new(&bs, 8+2+1+strlen(bn)+6); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2363 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
2364 | snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x000b, 0x0000, NULL, 0); |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
2365 | |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
2366 | byte_stream_putraw(&bs, cookie, 8); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
2367 | |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
2368 | byte_stream_put16(&bs, 0x0002); /* channel */ |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2369 | byte_stream_put8(&bs, strlen(bn)); |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2370 | byte_stream_putstr(&bs, bn); |
| 13235 | 2371 | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
2372 | aim_tlvlist_add_16(&tlvlist, 0x0003, code); |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
2373 | aim_tlvlist_write(&bs, &tlvlist); |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
2374 | aim_tlvlist_free(tlvlist); |
| 13235 | 2375 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
2376 | flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x000b, 0x0000, snacid, &bs); |
|
23004
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22862
diff
changeset
|
2377 | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
2378 | byte_stream_destroy(&bs); |
| 13235 | 2379 | |
| 2380 | return 0; | |
| 2381 | } | |
| 2382 | ||
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2383 | static void parse_status_note_text(OscarData *od, guchar *cookie, char *bn, ByteStream *bs) |
|
22548
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2384 | { |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2385 | struct aim_icq_info *info; |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2386 | struct aim_icq_info *prev_info; |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2387 | char *response; |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2388 | char *encoding; |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2389 | char *stripped_encoding; |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2390 | char *status_note_title; |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2391 | char *status_note_text; |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2392 | char *stripped_status_note_text; |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2393 | char *status_note; |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2394 | guint32 length; |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2395 | guint16 version; |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2396 | guint32 capability; |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2397 | guint8 message_type; |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2398 | guint16 status_code; |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2399 | guint16 text_length; |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2400 | guint32 request_length; |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2401 | guint32 response_length; |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2402 | guint32 encoding_length; |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2403 | PurpleAccount *account; |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2404 | PurpleBuddy *buddy; |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2405 | PurplePresence *presence; |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2406 | PurpleStatus *status; |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2407 | |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2408 | for (prev_info = NULL, info = od->icq_info; info != NULL; prev_info = info, info = info->next) |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2409 | { |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2410 | if (memcmp(&info->icbm_cookie, cookie, 8) == 0) |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2411 | { |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2412 | if (prev_info == NULL) |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2413 | od->icq_info = info->next; |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2414 | else |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2415 | prev_info->next = info->next; |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2416 | |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2417 | break; |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2418 | } |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2419 | } |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2420 | |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2421 | if (info == NULL) |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2422 | return; |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2423 | |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2424 | status_note_title = info->status_note_title; |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2425 | g_free(info); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2426 | |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2427 | length = byte_stream_getle16(bs); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2428 | if (length != 27) { |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2429 | purple_debug_misc("oscar", "clientautoresp: incorrect header " |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2430 | "size; expected 27, received %u.\n", length); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2431 | g_free(status_note_title); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2432 | return; |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2433 | } |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2434 | |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2435 | version = byte_stream_getle16(bs); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2436 | if (version != 9) { |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2437 | purple_debug_misc("oscar", "clientautoresp: incorrect version; " |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2438 | "expected 9, received %u.\n", version); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2439 | g_free(status_note_title); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2440 | return; |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2441 | } |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2442 | |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2443 | capability = aim_locate_getcaps(od, bs, 0x10); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2444 | if (capability != OSCAR_CAPABILITY_EMPTY) { |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2445 | purple_debug_misc("oscar", "clientautoresp: plugin ID is not null.\n"); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2446 | g_free(status_note_title); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2447 | return; |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2448 | } |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2449 | |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2450 | byte_stream_advance(bs, 2); /* unknown */ |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2451 | byte_stream_advance(bs, 4); /* client capabilities flags */ |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2452 | byte_stream_advance(bs, 1); /* unknown */ |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2453 | byte_stream_advance(bs, 2); /* downcouner? */ |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2454 | |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2455 | length = byte_stream_getle16(bs); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2456 | if (length != 14) { |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2457 | purple_debug_misc("oscar", "clientautoresp: incorrect header " |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2458 | "size; expected 14, received %u.\n", length); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2459 | g_free(status_note_title); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2460 | return; |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2461 | } |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2462 | |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2463 | byte_stream_advance(bs, 2); /* downcounter? */ |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2464 | byte_stream_advance(bs, 12); /* unknown */ |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2465 | |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2466 | message_type = byte_stream_get8(bs); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2467 | if (message_type != 0x1a) { |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2468 | purple_debug_misc("oscar", "clientautoresp: incorrect message " |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2469 | "type; expected 0x1a, received 0x%x.\n", message_type); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2470 | g_free(status_note_title); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2471 | return; |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2472 | } |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2473 | |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2474 | byte_stream_advance(bs, 1); /* message flags */ |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2475 | |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2476 | status_code = byte_stream_getle16(bs); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2477 | if (status_code != 0) { |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2478 | purple_debug_misc("oscar", "clientautoresp: incorrect status " |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2479 | "code; expected 0, received %u.\n", status_code); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2480 | g_free(status_note_title); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2481 | return; |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2482 | } |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2483 | |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2484 | byte_stream_advance(bs, 2); /* priority code */ |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2485 | |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2486 | text_length = byte_stream_getle16(bs); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2487 | byte_stream_advance(bs, text_length); /* text */ |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2488 | |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2489 | length = byte_stream_getle16(bs); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2490 | byte_stream_advance(bs, 18); /* unknown */ |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2491 | |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2492 | request_length = byte_stream_getle32(bs); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2493 | if (length != 18 + 4 + request_length + 17) { |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2494 | purple_debug_misc("oscar", "clientautoresp: incorrect block; " |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2495 | "expected length is %u, got %u.\n", |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2496 | 18 + 4 + request_length + 17, length); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2497 | g_free(status_note_title); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2498 | return; |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2499 | } |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2500 | |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2501 | byte_stream_advance(bs, request_length); /* x request */ |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2502 | byte_stream_advance(bs, 17); /* unknown */ |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2503 | |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2504 | length = byte_stream_getle32(bs); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2505 | response_length = byte_stream_getle32(bs); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2506 | response = byte_stream_getstr(bs, response_length); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2507 | encoding_length = byte_stream_getle32(bs); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2508 | if (length != 4 + response_length + 4 + encoding_length) { |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2509 | purple_debug_misc("oscar", "clientautoresp: incorrect block; " |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2510 | "expected length is %u, got %u.\n", |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2511 | 4 + response_length + 4 + encoding_length, length); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2512 | g_free(status_note_title); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2513 | g_free(response); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2514 | return; |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2515 | } |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2516 | |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2517 | encoding = byte_stream_getstr(bs, encoding_length); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2518 | |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2519 | account = purple_connection_get_account(od->gc); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2520 | |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2521 | stripped_encoding = oscar_encoding_extract(encoding); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2522 | status_note_text = oscar_encoding_to_utf8(account, stripped_encoding, response, response_length); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2523 | stripped_status_note_text = purple_markup_strip_html(status_note_text); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2524 | |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2525 | if (stripped_status_note_text != NULL && stripped_status_note_text[0] != 0) |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2526 | status_note = g_strdup_printf("%s: %s", status_note_title, stripped_status_note_text); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2527 | else |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2528 | status_note = g_strdup(status_note_title); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2529 | |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2530 | g_free(status_note_title); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2531 | g_free(response); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2532 | g_free(encoding); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2533 | g_free(stripped_encoding); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2534 | g_free(status_note_text); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2535 | g_free(stripped_status_note_text); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2536 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2537 | buddy = purple_find_buddy(account, bn); |
|
22548
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2538 | if (buddy == NULL) |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2539 | { |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2540 | purple_debug_misc("oscar", "clientautoresp: buddy %s was not found.\n", bn); |
|
22548
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2541 | g_free(status_note); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2542 | return; |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2543 | } |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2544 | |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2545 | purple_debug_misc("oscar", "clientautoresp: setting status " |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2546 | "message to \"%s\".\n", status_note); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2547 | |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2548 | presence = purple_buddy_get_presence(buddy); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2549 | status = purple_presence_get_active_status(presence); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2550 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2551 | purple_prpl_got_user_status(account, bn, |
|
22548
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2552 | purple_status_get_id(status), |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2553 | "message", status_note, NULL); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2554 | |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2555 | g_free(status_note); |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2556 | } |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2557 | |
| 13235 | 2558 | /* |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2559 | * Subtype 0x000b - Receive the response from an ICQ status message |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2560 | * request (in which case this contains the ICQ status message) or |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2561 | * a file transfer or direct IM request was declined. |
| 13235 | 2562 | */ |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2563 | static int clientautoresp(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
| 13235 | 2564 | { |
| 2565 | int ret = 0; | |
| 2566 | aim_rxcallback_t userfunc; | |
| 2567 | guint16 channel, reason; | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2568 | char *bn; |
| 13235 | 2569 | guchar *cookie; |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2570 | guint8 bnlen; |
| 13235 | 2571 | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2572 | cookie = byte_stream_getraw(bs, 8); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2573 | channel = byte_stream_get16(bs); |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2574 | bnlen = byte_stream_get8(bs); |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2575 | bn = byte_stream_getstr(bs, bnlen); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2576 | reason = byte_stream_get16(bs); |
| 13235 | 2577 | |
|
22125
57b7d398c30e
Partial support for reading ICQ 6 status notes. The status note will
Mark Doliner <markdoliner@pidgin.im>
parents:
21841
diff
changeset
|
2578 | if (channel == 0x0002) |
|
57b7d398c30e
Partial support for reading ICQ 6 status notes. The status note will
Mark Doliner <markdoliner@pidgin.im>
parents:
21841
diff
changeset
|
2579 | { |
|
22548
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2580 | if (reason == 0x0003) /* channel-specific */ |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
2581 | /* parse status note text */ |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2582 | parse_status_note_text(od, cookie, bn, bs); |
|
22125
57b7d398c30e
Partial support for reading ICQ 6 status notes. The status note will
Mark Doliner <markdoliner@pidgin.im>
parents:
21841
diff
changeset
|
2583 | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2584 | byte_stream_get16(bs); /* Unknown */ |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2585 | byte_stream_get16(bs); /* Unknown */ |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2586 | if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2587 | ret = userfunc(od, conn, frame, channel, bn, reason, cookie); |
|
22125
57b7d398c30e
Partial support for reading ICQ 6 status notes. The status note will
Mark Doliner <markdoliner@pidgin.im>
parents:
21841
diff
changeset
|
2588 | |
| 13235 | 2589 | } else if (channel == 0x0004) { /* ICQ message */ |
| 2590 | switch (reason) { | |
| 2591 | case 0x0003: { /* ICQ status message. Maybe other stuff too, you never know with these people. */ | |
| 2592 | guint8 statusmsgtype, *msg; | |
| 2593 | guint16 len; | |
| 2594 | guint32 state; | |
| 2595 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2596 | len = byte_stream_getle16(bs); /* Should be 0x001b */ |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2597 | byte_stream_advance(bs, len); /* Unknown */ |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2598 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2599 | len = byte_stream_getle16(bs); /* Should be 0x000e */ |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2600 | byte_stream_advance(bs, len); /* Unknown */ |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2601 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2602 | statusmsgtype = byte_stream_getle8(bs); |
| 13235 | 2603 | switch (statusmsgtype) { |
| 2604 | case 0xe8: | |
| 2605 | state = AIM_ICQ_STATE_AWAY; | |
| 2606 | break; | |
| 2607 | case 0xe9: | |
| 2608 | state = AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_BUSY; | |
| 2609 | break; | |
| 2610 | case 0xea: | |
| 2611 | state = AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_OUT; | |
| 2612 | break; | |
| 2613 | case 0xeb: | |
| 2614 | state = AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_DND | AIM_ICQ_STATE_BUSY; | |
| 2615 | break; | |
| 2616 | case 0xec: | |
| 2617 | state = AIM_ICQ_STATE_CHAT; | |
| 2618 | break; | |
| 2619 | default: | |
| 2620 | state = 0; | |
| 2621 | break; | |
| 2622 | } | |
| 2623 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2624 | byte_stream_getle8(bs); /* Unknown - 0x03 Maybe this means this is an auto-reply */ |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2625 | byte_stream_getle16(bs); /* Unknown - 0x0000 */ |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2626 | byte_stream_getle16(bs); /* Unknown - 0x0000 */ |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2627 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2628 | len = byte_stream_getle16(bs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2629 | msg = byte_stream_getraw(bs, len); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2630 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2631 | if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2632 | ret = userfunc(od, conn, frame, channel, bn, reason, state, msg); |
| 13235 | 2633 | |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
2634 | g_free(msg); |
| 13235 | 2635 | } break; |
| 2636 | ||
| 2637 | default: { | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2638 | if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2639 | ret = userfunc(od, conn, frame, channel, bn, reason); |
| 13235 | 2640 | } break; |
| 2641 | } /* end switch */ | |
| 2642 | } | |
| 2643 | ||
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
2644 | g_free(cookie); |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2645 | g_free(bn); |
| 13235 | 2646 | |
| 2647 | return ret; | |
| 2648 | } | |
| 2649 | ||
| 2650 | /* | |
| 2651 | * Subtype 0x000c - Receive an ack after sending an ICBM. | |
| 2652 | * | |
| 2653 | * You have to have send the message with the AIM_IMFLAGS_ACK flag set | |
| 2654 | * (TLV t(0003)). The ack contains the ICBM header of the message you | |
| 2655 | * sent. | |
| 2656 | * | |
| 2657 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2658 | static int msgack(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
| 13235 | 2659 | { |
| 2660 | aim_rxcallback_t userfunc; | |
| 2661 | guint16 ch; | |
| 2662 | guchar *cookie; | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2663 | char *bn; |
| 13235 | 2664 | int ret = 0; |
| 2665 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2666 | cookie = byte_stream_getraw(bs, 8); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2667 | ch = byte_stream_get16(bs); |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2668 | bn = byte_stream_getstr(bs, byte_stream_get8(bs)); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2669 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2670 | if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2671 | ret = userfunc(od, conn, frame, ch, bn); |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2672 | |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2673 | g_free(bn); |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
2674 | g_free(cookie); |
| 13235 | 2675 | |
| 2676 | return ret; | |
| 2677 | } | |
| 2678 | ||
| 2679 | /* | |
|
22479
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
2680 | * Subtype 0x0010 - Request any offline messages that are waiting for |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
2681 | * us. This is the "new" way of handling offline messages which is |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
2682 | * used for both AIM and ICQ. The old way is to use the ugly |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
2683 | * aim_icq_reqofflinemsgs() function, but that is no longer necessary. |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
2684 | * |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
2685 | * We set the 0x00000100 flag on the ICBM message parameters, which |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
2686 | * tells the oscar servers that we support offline messages. When we |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
2687 | * set that flag the servers do not automatically send us offline |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
2688 | * messages. Instead we must request them using this function. This |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
2689 | * should happen after sending the 0x0001/0x0002 "client online" SNAC. |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
2690 | */ |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
2691 | int aim_im_reqofflinemsgs(OscarData *od) |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
2692 | { |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
2693 | FlapConnection *conn; |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
2694 | |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
2695 | if (!od || !(conn = flap_connection_findbygroup(od, 0x0002))) |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
2696 | return -EINVAL; |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
2697 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
2698 | aim_genericreq_n(od, conn, SNAC_FAMILY_ICBM, 0x0010); |
|
22479
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
2699 | |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
2700 | return 0; |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
2701 | } |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
2702 | |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
2703 | /* |
| 13235 | 2704 | * Subtype 0x0014 - Send a mini typing notification (mtn) packet. |
| 2705 | * | |
| 2706 | * This is supported by winaim5 and newer, MacAIM bleh and newer, iChat bleh and newer, | |
| 15884 | 2707 | * and Purple 0.60 and newer. |
| 13235 | 2708 | * |
| 2709 | */ | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2710 | int aim_im_sendmtn(OscarData *od, guint16 type1, const char *bn, guint16 type2) |
| 13235 | 2711 | { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2712 | FlapConnection *conn; |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
2713 | ByteStream bs; |
| 13235 | 2714 | aim_snacid_t snacid; |
| 2715 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2716 | if (!od || !(conn = flap_connection_findbygroup(od, 0x0002))) |
| 13235 | 2717 | return -EINVAL; |
| 2718 | ||
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2719 | if (!bn) |
| 13235 | 2720 | return -EINVAL; |
| 2721 | ||
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2722 | byte_stream_new(&bs, 11+strlen(bn)+2); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2723 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
2724 | snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0014, 0x0000, NULL, 0); |
| 13235 | 2725 | |
| 2726 | /* | |
| 2727 | * 8 days of light | |
| 2728 | * Er, that is to say, 8 bytes of 0's | |
| 2729 | */ | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
2730 | byte_stream_put16(&bs, 0x0000); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
2731 | byte_stream_put16(&bs, 0x0000); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
2732 | byte_stream_put16(&bs, 0x0000); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
2733 | byte_stream_put16(&bs, 0x0000); |
| 13235 | 2734 | |
| 2735 | /* | |
| 2736 | * Type 1 (should be 0x0001 for mtn) | |
| 2737 | */ | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
2738 | byte_stream_put16(&bs, type1); |
| 13235 | 2739 | |
| 2740 | /* | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2741 | * Dest buddy name |
| 13235 | 2742 | */ |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2743 | byte_stream_put8(&bs, strlen(bn)); |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2744 | byte_stream_putstr(&bs, bn); |
| 13235 | 2745 | |
| 2746 | /* | |
| 2747 | * Type 2 (should be 0x0000, 0x0001, or 0x0002 for mtn) | |
| 2748 | */ | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
2749 | byte_stream_put16(&bs, type2); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
2750 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
2751 | flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0014, 0x0000, snacid, &bs); |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
2752 | |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22548
diff
changeset
|
2753 | byte_stream_destroy(&bs); |
|
23004
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22862
diff
changeset
|
2754 | |
| 13235 | 2755 | return 0; |
| 2756 | } | |
| 2757 | ||
| 2758 | /* | |
| 2759 | * Subtype 0x0014 - Receive a mini typing notification (mtn) packet. | |
| 2760 | * | |
| 2761 | * This is supported by winaim5 and newer, MacAIM bleh and newer, iChat bleh and newer, | |
| 15884 | 2762 | * and Purple 0.60 and newer. |
| 13235 | 2763 | * |
| 2764 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2765 | static int mtn_receive(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
| 13235 | 2766 | { |
| 2767 | int ret = 0; | |
| 2768 | aim_rxcallback_t userfunc; | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2769 | char *bn; |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2770 | guint8 bnlen; |
| 13235 | 2771 | guint16 type1, type2; |
| 2772 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2773 | byte_stream_advance(bs, 8); /* Unknown - All 0's */ |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2774 | type1 = byte_stream_get16(bs); |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2775 | bnlen = byte_stream_get8(bs); |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2776 | bn = byte_stream_getstr(bs, bnlen); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2777 | type2 = byte_stream_get16(bs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2778 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2779 | if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2780 | ret = userfunc(od, conn, frame, type1, bn, type2); |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2781 | |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2782 | g_free(bn); |
| 13235 | 2783 | |
| 2784 | return ret; | |
| 2785 | } | |
| 2786 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2787 | static int |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2788 | snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
| 13235 | 2789 | { |
| 2790 | if (snac->subtype == 0x0005) | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2791 | return aim_im_paraminfo(od, conn, mod, frame, snac, bs); |
| 13235 | 2792 | else if (snac->subtype == 0x0006) |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2793 | return outgoingim(od, conn, mod, frame, snac, bs); |
| 13235 | 2794 | else if (snac->subtype == 0x0007) |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2795 | return incomingim(od, conn, mod, frame, snac, bs); |
| 13235 | 2796 | else if (snac->subtype == 0x000a) |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2797 | return missedcall(od, conn, mod, frame, snac, bs); |
| 13235 | 2798 | else if (snac->subtype == 0x000b) |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2799 | return clientautoresp(od, conn, mod, frame, snac, bs); |
| 13235 | 2800 | else if (snac->subtype == 0x000c) |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2801 | return msgack(od, conn, mod, frame, snac, bs); |
| 13235 | 2802 | else if (snac->subtype == 0x0014) |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2803 | return mtn_receive(od, conn, mod, frame, snac, bs); |
| 13235 | 2804 | |
| 2805 | return 0; | |
| 2806 | } | |
| 2807 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2808 | int |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2809 | msg_modfirst(OscarData *od, aim_module_t *mod) |
| 13235 | 2810 | { |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
2811 | mod->family = SNAC_FAMILY_ICBM; |
| 13235 | 2812 | mod->version = 0x0001; |
| 2813 | mod->toolid = 0x0110; | |
| 2814 | mod->toolversion = 0x0629; | |
| 2815 | mod->flags = 0; | |
| 2816 | strncpy(mod->name, "messaging", sizeof(mod->name)); | |
| 2817 | mod->snachandler = snachandler; | |
| 2818 | ||
| 2819 | return 0; | |
| 2820 | } |