Wed, 12 Dec 2018 16:43:40 -0600
oscar: Remove dead usage of tm.tm_gmtoff and HAVE_TM_GMTOFF config
Oscar at one time used tm.tm_gmtoff in order to offset a timestamp.
Now, the function is always passed 0 for the timestamp, which avoids
this code path. Therefore, this patch removes the timestamp argument
from the function, removes the dead code path which included the only
usage of tm.tm_gmtoff, and gets rid of the check/setting in meson for
HAVE_TM_GMTOFF.
| 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 | ||
|
30666
ff138d6c7bc4
Got rid of receiving multipart messages over channel 1, which simplified the code
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30665
diff
changeset
|
47 | #include "encoding.h" |
| 13235 | 48 | #include "oscar.h" |
| 49 | #include "peer.h" | |
| 50 | ||
|
22125
57b7d398c30e
Partial support for reading ICQ 6 status notes. The status note will
Mark Doliner <markdoliner@pidgin.im>
parents:
21841
diff
changeset
|
51 | #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
|
52 | |
|
30296
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
53 | static const char * const errcodereason[] = { |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
54 | N_("Invalid error"), |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
55 | N_("Not logged in"), |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
56 | N_("Cannot receive IM due to parental controls"), |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
57 | N_("Cannot send SMS without accepting terms"), |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
58 | N_("Cannot send SMS"), /* SMS_WITHOUT_DISCLAIMER is weird */ |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
59 | N_("Cannot send SMS to this country"), |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
60 | N_("Unknown error"), /* Undocumented */ |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
61 | N_("Unknown error"), /* Undocumented */ |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
62 | N_("Cannot send SMS to unknown country"), |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
63 | N_("Bot accounts cannot initiate IMs"), |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
64 | N_("Bot account cannot IM this user"), |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
65 | N_("Bot account reached IM limit"), |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
66 | N_("Bot account reached daily IM limit"), |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
67 | N_("Bot account reached monthly IM limit"), |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
68 | N_("Unable to receive offline messages"), |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
69 | N_("Offline message store full") |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
70 | }; |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
71 | static const int errcodereasonlen = G_N_ELEMENTS(errcodereason); |
|
22125
57b7d398c30e
Partial support for reading ICQ 6 status notes. The status note will
Mark Doliner <markdoliner@pidgin.im>
parents:
21841
diff
changeset
|
72 | |
| 13235 | 73 | /** |
| 74 | * Add a standard ICBM header to the given bstream with the given | |
| 75 | * information. | |
| 76 | * | |
| 77 | * @param bs The bstream to write the ICBM header to. | |
| 78 | * @param c c is for cookie, and cookie is for me. | |
| 79 | * @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
|
80 | * @param bn Null-terminated scrizeen nizame. |
| 13235 | 81 | * @return The number of bytes written. It's really not useful. |
| 82 | */ | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
83 | static int aim_im_puticbm(ByteStream *bs, const guchar *c, guint16 channel, const char *bn) |
| 13235 | 84 | { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
85 | byte_stream_putraw(bs, c, 8); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
86 | 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
|
87 | 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
|
88 | 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
|
89 | return 8+2+1+strlen(bn); |
| 13235 | 90 | } |
| 91 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
92 | /** |
| 13235 | 93 | * Generates a random ICBM cookie in a character array of length 8 |
| 94 | * and copies it into the variable passed as cookie | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
95 | * TODO: Maybe we should stop limiting our characters to the visible range? |
| 13235 | 96 | */ |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
97 | void aim_icbm_makecookie(guchar *cookie) |
| 13235 | 98 | { |
| 99 | int i; | |
| 100 | ||
| 101 | /* Should be like "21CBF95" and null terminated */ | |
| 102 | for (i = 0; i < 7; i++) | |
|
38199
8fe1c3be007c
Fix coverity 1255958
Gary Kramlich <grim@reaperworld.com>
parents:
37523
diff
changeset
|
103 | cookie[i] = 0x30 + ((guchar)g_random_int() % 10); |
| 13235 | 104 | cookie[7] = '\0'; |
| 105 | } | |
| 106 | ||
| 107 | /* | |
|
28806
a724c42684d3
oscar: Display more detailed error messages when an outgoing message is bounced.
Aman Gupta <aman@tmm1.net>
parents:
28522
diff
changeset
|
108 | * Subtype 0x0001 - Error |
|
a724c42684d3
oscar: Display more detailed error messages when an outgoing message is bounced.
Aman Gupta <aman@tmm1.net>
parents:
28522
diff
changeset
|
109 | */ |
|
a724c42684d3
oscar: Display more detailed error messages when an outgoing message is bounced.
Aman Gupta <aman@tmm1.net>
parents:
28522
diff
changeset
|
110 | static int |
|
a724c42684d3
oscar: Display more detailed error messages when an outgoing message is bounced.
Aman Gupta <aman@tmm1.net>
parents:
28522
diff
changeset
|
111 | error(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
|
a724c42684d3
oscar: Display more detailed error messages when an outgoing message is bounced.
Aman Gupta <aman@tmm1.net>
parents:
28522
diff
changeset
|
112 | { |
|
a724c42684d3
oscar: Display more detailed error messages when an outgoing message is bounced.
Aman Gupta <aman@tmm1.net>
parents:
28522
diff
changeset
|
113 | aim_snac_t *snac2; |
|
a724c42684d3
oscar: Display more detailed error messages when an outgoing message is bounced.
Aman Gupta <aman@tmm1.net>
parents:
28522
diff
changeset
|
114 | guint16 reason, errcode = 0; |
|
30296
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
115 | const char *bn; |
|
28806
a724c42684d3
oscar: Display more detailed error messages when an outgoing message is bounced.
Aman Gupta <aman@tmm1.net>
parents:
28522
diff
changeset
|
116 | GSList *tlvlist; |
|
30296
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
117 | PurpleConnection *gc = od->gc; |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
118 | #ifdef TODOFT |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
119 | PurpleXfer *xfer; |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
120 | #endif |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
121 | const char *reason_str; |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
122 | char *buf; |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
123 | |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
124 | snac2 = aim_remsnac(od, snac->id); |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
125 | if (!snac2) { |
|
28806
a724c42684d3
oscar: Display more detailed error messages when an outgoing message is bounced.
Aman Gupta <aman@tmm1.net>
parents:
28522
diff
changeset
|
126 | purple_debug_misc("oscar", "icbm error: received response from unknown request!\n"); |
|
30294
3633ae94f15e
If we get an error SNAC on the ICBM family and it's missing buddy name then
Mark Doliner <markdoliner@pidgin.im>
parents:
30270
diff
changeset
|
127 | return 1; |
|
28806
a724c42684d3
oscar: Display more detailed error messages when an outgoing message is bounced.
Aman Gupta <aman@tmm1.net>
parents:
28522
diff
changeset
|
128 | } |
|
a724c42684d3
oscar: Display more detailed error messages when an outgoing message is bounced.
Aman Gupta <aman@tmm1.net>
parents:
28522
diff
changeset
|
129 | |
|
a724c42684d3
oscar: Display more detailed error messages when an outgoing message is bounced.
Aman Gupta <aman@tmm1.net>
parents:
28522
diff
changeset
|
130 | if (snac2->family != SNAC_FAMILY_ICBM) { |
|
a724c42684d3
oscar: Display more detailed error messages when an outgoing message is bounced.
Aman Gupta <aman@tmm1.net>
parents:
28522
diff
changeset
|
131 | purple_debug_misc("oscar", "icbm error: received response from invalid request! %d\n", snac2->family); |
|
a724c42684d3
oscar: Display more detailed error messages when an outgoing message is bounced.
Aman Gupta <aman@tmm1.net>
parents:
28522
diff
changeset
|
132 | g_free(snac2->data); |
|
a724c42684d3
oscar: Display more detailed error messages when an outgoing message is bounced.
Aman Gupta <aman@tmm1.net>
parents:
28522
diff
changeset
|
133 | g_free(snac2); |
|
30294
3633ae94f15e
If we get an error SNAC on the ICBM family and it's missing buddy name then
Mark Doliner <markdoliner@pidgin.im>
parents:
30270
diff
changeset
|
134 | return 1; |
|
28806
a724c42684d3
oscar: Display more detailed error messages when an outgoing message is bounced.
Aman Gupta <aman@tmm1.net>
parents:
28522
diff
changeset
|
135 | } |
|
a724c42684d3
oscar: Display more detailed error messages when an outgoing message is bounced.
Aman Gupta <aman@tmm1.net>
parents:
28522
diff
changeset
|
136 | |
|
30296
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
137 | /* Data is assumed to be the destination bn */ |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
138 | bn = snac2->data; |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
139 | if (!bn || bn[0] == '\0') { |
|
28806
a724c42684d3
oscar: Display more detailed error messages when an outgoing message is bounced.
Aman Gupta <aman@tmm1.net>
parents:
28522
diff
changeset
|
140 | purple_debug_misc("oscar", "icbm error: received response from request without a buddy name!\n"); |
|
30296
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
141 | g_free(snac2->data); |
|
28806
a724c42684d3
oscar: Display more detailed error messages when an outgoing message is bounced.
Aman Gupta <aman@tmm1.net>
parents:
28522
diff
changeset
|
142 | g_free(snac2); |
|
30294
3633ae94f15e
If we get an error SNAC on the ICBM family and it's missing buddy name then
Mark Doliner <markdoliner@pidgin.im>
parents:
30270
diff
changeset
|
143 | return 1; |
|
28806
a724c42684d3
oscar: Display more detailed error messages when an outgoing message is bounced.
Aman Gupta <aman@tmm1.net>
parents:
28522
diff
changeset
|
144 | } |
|
a724c42684d3
oscar: Display more detailed error messages when an outgoing message is bounced.
Aman Gupta <aman@tmm1.net>
parents:
28522
diff
changeset
|
145 | |
|
a724c42684d3
oscar: Display more detailed error messages when an outgoing message is bounced.
Aman Gupta <aman@tmm1.net>
parents:
28522
diff
changeset
|
146 | reason = byte_stream_get16(bs); |
|
a724c42684d3
oscar: Display more detailed error messages when an outgoing message is bounced.
Aman Gupta <aman@tmm1.net>
parents:
28522
diff
changeset
|
147 | |
|
a724c42684d3
oscar: Display more detailed error messages when an outgoing message is bounced.
Aman Gupta <aman@tmm1.net>
parents:
28522
diff
changeset
|
148 | tlvlist = aim_tlvlist_read(bs); |
|
a724c42684d3
oscar: Display more detailed error messages when an outgoing message is bounced.
Aman Gupta <aman@tmm1.net>
parents:
28522
diff
changeset
|
149 | if (aim_tlv_gettlv(tlvlist, 0x0008, 1)) |
|
a724c42684d3
oscar: Display more detailed error messages when an outgoing message is bounced.
Aman Gupta <aman@tmm1.net>
parents:
28522
diff
changeset
|
150 | errcode = aim_tlv_get16(tlvlist, 0x0008, 1); |
|
a724c42684d3
oscar: Display more detailed error messages when an outgoing message is bounced.
Aman Gupta <aman@tmm1.net>
parents:
28522
diff
changeset
|
151 | aim_tlvlist_free(tlvlist); |
|
a724c42684d3
oscar: Display more detailed error messages when an outgoing message is bounced.
Aman Gupta <aman@tmm1.net>
parents:
28522
diff
changeset
|
152 | |
|
30296
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
153 | purple_debug_error("oscar", |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
154 | "Message error with bn %s and reason %hu and errcode %hu\n", |
|
33770
6625cbf09e08
Fix various other minor issues identified in the coverity scan.
Daniel Atallah <datallah@pidgin.im>
parents:
31274
diff
changeset
|
155 | bn, reason, errcode); |
|
30296
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
156 | |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
157 | #ifdef TODOFT |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
158 | /* If this was a file transfer request, bn is a cookie */ |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
159 | if ((xfer = oscar_find_xfer_by_cookie(od->file_transfers, bn))) { |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
160 | purple_xfer_cancel_remote(xfer); |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
161 | return 1; |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
162 | } |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
163 | #endif |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
164 | |
|
28806
a724c42684d3
oscar: Display more detailed error messages when an outgoing message is bounced.
Aman Gupta <aman@tmm1.net>
parents:
28522
diff
changeset
|
165 | /* Notify the user that the message wasn't delivered */ |
|
30296
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
166 | reason_str = oscar_get_msgerr_reason(reason); |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
167 | if (errcode != 0 && errcode < errcodereasonlen) |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
168 | buf = g_strdup_printf(_("Unable to send message: %s (%s)"), reason_str, |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
169 | _(errcodereason[errcode])); |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
170 | else |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
171 | buf = g_strdup_printf(_("Unable to send message: %s"), reason_str); |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
172 | |
|
34868
faa5b053f310
Replaced purple_conversation_helper_present_error() with simpler purple_conversation_present_error()
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
173 | if (!purple_conversation_present_error(bn, purple_connection_get_account(gc), buf)) { |
|
30296
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
174 | g_free(buf); |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
175 | if (errcode != 0 && errcode < errcodereasonlen) |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
176 | buf = g_strdup_printf(_("Unable to send message to %s: %s (%s)"), |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
177 | bn ? bn : "(unknown)", reason_str, |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
178 | _(errcodereason[errcode])); |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
179 | else |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
180 | buf = g_strdup_printf(_("Unable to send message to %s: %s"), |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
181 | bn ? bn : "(unknown)", reason_str); |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33892
diff
changeset
|
182 | purple_notify_error(od->gc, NULL, buf, reason_str, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33892
diff
changeset
|
183 | purple_request_cpar_from_connection(od->gc)); |
|
30295
f3e30ad0034a
Super tiny optimisation
Mark Doliner <markdoliner@pidgin.im>
parents:
30294
diff
changeset
|
184 | } |
|
30296
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
185 | g_free(buf); |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
186 | |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
187 | g_free(snac2->data); |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
188 | g_free(snac2); |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
189 | |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
30295
diff
changeset
|
190 | return 1; |
|
28806
a724c42684d3
oscar: Display more detailed error messages when an outgoing message is bounced.
Aman Gupta <aman@tmm1.net>
parents:
28522
diff
changeset
|
191 | } |
|
a724c42684d3
oscar: Display more detailed error messages when an outgoing message is bounced.
Aman Gupta <aman@tmm1.net>
parents:
28522
diff
changeset
|
192 | |
| 13235 | 193 | /** |
| 194 | * Subtype 0x0002 - Set ICBM parameters. | |
| 195 | * | |
| 196 | * I definitely recommend sending this. If you don't, you'll be stuck | |
| 197 | * with the rather unreasonable defaults. | |
| 198 | * | |
| 199 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
200 | int aim_im_setparams(OscarData *od, struct aim_icbmparameters *params) |
| 13235 | 201 | { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
202 | 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
|
203 | ByteStream bs; |
| 13235 | 204 | aim_snacid_t snacid; |
| 205 | ||
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
206 | if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM))) |
| 13235 | 207 | return -EINVAL; |
| 208 | ||
| 209 | if (!params) | |
| 210 | return -EINVAL; | |
| 211 | ||
|
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
|
212 | byte_stream_new(&bs, 16); |
| 13235 | 213 | |
| 214 | /* 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
|
215 | byte_stream_put16(&bs, 0x0000); |
| 13235 | 216 | |
| 217 | /* 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
|
218 | 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
|
219 | 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
|
220 | 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
|
221 | 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
|
222 | 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
|
223 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
224 | snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0002, 0x0000, NULL, 0); |
|
30678
78aacd015725
Removed unused "flags" parameter.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30677
diff
changeset
|
225 | flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0002, snacid, &bs); |
|
23004
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22862
diff
changeset
|
226 | |
|
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
|
227 | byte_stream_destroy(&bs); |
|
23004
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22862
diff
changeset
|
228 | |
| 13235 | 229 | return 0; |
| 230 | } | |
| 231 | ||
| 232 | /** | |
| 233 | * Subtype 0x0004 - Request ICBM parameter information. | |
| 234 | * | |
| 235 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
236 | int aim_im_reqparams(OscarData *od) |
| 13235 | 237 | { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
238 | FlapConnection *conn; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
239 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
240 | if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM))) |
| 13235 | 241 | return -EINVAL; |
| 242 | ||
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
243 | aim_genericreq_n_snacid(od, conn, SNAC_FAMILY_ICBM, 0x0004); |
|
13610
b2c15a312144
[gaim-migrate @ 15995]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
244 | |
|
b2c15a312144
[gaim-migrate @ 15995]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
245 | return 0; |
| 13235 | 246 | } |
| 247 | ||
| 248 | /** | |
| 249 | * Subtype 0x0005 - Receive parameter information. | |
| 250 | * | |
| 251 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
252 | static int aim_im_paraminfo(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
| 13235 | 253 | { |
| 254 | struct aim_icbmparameters params; | |
| 255 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
256 | params.maxchan = byte_stream_get16(bs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
257 | params.flags = byte_stream_get32(bs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
258 | params.maxmsglen = byte_stream_get16(bs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
259 | params.maxsenderwarn = byte_stream_get16(bs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
260 | params.maxrecverwarn = byte_stream_get16(bs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
261 | params.minmsginterval = byte_stream_get32(bs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
262 | |
|
27784
1d2485951c7b
Set the "we support SMS!" ICBM flag. This causes buddies with mobile
Mark Doliner <markdoliner@pidgin.im>
parents:
27442
diff
changeset
|
263 | params.flags = AIM_IMPARAM_FLAG_CHANNEL_MSGS_ALLOWED |
|
1d2485951c7b
Set the "we support SMS!" ICBM flag. This causes buddies with mobile
Mark Doliner <markdoliner@pidgin.im>
parents:
27442
diff
changeset
|
264 | | AIM_IMPARAM_FLAG_MISSED_CALLS_ENABLED |
|
1d2485951c7b
Set the "we support SMS!" ICBM flag. This causes buddies with mobile
Mark Doliner <markdoliner@pidgin.im>
parents:
27442
diff
changeset
|
265 | | AIM_IMPARAM_FLAG_EVENTS_ALLOWED |
|
1d2485951c7b
Set the "we support SMS!" ICBM flag. This causes buddies with mobile
Mark Doliner <markdoliner@pidgin.im>
parents:
27442
diff
changeset
|
266 | | AIM_IMPARAM_FLAG_SMS_SUPPORTED |
|
30020
a1df7f21110a
Rename this flag and add a happy bumble bee comment
Mark Doliner <markdoliner@pidgin.im>
parents:
30017
diff
changeset
|
267 | | AIM_IMPARAM_FLAG_OFFLINE_MSGS_ALLOWED |
|
a1df7f21110a
Rename this flag and add a happy bumble bee comment
Mark Doliner <markdoliner@pidgin.im>
parents:
30017
diff
changeset
|
268 | | AIM_IMPARAM_FLAG_USE_HTML_FOR_ICQ; |
|
21840
e92b7114fb8b
Get rid of one little userfunc callback and just call aim_im_setparams()
Mark Doliner <markdoliner@pidgin.im>
parents:
19859
diff
changeset
|
269 | 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
|
270 | 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
|
271 | |
|
e92b7114fb8b
Get rid of one little userfunc callback and just call aim_im_setparams()
Mark Doliner <markdoliner@pidgin.im>
parents:
19859
diff
changeset
|
272 | aim_im_setparams(od, ¶ms); |
| 13235 | 273 | |
| 274 | return 0; | |
| 275 | } | |
| 276 | ||
| 277 | /** | |
| 278 | * Subtype 0x0006 - Send an ICBM (instant message). | |
| 279 | * | |
| 280 | * | |
| 281 | * Possible flags: | |
| 282 | * AIM_IMFLAGS_AWAY -- Marks the message as an autoresponse | |
| 283 | * AIM_IMFLAGS_OFFLINE--If destination is offline, store it until they are | |
| 284 | * online (probably ICQ only). | |
| 285 | * | |
| 286 | * Implementation note: Since this is one of the most-used functions | |
| 287 | * in all of libfaim, it is written with performance in mind. As such, | |
| 288 | * it is not as clear as it could be in respect to how this message is | |
| 289 | * supposed to be layed out. Most obviously, tlvlists should be used | |
| 290 | * instead of writing out the bytes manually. | |
| 291 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
292 | int aim_im_sendch1_ext(OscarData *od, struct aim_sendimext_args *args) |
| 13235 | 293 | { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
294 | FlapConnection *conn; |
| 13235 | 295 | aim_snacid_t snacid; |
|
15150
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
296 | ByteStream data; |
| 13235 | 297 | guchar cookie[8]; |
| 298 | int msgtlvlen; | |
| 299 | ||
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
300 | if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM))) |
| 13235 | 301 | return -EINVAL; |
| 302 | ||
| 303 | if (!args) | |
| 304 | return -EINVAL; | |
| 305 | ||
|
30660
cd134a2014f2
Stop using custom encodings (and LATIN-1, for that matter) for sending
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30657
diff
changeset
|
306 | if (!args->msg || (args->msglen <= 0)) |
|
cd134a2014f2
Stop using custom encodings (and LATIN-1, for that matter) for sending
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30657
diff
changeset
|
307 | return -EINVAL; |
| 13235 | 308 | |
|
30660
cd134a2014f2
Stop using custom encodings (and LATIN-1, for that matter) for sending
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30657
diff
changeset
|
309 | if (args->msglen > MAXMSGLEN) |
|
cd134a2014f2
Stop using custom encodings (and LATIN-1, for that matter) for sending
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30657
diff
changeset
|
310 | return -E2BIG; |
| 13235 | 311 | |
| 312 | /* Painfully calculate the size of the message TLV */ | |
| 313 | msgtlvlen = 1 + 1; /* 0501 */ | |
|
30660
cd134a2014f2
Stop using custom encodings (and LATIN-1, for that matter) for sending
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30657
diff
changeset
|
314 | msgtlvlen += 2 + args->featureslen; |
|
cd134a2014f2
Stop using custom encodings (and LATIN-1, for that matter) for sending
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30657
diff
changeset
|
315 | msgtlvlen += 2 /* 0101 */ + 2 /* block len */; |
|
cd134a2014f2
Stop using custom encodings (and LATIN-1, for that matter) for sending
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30657
diff
changeset
|
316 | msgtlvlen += 4 /* charset */ + args->msglen; |
| 13235 | 317 | |
|
15151
bb985812fefa
[gaim-migrate @ 17875]
Mark Doliner <markdoliner@pidgin.im>
parents:
15150
diff
changeset
|
318 | byte_stream_new(&data, msgtlvlen + 128); |
| 13235 | 319 | |
| 320 | /* Generate an ICBM cookie */ | |
| 321 | aim_icbm_makecookie(cookie); | |
| 322 | ||
| 323 | /* 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
|
324 | aim_im_puticbm(&data, cookie, 0x0001, args->destbn); |
| 13235 | 325 | |
| 326 | /* Message TLV (type 0x0002) */ | |
|
15150
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
327 | byte_stream_put16(&data, 0x0002); |
|
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
328 | byte_stream_put16(&data, msgtlvlen); |
| 13235 | 329 | |
| 330 | /* Features TLV (type 0x0501) */ | |
|
15150
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
331 | byte_stream_put16(&data, 0x0501); |
|
30660
cd134a2014f2
Stop using custom encodings (and LATIN-1, for that matter) for sending
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30657
diff
changeset
|
332 | byte_stream_put16(&data, args->featureslen); |
|
cd134a2014f2
Stop using custom encodings (and LATIN-1, for that matter) for sending
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30657
diff
changeset
|
333 | byte_stream_putraw(&data, args->features, args->featureslen); |
| 13235 | 334 | |
|
30660
cd134a2014f2
Stop using custom encodings (and LATIN-1, for that matter) for sending
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30657
diff
changeset
|
335 | /* Insert message text in a TLV (type 0x0101) */ |
|
cd134a2014f2
Stop using custom encodings (and LATIN-1, for that matter) for sending
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30657
diff
changeset
|
336 | byte_stream_put16(&data, 0x0101); |
| 13235 | 337 | |
|
30660
cd134a2014f2
Stop using custom encodings (and LATIN-1, for that matter) for sending
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30657
diff
changeset
|
338 | /* Message block length */ |
|
cd134a2014f2
Stop using custom encodings (and LATIN-1, for that matter) for sending
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30657
diff
changeset
|
339 | byte_stream_put16(&data, args->msglen + 0x04); |
| 13235 | 340 | |
|
30660
cd134a2014f2
Stop using custom encodings (and LATIN-1, for that matter) for sending
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30657
diff
changeset
|
341 | /* Character set */ |
|
cd134a2014f2
Stop using custom encodings (and LATIN-1, for that matter) for sending
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30657
diff
changeset
|
342 | byte_stream_put16(&data, args->charset); |
|
cd134a2014f2
Stop using custom encodings (and LATIN-1, for that matter) for sending
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30657
diff
changeset
|
343 | /* Character subset -- we always use 0 here */ |
|
cd134a2014f2
Stop using custom encodings (and LATIN-1, for that matter) for sending
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30657
diff
changeset
|
344 | byte_stream_put16(&data, 0x0); |
| 13235 | 345 | |
|
30660
cd134a2014f2
Stop using custom encodings (and LATIN-1, for that matter) for sending
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30657
diff
changeset
|
346 | /* Message. Not terminated */ |
|
cd134a2014f2
Stop using custom encodings (and LATIN-1, for that matter) for sending
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30657
diff
changeset
|
347 | byte_stream_putraw(&data, (guchar *)args->msg, args->msglen); |
| 13235 | 348 | |
| 349 | /* Set the Autoresponse flag */ | |
| 350 | if (args->flags & AIM_IMFLAGS_AWAY) { | |
|
15150
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
351 | byte_stream_put16(&data, 0x0004); |
|
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
352 | 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
|
353 | } else { |
|
30660
cd134a2014f2
Stop using custom encodings (and LATIN-1, for that matter) for sending
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30657
diff
changeset
|
354 | /* Set the Request Acknowledge flag */ |
|
cd134a2014f2
Stop using custom encodings (and LATIN-1, for that matter) for sending
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30657
diff
changeset
|
355 | byte_stream_put16(&data, 0x0003); |
|
cd134a2014f2
Stop using custom encodings (and LATIN-1, for that matter) for sending
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30657
diff
changeset
|
356 | 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
|
357 | |
|
295c94bc4822
* Don't flag outgoing oscar messages as "offline deliverable" if the
Mark Doliner <markdoliner@pidgin.im>
parents:
22479
diff
changeset
|
358 | 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
|
359 | /* 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
|
360 | 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
|
361 | 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
|
362 | } |
| 13235 | 363 | } |
| 364 | ||
| 365 | /* | |
| 366 | * Set the I HAVE A REALLY PURTY ICON flag. | |
| 367 | * XXX - This should really only be sent on initial | |
| 368 | * IMs and when you change your icon. | |
| 369 | */ | |
| 370 | if (args->flags & AIM_IMFLAGS_HASICON) { | |
|
15150
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
371 | byte_stream_put16(&data, 0x0008); |
|
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
372 | byte_stream_put16(&data, 0x000c); |
|
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
373 | byte_stream_put32(&data, args->iconlen); |
|
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
374 | byte_stream_put16(&data, 0x0001); |
|
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
375 | byte_stream_put16(&data, args->iconsum); |
|
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
376 | byte_stream_put32(&data, args->iconstamp); |
| 13235 | 377 | } |
| 378 | ||
| 379 | /* | |
| 380 | * Set the Buddy Icon Requested flag. | |
| 381 | * XXX - Every time? Surely not... | |
| 382 | */ | |
| 383 | if (args->flags & AIM_IMFLAGS_BUDDYREQ) { | |
|
15150
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
384 | byte_stream_put16(&data, 0x0009); |
|
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
385 | byte_stream_put16(&data, 0x0000); |
| 13235 | 386 | } |
| 387 | ||
|
15150
c218efb19164
[gaim-migrate @ 17874]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
388 | /* 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
|
389 | 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
|
390 | |
|
30678
78aacd015725
Removed unused "flags" parameter.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30677
diff
changeset
|
391 | flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, snacid, &data); |
|
22862
24f8ae1208ca
Fixed the final stragglers in need of byte_stream_destroy()
Evan Schoenberg <evands@pidgin.im>
parents:
22860
diff
changeset
|
392 | byte_stream_destroy(&data); |
| 13235 | 393 | |
| 394 | /* clean out SNACs over 60sec old */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
395 | aim_cleansnacs(od, 60); |
| 13235 | 396 | |
| 397 | return 0; | |
| 398 | } | |
| 399 | ||
| 400 | /* | |
| 401 | * Subtype 0x0006 - Send a chat invitation. | |
| 402 | */ | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
403 | int aim_im_sendch2_chatinvite(OscarData *od, const char *bn, const char *msg, guint16 exchange, const char *roomname, guint16 instance) |
| 13235 | 404 | { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
405 | 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
|
406 | ByteStream bs; |
| 13235 | 407 | aim_snacid_t snacid; |
|
13240
db5187cc40d1
[gaim-migrate @ 15605]
Mark Doliner <markdoliner@pidgin.im>
parents:
13235
diff
changeset
|
408 | IcbmCookie *msgcookie; |
| 13235 | 409 | struct aim_invite_priv *priv; |
| 410 | 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
|
411 | GSList *outer_tlvlist = NULL, *inner_tlvlist = NULL; |
|
13240
db5187cc40d1
[gaim-migrate @ 15605]
Mark Doliner <markdoliner@pidgin.im>
parents:
13235
diff
changeset
|
412 | ByteStream hdrbs; |
| 13235 | 413 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
414 | if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM))) |
| 13235 | 415 | return -EINVAL; |
| 416 | ||
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
417 | if (!bn || !msg || !roomname) |
| 13235 | 418 | return -EINVAL; |
| 419 | ||
| 420 | aim_icbm_makecookie(cookie); | |
| 421 | ||
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
422 | 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
|
423 | |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
424 | snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, bn, strlen(bn)+1); |
| 13235 | 425 | |
| 426 | /* 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
|
427 | 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
|
428 | 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
|
429 | priv->roomname = g_strdup(roomname); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
430 | priv->exchange = exchange; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
431 | priv->instance = instance; |
| 13235 | 432 | |
| 433 | if ((msgcookie = aim_mkcookie(cookie, AIM_COOKIETYPE_INVITE, priv))) | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
434 | aim_cachecookie(od, msgcookie); |
| 13235 | 435 | 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
|
436 | g_free(priv); |
| 13235 | 437 | |
| 438 | /* 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
|
439 | aim_im_puticbm(&bs, cookie, 0x0002, bn); |
| 13235 | 440 | |
| 441 | /* | |
| 442 | * TLV t(0005) | |
| 443 | * | |
| 444 | * Everything else is inside this TLV. | |
| 445 | * | |
| 446 | * Sigh. AOL was rather inconsistent right here. So we have | |
| 447 | * to play some minor tricks. Right inside the type 5 is some | |
| 448 | * raw data, followed by a series of TLVs. | |
| 449 | * | |
| 450 | */ | |
|
15151
bb985812fefa
[gaim-migrate @ 17875]
Mark Doliner <markdoliner@pidgin.im>
parents:
15150
diff
changeset
|
451 | 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
|
452 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
453 | byte_stream_put16(&hdrbs, 0x0000); /* Unknown! */ |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
454 | byte_stream_putraw(&hdrbs, cookie, sizeof(cookie)); /* I think... */ |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
455 | byte_stream_putcaps(&hdrbs, OSCAR_CAPABILITY_CHAT); |
| 13235 | 456 | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
457 | 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
|
458 | 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
|
459 | 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
|
460 | 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
|
461 | 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
|
462 | |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
463 | 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
|
464 | 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
|
465 | |
|
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
|
466 | 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
|
467 | |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
468 | 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
|
469 | aim_tlvlist_free(outer_tlvlist); |
| 13235 | 470 | |
|
30678
78aacd015725
Removed unused "flags" parameter.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30677
diff
changeset
|
471 | flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, snacid, &bs); |
|
23004
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22862
diff
changeset
|
472 | |
|
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
|
473 | byte_stream_destroy(&bs); |
| 13235 | 474 | |
| 475 | return 0; | |
| 476 | } | |
| 477 | ||
| 478 | /** | |
| 479 | * Subtype 0x0006 - Send your icon to a given user. | |
| 480 | * | |
| 481 | * This is also performance sensitive. (If you can believe it...) | |
| 482 | * | |
| 483 | */ | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
484 | int aim_im_sendch2_icon(OscarData *od, const char *bn, const guint8 *icon, int iconlen, time_t stamp, guint16 iconsum) |
| 13235 | 485 | { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
486 | 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
|
487 | ByteStream bs; |
| 13235 | 488 | aim_snacid_t snacid; |
| 489 | guchar cookie[8]; | |
| 490 | ||
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
491 | if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM))) |
| 13235 | 492 | return -EINVAL; |
| 493 | ||
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
494 | if (!bn || !icon || (iconlen <= 0) || (iconlen >= MAXICONLEN)) |
| 13235 | 495 | return -EINVAL; |
| 496 | ||
| 497 | aim_icbm_makecookie(cookie); | |
| 498 | ||
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
499 | 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
|
500 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
501 | snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0); |
| 13235 | 502 | |
| 503 | /* 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
|
504 | aim_im_puticbm(&bs, cookie, 0x0002, bn); |
| 13235 | 505 | |
| 506 | /* | |
| 507 | * TLV t(0005) | |
| 508 | * | |
| 509 | * Encompasses everything below. | |
| 510 | */ | |
|
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
|
511 | 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
|
512 | 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
|
513 | |
|
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
|
514 | 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
|
515 | 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
|
516 | byte_stream_putcaps(&bs, OSCAR_CAPABILITY_BUDDYICON); |
| 13235 | 517 | |
| 518 | /* 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
|
519 | 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
|
520 | 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
|
521 | byte_stream_put16(&bs, 0x0001); |
| 13235 | 522 | |
| 523 | /* 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
|
524 | 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
|
525 | byte_stream_put16(&bs, 0x0000); |
| 13235 | 526 | |
| 527 | /* 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
|
528 | 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
|
529 | 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
|
530 | 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
|
531 | 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
|
532 | 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
|
533 | 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
|
534 | 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
|
535 | byte_stream_putstr(&bs, AIM_ICONIDENT); |
| 13235 | 536 | |
| 537 | /* 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
|
538 | 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
|
539 | 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
|
540 | |
|
30678
78aacd015725
Removed unused "flags" parameter.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30677
diff
changeset
|
541 | flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 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
|
542 | |
|
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
|
543 | byte_stream_destroy(&bs); |
|
23004
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22862
diff
changeset
|
544 | |
| 13235 | 545 | return 0; |
| 546 | } | |
| 547 | ||
| 548 | /** | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
549 | * Cancel a rendezvous invitation. It could be an invitation to |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
550 | * establish a direct connection, or a file-send, or a chat invite. |
| 13235 | 551 | */ |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
552 | void |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
553 | aim_im_sendch2_cancel(PeerConnection *peer_conn) |
| 13235 | 554 | { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
555 | OscarData *od; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
556 | 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
|
557 | ByteStream bs; |
| 13235 | 558 | 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
|
559 | GSList *outer_tlvlist = NULL, *inner_tlvlist = NULL; |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
560 | ByteStream hdrbs; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
561 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
562 | 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
|
563 | conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
564 | if (conn == NULL) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
565 | return; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
566 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
567 | byte_stream_new(&bs, 118+strlen(peer_conn->bn)); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
568 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
569 | 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
|
570 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
571 | /* 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
|
572 | 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
|
573 | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
574 | aim_tlvlist_add_noval(&outer_tlvlist, 0x0003); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
575 | |
|
15151
bb985812fefa
[gaim-migrate @ 17875]
Mark Doliner <markdoliner@pidgin.im>
parents:
15150
diff
changeset
|
576 | byte_stream_new(&hdrbs, 64); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
577 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
578 | byte_stream_put16(&hdrbs, AIM_RENDEZVOUS_CANCEL); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
579 | byte_stream_putraw(&hdrbs, peer_conn->cookie, 8); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
580 | byte_stream_putcaps(&hdrbs, peer_conn->type); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
581 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
582 | /* 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
|
583 | 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
|
584 | 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
|
585 | |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
586 | 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
|
587 | byte_stream_destroy(&hdrbs); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
588 | |
|
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 | 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
|
590 | |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
591 | 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
|
592 | aim_tlvlist_free(outer_tlvlist); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
593 | |
|
30678
78aacd015725
Removed unused "flags" parameter.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30677
diff
changeset
|
594 | flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 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
|
595 | |
|
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
|
596 | byte_stream_destroy(&bs); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
597 | } |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
598 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
599 | /** |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
600 | * Subtype 0x0006 - Send an "I accept and I've connected to |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
601 | * you" message. |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
602 | */ |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
603 | void |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
604 | aim_im_sendch2_connected(PeerConnection *peer_conn) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
605 | { |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
606 | OscarData *od; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
607 | 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
|
608 | ByteStream bs; |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
609 | aim_snacid_t snacid; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
610 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
611 | 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
|
612 | conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
613 | if (conn == NULL) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
614 | return; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
615 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
616 | 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
|
617 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
618 | 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
|
619 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
620 | /* 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
|
621 | 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
|
622 | |
|
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
|
623 | 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
|
624 | 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
|
625 | 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
|
626 | 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
|
627 | 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
|
628 | |
|
30678
78aacd015725
Removed unused "flags" parameter.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30677
diff
changeset
|
629 | flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 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
|
630 | |
|
23004
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22862
diff
changeset
|
631 | byte_stream_destroy(&bs); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
632 | } |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
633 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
634 | /** |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
635 | * Subtype 0x0006 - Send a direct connect rendezvous ICBM. This |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
636 | * could have a number of meanings, depending on the content: |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
637 | * "I want you to connect to me" |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
638 | * "I want to connect to you" |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
639 | * "I want to connect through a proxy server" |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
640 | */ |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
641 | 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
|
642 | 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
|
643 | { |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
644 | 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
|
645 | ByteStream bs; |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
646 | 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
|
647 | GSList *outer_tlvlist = NULL, *inner_tlvlist = NULL; |
|
13240
db5187cc40d1
[gaim-migrate @ 15605]
Mark Doliner <markdoliner@pidgin.im>
parents:
13235
diff
changeset
|
648 | ByteStream hdrbs; |
| 13235 | 649 | |
|
32863
94fb52386e5c
Add two friendly little checks
Mark Doliner <markdoliner@pidgin.im>
parents:
32438
diff
changeset
|
650 | g_return_if_fail(bn != NULL); |
|
94fb52386e5c
Add two friendly little checks
Mark Doliner <markdoliner@pidgin.im>
parents:
32438
diff
changeset
|
651 | g_return_if_fail(ip != NULL); |
|
94fb52386e5c
Add two friendly little checks
Mark Doliner <markdoliner@pidgin.im>
parents:
32438
diff
changeset
|
652 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
653 | conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
654 | if (conn == NULL) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
655 | return; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
656 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
657 | byte_stream_new(&bs, 246+strlen(bn)); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
658 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
659 | snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0); |
| 13235 | 660 | |
| 661 | /* 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
|
662 | aim_im_puticbm(&bs, cookie, 0x0002, bn); |
| 13235 | 663 | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
664 | aim_tlvlist_add_noval(&outer_tlvlist, 0x0003); |
| 13235 | 665 | |
|
15151
bb985812fefa
[gaim-migrate @ 17875]
Mark Doliner <markdoliner@pidgin.im>
parents:
15150
diff
changeset
|
666 | byte_stream_new(&hdrbs, 128); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
667 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
668 | byte_stream_put16(&hdrbs, AIM_RENDEZVOUS_PROPOSE); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
669 | byte_stream_putraw(&hdrbs, cookie, 8); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
670 | byte_stream_putcaps(&hdrbs, OSCAR_CAPABILITY_DIRECTIM); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
671 | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
672 | 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
|
673 | 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
|
674 | 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
|
675 | 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
|
676 | 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
|
677 | 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
|
678 | |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
679 | 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
|
680 | 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
|
681 | |
|
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 | 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
|
683 | |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
684 | 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
|
685 | aim_tlvlist_free(outer_tlvlist); |
| 13235 | 686 | |
|
30678
78aacd015725
Removed unused "flags" parameter.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30677
diff
changeset
|
687 | flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 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
|
688 | |
|
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
|
689 | byte_stream_destroy(&bs); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
690 | } |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
691 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
692 | /** |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
693 | * Subtype 0x0006 - Send a direct connect rendezvous ICBM asking the |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
694 | * remote user to connect to us via a proxy server. |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
695 | */ |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
696 | 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
|
697 | 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
|
698 | { |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
699 | 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
|
700 | ByteStream bs; |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
701 | 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
|
702 | GSList *outer_tlvlist = NULL, *inner_tlvlist = NULL; |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
703 | ByteStream hdrbs; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
704 | guint8 ip_comp[4]; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
705 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
706 | conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
707 | if (conn == NULL) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
708 | return; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
709 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
710 | byte_stream_new(&bs, 246+strlen(bn)); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
711 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
712 | 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
|
713 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
714 | /* 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
|
715 | aim_im_puticbm(&bs, cookie, 0x0002, bn); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
716 | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
717 | aim_tlvlist_add_noval(&outer_tlvlist, 0x0003); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
718 | |
|
15151
bb985812fefa
[gaim-migrate @ 17875]
Mark Doliner <markdoliner@pidgin.im>
parents:
15150
diff
changeset
|
719 | byte_stream_new(&hdrbs, 128); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
720 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
721 | byte_stream_put16(&hdrbs, AIM_RENDEZVOUS_PROPOSE); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
722 | byte_stream_putraw(&hdrbs, cookie, 8); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
723 | byte_stream_putcaps(&hdrbs, OSCAR_CAPABILITY_DIRECTIM); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
724 | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
725 | 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
|
726 | 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
|
727 | 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
|
728 | 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
|
729 | 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
|
730 | aim_tlvlist_add_noval(&inner_tlvlist, 0x0010); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
731 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
732 | /* 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
|
733 | ip_comp[0] = ~ip[0]; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
734 | ip_comp[1] = ~ip[1]; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
735 | ip_comp[2] = ~ip[2]; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
736 | 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
|
737 | 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
|
738 | 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
|
739 | |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
740 | 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
|
741 | |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
742 | 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
|
743 | 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
|
744 | |
|
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
|
745 | 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
|
746 | |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
747 | 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
|
748 | aim_tlvlist_free(outer_tlvlist); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
749 | |
|
30678
78aacd015725
Removed unused "flags" parameter.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30677
diff
changeset
|
750 | flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 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
|
751 | |
|
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 | byte_stream_destroy(&bs); |
| 13235 | 753 | } |
| 754 | ||
| 755 | /** | |
| 756 | * Subtype 0x0006 - Send an "I want to send you this file" message | |
| 757 | * | |
| 758 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
759 | 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
|
760 | 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 | 761 | { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
762 | 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
|
763 | ByteStream bs; |
| 13235 | 764 | 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
|
765 | GSList *outer_tlvlist = NULL, *inner_tlvlist = NULL; |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
766 | ByteStream hdrbs; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
767 | |
|
27921
f5046606533f
Clean up some debugging and leave it in, since when it it fails, it
Paul Aurich <darkrain42@pidgin.im>
parents:
27784
diff
changeset
|
768 | g_return_if_fail(bn != NULL); |
|
f5046606533f
Clean up some debugging and leave it in, since when it it fails, it
Paul Aurich <darkrain42@pidgin.im>
parents:
27784
diff
changeset
|
769 | g_return_if_fail(ip != NULL); |
|
f5046606533f
Clean up some debugging and leave it in, since when it it fails, it
Paul Aurich <darkrain42@pidgin.im>
parents:
27784
diff
changeset
|
770 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
771 | conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
772 | if (conn == NULL) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
773 | return; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
774 | |
|
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
|
775 | byte_stream_new(&bs, 1014); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
776 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
777 | snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0); |
| 13235 | 778 | |
| 779 | /* 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
|
780 | aim_im_puticbm(&bs, cookie, 0x0002, bn); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
781 | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
782 | aim_tlvlist_add_noval(&outer_tlvlist, 0x0003); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
783 | |
|
15151
bb985812fefa
[gaim-migrate @ 17875]
Mark Doliner <markdoliner@pidgin.im>
parents:
15150
diff
changeset
|
784 | byte_stream_new(&hdrbs, 512); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
785 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
786 | byte_stream_put16(&hdrbs, AIM_RENDEZVOUS_PROPOSE); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
787 | byte_stream_putraw(&hdrbs, cookie, 8); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
788 | byte_stream_putcaps(&hdrbs, OSCAR_CAPABILITY_SENDFILE); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
789 | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
790 | 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
|
791 | 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
|
792 | 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
|
793 | 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
|
794 | aim_tlvlist_add_noval(&inner_tlvlist, 0x000f); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
795 | /* TODO: Send 0x0016 and 0x0017 */ |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
796 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
797 | if (filename != NULL) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
798 | { |
|
23004
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22862
diff
changeset
|
799 | ByteStream inner_bs; |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
800 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
801 | /* Begin TLV t(2711) */ |
|
23004
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22862
diff
changeset
|
802 | 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
|
803 | byte_stream_put16(&inner_bs, (numfiles > 1) ? 0x0002 : 0x0001); |
|
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22862
diff
changeset
|
804 | byte_stream_put16(&inner_bs, numfiles); |
|
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22862
diff
changeset
|
805 | byte_stream_put32(&inner_bs, size); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
806 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
807 | /* Filename - NULL terminated, for some odd reason */ |
|
23004
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22862
diff
changeset
|
808 | byte_stream_putstr(&inner_bs, filename); |
|
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22862
diff
changeset
|
809 | byte_stream_put8(&inner_bs, 0x00); |
|
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22862
diff
changeset
|
810 | |
|
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22862
diff
changeset
|
811 | 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
|
812 | byte_stream_destroy(&inner_bs); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
813 | /* End TLV t(2711) */ |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
814 | } |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
815 | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
816 | 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
|
817 | 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
|
818 | 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
|
819 | |
|
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
|
820 | 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
|
821 | |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
822 | 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
|
823 | aim_tlvlist_free(outer_tlvlist); |
| 13235 | 824 | |
|
30678
78aacd015725
Removed unused "flags" parameter.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30677
diff
changeset
|
825 | flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 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
|
826 | |
|
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
|
827 | byte_stream_destroy(&bs); |
| 13235 | 828 | } |
| 829 | ||
| 830 | /** | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
831 | * Subtype 0x0006 - Send a sendfile connect rendezvous ICBM asking the |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
832 | * remote user to connect to us via a proxy server. |
| 13235 | 833 | */ |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
834 | 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
|
835 | 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 | 836 | { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
837 | 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
|
838 | ByteStream bs; |
| 13235 | 839 | 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
|
840 | GSList *outer_tlvlist = NULL, *inner_tlvlist = NULL; |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
841 | ByteStream hdrbs; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
842 | guint8 ip_comp[4]; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
843 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
844 | conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
845 | if (conn == NULL) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
846 | return; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
847 | |
|
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
|
848 | byte_stream_new(&bs, 1014); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
849 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
850 | snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0); |
| 13235 | 851 | |
| 852 | /* 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
|
853 | aim_im_puticbm(&bs, cookie, 0x0002, bn); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
854 | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
855 | aim_tlvlist_add_noval(&outer_tlvlist, 0x0003); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
856 | |
|
15151
bb985812fefa
[gaim-migrate @ 17875]
Mark Doliner <markdoliner@pidgin.im>
parents:
15150
diff
changeset
|
857 | byte_stream_new(&hdrbs, 512); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
858 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
859 | byte_stream_put16(&hdrbs, AIM_RENDEZVOUS_PROPOSE); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
860 | byte_stream_putraw(&hdrbs, cookie, 8); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
861 | byte_stream_putcaps(&hdrbs, OSCAR_CAPABILITY_SENDFILE); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
862 | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
863 | 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
|
864 | 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
|
865 | 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
|
866 | 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
|
867 | 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
|
868 | aim_tlvlist_add_noval(&inner_tlvlist, 0x0010); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
869 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
870 | /* 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
|
871 | ip_comp[0] = ~ip[0]; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
872 | ip_comp[1] = ~ip[1]; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
873 | ip_comp[2] = ~ip[2]; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
874 | 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
|
875 | 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
|
876 | aim_tlvlist_add_16(&inner_tlvlist, 0x0017, ~pin); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
877 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
878 | if (filename != NULL) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
879 | { |
|
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
|
880 | ByteStream filename_bs; |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
881 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
882 | /* 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
|
883 | 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
|
884 | 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
|
885 | 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
|
886 | byte_stream_put32(&filename_bs, size); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
887 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
888 | /* 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
|
889 | 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
|
890 | 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
|
891 | |
|
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 | 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
|
893 | byte_stream_destroy(&filename_bs); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
894 | /* End TLV t(2711) */ |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
895 | } |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
896 | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
897 | 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
|
898 | |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
899 | 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
|
900 | 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
|
901 | |
|
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
|
902 | 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
|
903 | |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
904 | 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
|
905 | aim_tlvlist_free(outer_tlvlist); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
906 | |
|
30678
78aacd015725
Removed unused "flags" parameter.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30677
diff
changeset
|
907 | flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 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
|
908 | |
|
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
|
909 | byte_stream_destroy(&bs); |
| 13235 | 910 | } |
| 911 | ||
|
30666
ff138d6c7bc4
Got rid of receiving multipart messages over channel 1, which simplified the code
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30665
diff
changeset
|
912 | static void |
|
ff138d6c7bc4
Got rid of receiving multipart messages over channel 1, which simplified the code
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30665
diff
changeset
|
913 | incomingim_ch1_parsemsg(OscarData *od, aim_userinfo_t *userinfo, ByteStream *message, struct aim_incomingim_ch1_args *args) |
| 13235 | 914 | { |
|
30666
ff138d6c7bc4
Got rid of receiving multipart messages over channel 1, which simplified the code
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30665
diff
changeset
|
915 | PurpleAccount *account = purple_connection_get_account(od->gc); |
| 13235 | 916 | /* |
|
30666
ff138d6c7bc4
Got rid of receiving multipart messages over channel 1, which simplified the code
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30665
diff
changeset
|
917 | * We're interested in the inner TLV 0x101, which contains precious, precious message. |
| 13235 | 918 | */ |
| 30668 | 919 | while (byte_stream_bytes_left(message) >= 4) { |
|
30666
ff138d6c7bc4
Got rid of receiving multipart messages over channel 1, which simplified the code
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30665
diff
changeset
|
920 | guint16 type = byte_stream_get16(message); |
|
ff138d6c7bc4
Got rid of receiving multipart messages over channel 1, which simplified the code
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30665
diff
changeset
|
921 | guint16 length = byte_stream_get16(message); |
|
ff138d6c7bc4
Got rid of receiving multipart messages over channel 1, which simplified the code
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30665
diff
changeset
|
922 | if (type == 0x101) { |
|
ff138d6c7bc4
Got rid of receiving multipart messages over channel 1, which simplified the code
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30665
diff
changeset
|
923 | gchar *msg; |
|
ff138d6c7bc4
Got rid of receiving multipart messages over channel 1, which simplified the code
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30665
diff
changeset
|
924 | guint16 msglen = length - 4; /* charset + charsubset */ |
|
ff138d6c7bc4
Got rid of receiving multipart messages over channel 1, which simplified the code
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30665
diff
changeset
|
925 | guint16 charset = byte_stream_get16(message); |
|
ff138d6c7bc4
Got rid of receiving multipart messages over channel 1, which simplified the code
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30665
diff
changeset
|
926 | byte_stream_advance(message, 2); /* charsubset */ |
| 13235 | 927 | |
|
30666
ff138d6c7bc4
Got rid of receiving multipart messages over channel 1, which simplified the code
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30665
diff
changeset
|
928 | msg = byte_stream_getstr(message, msglen); |
|
ff138d6c7bc4
Got rid of receiving multipart messages over channel 1, which simplified the code
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30665
diff
changeset
|
929 | args->msg = oscar_decode_im(account, userinfo->bn, charset, msg, msglen); |
|
31274
126318200f7d
oscar: Fix a memleak on receipt of messages
Paul Aurich <darkrain42@pidgin.im>
parents:
30889
diff
changeset
|
930 | g_free(msg); |
|
30666
ff138d6c7bc4
Got rid of receiving multipart messages over channel 1, which simplified the code
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30665
diff
changeset
|
931 | } else { |
|
ff138d6c7bc4
Got rid of receiving multipart messages over channel 1, which simplified the code
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30665
diff
changeset
|
932 | byte_stream_advance(message, length); |
|
ff138d6c7bc4
Got rid of receiving multipart messages over channel 1, which simplified the code
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30665
diff
changeset
|
933 | } |
| 13235 | 934 | } |
| 935 | } | |
| 936 | ||
|
30666
ff138d6c7bc4
Got rid of receiving multipart messages over channel 1, which simplified the code
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30665
diff
changeset
|
937 | static int |
|
ff138d6c7bc4
Got rid of receiving multipart messages over channel 1, which simplified the code
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30665
diff
changeset
|
938 | 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 | 939 | { |
|
30666
ff138d6c7bc4
Got rid of receiving multipart messages over channel 1, which simplified the code
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30665
diff
changeset
|
940 | guint16 type, length; |
| 13235 | 941 | aim_rxcallback_t userfunc; |
| 942 | int ret = 0; | |
| 943 | struct aim_incomingim_ch1_args args; | |
| 944 | unsigned int endpos; | |
| 945 | ||
| 946 | memset(&args, 0, sizeof(args)); | |
| 947 | ||
| 948 | /* | |
| 949 | * This used to be done using tlvchains. For performance reasons, | |
| 950 | * I've changed it to process the TLVs in-place. This avoids lots | |
| 951 | * of per-IM memory allocations. | |
| 952 | */ | |
| 30668 | 953 | while (byte_stream_bytes_left(bs) >= 4) |
| 13235 | 954 | { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
955 | type = byte_stream_get16(bs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
956 | length = byte_stream_get16(bs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
957 | |
| 30668 | 958 | if (length > byte_stream_bytes_left(bs)) |
| 13235 | 959 | { |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
960 | 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 | 961 | break; |
| 962 | } | |
| 963 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
964 | endpos = byte_stream_curpos(bs) + length; |
| 13235 | 965 | |
| 966 | if (type == 0x0002) { /* Message Block */ | |
|
30666
ff138d6c7bc4
Got rid of receiving multipart messages over channel 1, which simplified the code
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30665
diff
changeset
|
967 | ByteStream tlv02; |
|
ff138d6c7bc4
Got rid of receiving multipart messages over channel 1, which simplified the code
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30665
diff
changeset
|
968 | byte_stream_init(&tlv02, bs->data + bs->offset, length); |
|
ff138d6c7bc4
Got rid of receiving multipart messages over channel 1, which simplified the code
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30665
diff
changeset
|
969 | incomingim_ch1_parsemsg(od, userinfo, &tlv02, &args); |
| 13235 | 970 | } else if (type == 0x0003) { /* Server Ack Requested */ |
| 971 | args.icbmflags |= AIM_IMFLAGS_ACK; | |
| 972 | } else if (type == 0x0004) { /* Message is Auto Response */ | |
| 973 | args.icbmflags |= AIM_IMFLAGS_AWAY; | |
| 974 | } else if (type == 0x0006) { /* Message was received offline. */ | |
|
22479
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
975 | /* |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
976 | * 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
|
977 | * 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
|
978 | */ |
| 13235 | 979 | args.icbmflags |= AIM_IMFLAGS_OFFLINE; |
| 980 | } else if (type == 0x0008) { /* I-HAVE-A-REALLY-PURTY-ICON Flag */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
981 | args.iconlen = byte_stream_get32(bs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
982 | byte_stream_get16(bs); /* 0x0001 */ |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
983 | args.iconsum = byte_stream_get16(bs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
984 | args.iconstamp = byte_stream_get32(bs); |
| 13235 | 985 | |
| 986 | /* | |
| 987 | * This looks to be a client bug. MacAIM 4.3 will | |
| 988 | * send this tag, but with all zero values, in the | |
| 989 | * first message of a conversation. This makes no | |
| 990 | * sense whatsoever, so I'm going to say its a bug. | |
| 991 | * | |
| 992 | * You really shouldn't advertise a zero-length icon | |
| 993 | * anyway. | |
| 994 | * | |
| 995 | */ | |
| 996 | if (args.iconlen) | |
| 997 | args.icbmflags |= AIM_IMFLAGS_HASICON; | |
| 998 | } else if (type == 0x0009) { | |
| 999 | args.icbmflags |= AIM_IMFLAGS_BUDDYREQ; | |
| 1000 | } else if (type == 0x000b) { /* Non-direct connect typing notification */ | |
| 1001 | args.icbmflags |= AIM_IMFLAGS_TYPINGNOT; | |
|
22479
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
1002 | } 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
|
1003 | /* |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
1004 | * 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
|
1005 | * 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
|
1006 | */ |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
1007 | args.timestamp = byte_stream_get32(bs); |
| 13235 | 1008 | } |
| 1009 | ||
| 1010 | /* | |
| 1011 | * This is here to protect ourselves from ourselves. That | |
| 1012 | * is, if something above doesn't completely parse its value | |
| 1013 | * section, or, worse, overparses it, this will set the | |
| 1014 | * stream where it needs to be in order to land on the next | |
| 1015 | * TLV when the loop continues. | |
| 1016 | * | |
| 1017 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1018 | byte_stream_setpos(bs, endpos); |
| 13235 | 1019 | } |
| 1020 | ||
| 1021 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1022 | if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1023 | ret = userfunc(od, conn, frame, channel, userinfo, &args); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1024 | |
|
30666
ff138d6c7bc4
Got rid of receiving multipart messages over channel 1, which simplified the code
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30665
diff
changeset
|
1025 | g_free(args.msg); |
| 13235 | 1026 | return ret; |
| 1027 | } | |
| 1028 | ||
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1029 | static void |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1030 | 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 | 1031 | { |
| 1032 | /* | |
| 1033 | * This goes like this... | |
| 1034 | * | |
| 1035 | * group name length | |
| 1036 | * group name | |
| 1037 | * num of buddies in group | |
| 1038 | * buddy name length | |
| 1039 | * buddy name | |
| 1040 | * buddy name length | |
| 1041 | * buddy name | |
| 1042 | * ... | |
| 1043 | * group name length | |
| 1044 | * group name | |
| 1045 | * num of buddies in group | |
| 1046 | * buddy name length | |
| 1047 | * buddy name | |
| 1048 | * ... | |
| 1049 | * ... | |
| 1050 | */ | |
| 30668 | 1051 | while (byte_stream_bytes_left(servdata)) |
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1052 | { |
| 13235 | 1053 | guint16 gnlen, numb; |
| 1054 | int i; | |
| 1055 | char *gn; | |
| 1056 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1057 | gnlen = byte_stream_get16(servdata); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1058 | gn = byte_stream_getstr(servdata, gnlen); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1059 | numb = byte_stream_get16(servdata); |
| 13235 | 1060 | |
| 1061 | for (i = 0; i < numb; i++) { | |
| 1062 | guint16 bnlen; | |
| 1063 | char *bn; | |
| 1064 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1065 | bnlen = byte_stream_get16(servdata); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1066 | bn = byte_stream_getstr(servdata, bnlen); |
| 13235 | 1067 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
1068 | purple_debug_misc("oscar", "got a buddy list from %s: group %s, buddy %s\n", userinfo->bn, gn, bn); |
| 13235 | 1069 | |
|
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
|
1070 | g_free(bn); |
| 13235 | 1071 | } |
| 1072 | ||
|
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
|
1073 | g_free(gn); |
| 13235 | 1074 | } |
| 1075 | ||
| 1076 | return; | |
| 1077 | } | |
| 1078 | ||
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1079 | static void |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1080 | incomingim_ch2_buddyicon_free(OscarData *od, IcbmArgsCh2 *args) |
| 13235 | 1081 | { |
|
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
|
1082 | g_free(args->info.icon.icon); |
| 13235 | 1083 | |
| 1084 | return; | |
| 1085 | } | |
| 1086 | ||
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1087 | static void |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1088 | 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 | 1089 | { |
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1090 | args->info.icon.checksum = byte_stream_get32(servdata); |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1091 | args->info.icon.length = byte_stream_get32(servdata); |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1092 | args->info.icon.timestamp = byte_stream_get32(servdata); |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1093 | args->info.icon.icon = byte_stream_getraw(servdata, args->info.icon.length); |
| 13235 | 1094 | |
| 1095 | args->destructor = (void *)incomingim_ch2_buddyicon_free; | |
| 1096 | ||
| 1097 | return; | |
| 1098 | } | |
| 1099 | ||
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1100 | static void |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1101 | incomingim_ch2_chat_free(OscarData *od, IcbmArgsCh2 *args) |
| 13235 | 1102 | { |
| 1103 | /* 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
|
1104 | g_free(args->info.chat.roominfo.name); |
| 13235 | 1105 | |
| 1106 | return; | |
| 1107 | } | |
| 1108 | ||
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1109 | static void |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1110 | 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 | 1111 | { |
| 1112 | /* | |
| 1113 | * Chat room info. | |
| 1114 | */ | |
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1115 | aim_chat_readroominfo(servdata, &args->info.chat.roominfo); |
| 13235 | 1116 | |
| 1117 | args->destructor = (void *)incomingim_ch2_chat_free; | |
| 1118 | } | |
| 1119 | ||
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1120 | static void |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1121 | incomingim_ch2_icqserverrelay_free(OscarData *od, IcbmArgsCh2 *args) |
| 13235 | 1122 | { |
|
30657
db476fff37a7
Fixed (I hope) #12284.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30639
diff
changeset
|
1123 | g_free((char *)args->info.rtfmsg.msg); |
| 13235 | 1124 | } |
| 1125 | ||
| 1126 | /* | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1127 | * The relationship between OSCAR_CAPABILITY_ICQSERVERRELAY and OSCAR_CAPABILITY_ICQRTF is |
| 13235 | 1128 | * kind of odd. This sends the client ICQRTF since that is all that I've seen |
| 1129 | * SERVERRELAY used for. | |
| 1130 | * | |
| 1131 | * Note that this is all little-endian. Cringe. | |
| 1132 | * | |
| 1133 | */ | |
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1134 | static void |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1135 | 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 | 1136 | { |
|
30657
db476fff37a7
Fixed (I hope) #12284.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30639
diff
changeset
|
1137 | guint16 hdrlen, msglen; |
|
db476fff37a7
Fixed (I hope) #12284.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30639
diff
changeset
|
1138 | |
|
db476fff37a7
Fixed (I hope) #12284.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30639
diff
changeset
|
1139 | args->destructor = (void *)incomingim_ch2_icqserverrelay_free; |
| 13235 | 1140 | |
|
30657
db476fff37a7
Fixed (I hope) #12284.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30639
diff
changeset
|
1141 | #define SKIP_HEADER(expected_hdrlen) \ |
|
db476fff37a7
Fixed (I hope) #12284.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30639
diff
changeset
|
1142 | hdrlen = byte_stream_getle16(servdata); \ |
|
db476fff37a7
Fixed (I hope) #12284.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30639
diff
changeset
|
1143 | if (hdrlen != expected_hdrlen) { \ |
|
db476fff37a7
Fixed (I hope) #12284.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30639
diff
changeset
|
1144 | purple_debug_warning("oscar", "Expected to find a header with length " #expected_hdrlen "; ignoring message"); \ |
|
db476fff37a7
Fixed (I hope) #12284.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30639
diff
changeset
|
1145 | return; \ |
|
db476fff37a7
Fixed (I hope) #12284.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30639
diff
changeset
|
1146 | } \ |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1147 | byte_stream_advance(servdata, hdrlen); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1148 | |
|
30657
db476fff37a7
Fixed (I hope) #12284.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30639
diff
changeset
|
1149 | SKIP_HEADER(0x001b); |
|
db476fff37a7
Fixed (I hope) #12284.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30639
diff
changeset
|
1150 | SKIP_HEADER(0x000e); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1151 | |
|
30657
db476fff37a7
Fixed (I hope) #12284.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30639
diff
changeset
|
1152 | args->info.rtfmsg.msgtype = byte_stream_get8(servdata); |
|
db476fff37a7
Fixed (I hope) #12284.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30639
diff
changeset
|
1153 | /* |
|
db476fff37a7
Fixed (I hope) #12284.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30639
diff
changeset
|
1154 | * Copied from http://iserverd.khstu.ru/oscar/message.html: |
|
db476fff37a7
Fixed (I hope) #12284.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30639
diff
changeset
|
1155 | * xx byte message flags |
|
db476fff37a7
Fixed (I hope) #12284.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30639
diff
changeset
|
1156 | * xx xx word (LE) status code |
|
db476fff37a7
Fixed (I hope) #12284.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30639
diff
changeset
|
1157 | * xx xx word (LE) priority code |
|
db476fff37a7
Fixed (I hope) #12284.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30639
diff
changeset
|
1158 | * |
|
db476fff37a7
Fixed (I hope) #12284.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30639
diff
changeset
|
1159 | * We don't need any of these, so just skip them. |
|
db476fff37a7
Fixed (I hope) #12284.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30639
diff
changeset
|
1160 | */ |
|
db476fff37a7
Fixed (I hope) #12284.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30639
diff
changeset
|
1161 | byte_stream_advance(servdata, 1 + 2 + 2); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1162 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1163 | msglen = byte_stream_getle16(servdata); |
|
30657
db476fff37a7
Fixed (I hope) #12284.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30639
diff
changeset
|
1164 | args->info.rtfmsg.msg = byte_stream_getstr(servdata, msglen); |
| 13235 | 1165 | } |
| 1166 | ||
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1167 | static void |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1168 | incomingim_ch2_sendfile_free(OscarData *od, IcbmArgsCh2 *args) |
| 13235 | 1169 | { |
|
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
|
1170 | g_free(args->info.sendfile.filename); |
| 13235 | 1171 | } |
| 1172 | ||
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1173 | /* Someone is sending us a file */ |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1174 | static void |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1175 | 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 | 1176 | { |
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1177 | int flen; |
| 13235 | 1178 | |
| 1179 | args->destructor = (void *)incomingim_ch2_sendfile_free; | |
| 1180 | ||
| 1181 | /* Maybe there is a better way to tell what kind of sendfile | |
| 1182 | * this is? Maybe TLV t(000a)? */ | |
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1183 | |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1184 | /* subtype is one of AIM_OFT_SUBTYPE_* */ |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1185 | args->info.sendfile.subtype = byte_stream_get16(servdata); |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1186 | args->info.sendfile.totfiles = byte_stream_get16(servdata); |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1187 | args->info.sendfile.totsize = byte_stream_get32(servdata); |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1188 | |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1189 | /* |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1190 | * 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
|
1191 | * 32 char max filename length for single files. I think |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1192 | * OFT tends to do that. Gotta love inconsistency. I saw |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1193 | * a 26 byte filename? |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1194 | */ |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1195 | /* AAA - create an byte_stream_getnullstr function (don't anymore)(maybe) */ |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1196 | /* Use an inelegant way of getting the null-terminated filename, |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1197 | * since there's no easy bstream routine. */ |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1198 | for (flen = 0; byte_stream_get8(servdata); flen++); |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1199 | byte_stream_advance(servdata, -flen -1); |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1200 | args->info.sendfile.filename = byte_stream_getstr(servdata, flen); |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1201 | |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1202 | /* There is sometimes more after the null-terminated filename, |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1203 | * but I'm unsure of its format. */ |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1204 | /* I don't believe him. */ |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1205 | /* There is sometimes a null byte inside a unicode filename, |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1206 | * 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
|
1207 | * piece of data that will be in this message. --Jonathan */ |
| 13235 | 1208 | } |
| 1209 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1210 | typedef void (*ch2_args_destructor_t)(OscarData *od, IcbmArgsCh2 *args); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1211 | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1212 | 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 | 1213 | { |
| 1214 | aim_rxcallback_t userfunc; | |
| 1215 | 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
|
1216 | GSList *list2; |
|
13665
c8984bccd64c
[gaim-migrate @ 16066]
Mark Doliner <markdoliner@pidgin.im>
parents:
13663
diff
changeset
|
1217 | aim_tlv_t *tlv; |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1218 | IcbmArgsCh2 args; |
|
13240
db5187cc40d1
[gaim-migrate @ 15605]
Mark Doliner <markdoliner@pidgin.im>
parents:
13235
diff
changeset
|
1219 | ByteStream bbs, sdbs, *sdbsptr = NULL; |
| 13235 | 1220 | guint8 *cookie2; |
| 1221 | int ret = 0; | |
| 1222 | ||
| 1223 | char proxyip[30] = {""}; | |
| 1224 | char clientip[30] = {""}; | |
| 1225 | char verifiedip[30] = {""}; | |
| 1226 | ||
| 1227 | memset(&args, 0, sizeof(args)); | |
| 1228 | ||
| 1229 | /* | |
| 1230 | * There's another block of TLVs embedded in the type 5 here. | |
| 1231 | */ | |
| 1232 | block1 = aim_tlv_gettlv(tlvlist, 0x0005, 1); | |
|
13663
de16367fd001
[gaim-migrate @ 16064]
Mark Doliner <markdoliner@pidgin.im>
parents:
13654
diff
changeset
|
1233 | if (block1 == NULL) |
|
de16367fd001
[gaim-migrate @ 16064]
Mark Doliner <markdoliner@pidgin.im>
parents:
13654
diff
changeset
|
1234 | { |
|
de16367fd001
[gaim-migrate @ 16064]
Mark Doliner <markdoliner@pidgin.im>
parents:
13654
diff
changeset
|
1235 | /* The server sent us ch2 ICBM without ch2 info? Weird. */ |
|
de16367fd001
[gaim-migrate @ 16064]
Mark Doliner <markdoliner@pidgin.im>
parents:
13654
diff
changeset
|
1236 | return 1; |
|
de16367fd001
[gaim-migrate @ 16064]
Mark Doliner <markdoliner@pidgin.im>
parents:
13654
diff
changeset
|
1237 | } |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1238 | byte_stream_init(&bbs, block1->value, block1->length); |
| 13235 | 1239 | |
| 1240 | /* | |
| 1241 | * First two bytes represent the status of the connection. | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1242 | * One of the AIM_RENDEZVOUS_ defines. |
| 13235 | 1243 | * |
| 1244 | * 0 is a request, 1 is a cancel, 2 is an accept | |
| 1245 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1246 | args.status = byte_stream_get16(&bbs); |
| 13235 | 1247 | |
| 1248 | /* | |
| 1249 | * Next comes the cookie. Should match the ICBM cookie. | |
| 1250 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1251 | cookie2 = byte_stream_getraw(&bbs, 8); |
| 13235 | 1252 | if (memcmp(cookie, cookie2, 8) != 0) |
|
15308
2bfe4510454e
[gaim-migrate @ 18036]
Mark Doliner <markdoliner@pidgin.im>
parents:
15151
diff
changeset
|
1253 | { |
| 15884 | 1254 | purple_debug_warning("oscar", |
|
15308
2bfe4510454e
[gaim-migrate @ 18036]
Mark Doliner <markdoliner@pidgin.im>
parents:
15151
diff
changeset
|
1255 | "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
|
1256 | g_free(cookie2); |
|
15308
2bfe4510454e
[gaim-migrate @ 18036]
Mark Doliner <markdoliner@pidgin.im>
parents:
15151
diff
changeset
|
1257 | return 1; |
|
2bfe4510454e
[gaim-migrate @ 18036]
Mark Doliner <markdoliner@pidgin.im>
parents:
15151
diff
changeset
|
1258 | } |
| 13235 | 1259 | 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
|
1260 | g_free(cookie2); |
| 13235 | 1261 | |
| 1262 | /* | |
| 1263 | * The next 16bytes are a capability block so we can | |
| 1264 | * identify what type of rendezvous this is. | |
| 1265 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1266 | args.type = aim_locate_getcaps(od, &bbs, 0x10); |
| 13235 | 1267 | |
| 1268 | /* | |
| 1269 | * What follows may be TLVs or nothing, depending on the | |
| 1270 | * purpose of the message. | |
| 1271 | * | |
| 1272 | * Ack packets for instance have nothing more to them. | |
| 1273 | */ | |
| 1274 | list2 = aim_tlvlist_read(&bbs); | |
| 1275 | ||
| 1276 | /* | |
| 1277 | * IP address to proxy the file transfer through. | |
| 1278 | * | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1279 | * TODO: I don't like this. Maybe just read in an int? Or inet_ntoa... |
| 13235 | 1280 | */ |
|
13665
c8984bccd64c
[gaim-migrate @ 16066]
Mark Doliner <markdoliner@pidgin.im>
parents:
13663
diff
changeset
|
1281 | tlv = aim_tlv_gettlv(list2, 0x0002, 1); |
|
c8984bccd64c
[gaim-migrate @ 16066]
Mark Doliner <markdoliner@pidgin.im>
parents:
13663
diff
changeset
|
1282 | if ((tlv != NULL) && (tlv->length == 4)) |
|
c8984bccd64c
[gaim-migrate @ 16066]
Mark Doliner <markdoliner@pidgin.im>
parents:
13663
diff
changeset
|
1283 | snprintf(proxyip, sizeof(proxyip), "%hhu.%hhu.%hhu.%hhu", |
|
c8984bccd64c
[gaim-migrate @ 16066]
Mark Doliner <markdoliner@pidgin.im>
parents:
13663
diff
changeset
|
1284 | tlv->value[0], tlv->value[1], |
|
c8984bccd64c
[gaim-migrate @ 16066]
Mark Doliner <markdoliner@pidgin.im>
parents:
13663
diff
changeset
|
1285 | tlv->value[2], tlv->value[3]); |
| 13235 | 1286 | |
| 1287 | /* | |
| 1288 | * IP address from the perspective of the client. | |
| 1289 | */ | |
|
13665
c8984bccd64c
[gaim-migrate @ 16066]
Mark Doliner <markdoliner@pidgin.im>
parents:
13663
diff
changeset
|
1290 | tlv = aim_tlv_gettlv(list2, 0x0003, 1); |
|
c8984bccd64c
[gaim-migrate @ 16066]
Mark Doliner <markdoliner@pidgin.im>
parents:
13663
diff
changeset
|
1291 | if ((tlv != NULL) && (tlv->length == 4)) |
|
c8984bccd64c
[gaim-migrate @ 16066]
Mark Doliner <markdoliner@pidgin.im>
parents:
13663
diff
changeset
|
1292 | snprintf(clientip, sizeof(clientip), "%hhu.%hhu.%hhu.%hhu", |
|
c8984bccd64c
[gaim-migrate @ 16066]
Mark Doliner <markdoliner@pidgin.im>
parents:
13663
diff
changeset
|
1293 | tlv->value[0], tlv->value[1], |
|
c8984bccd64c
[gaim-migrate @ 16066]
Mark Doliner <markdoliner@pidgin.im>
parents:
13663
diff
changeset
|
1294 | tlv->value[2], tlv->value[3]); |
| 13235 | 1295 | |
| 1296 | /* | |
| 1297 | * Verified IP address (from the perspective of Oscar). | |
| 1298 | * | |
| 1299 | * This is added by the server. | |
| 1300 | */ | |
|
13665
c8984bccd64c
[gaim-migrate @ 16066]
Mark Doliner <markdoliner@pidgin.im>
parents:
13663
diff
changeset
|
1301 | tlv = aim_tlv_gettlv(list2, 0x0004, 1); |
|
c8984bccd64c
[gaim-migrate @ 16066]
Mark Doliner <markdoliner@pidgin.im>
parents:
13663
diff
changeset
|
1302 | if ((tlv != NULL) && (tlv->length == 4)) |
|
c8984bccd64c
[gaim-migrate @ 16066]
Mark Doliner <markdoliner@pidgin.im>
parents:
13663
diff
changeset
|
1303 | snprintf(verifiedip, sizeof(verifiedip), "%hhu.%hhu.%hhu.%hhu", |
|
c8984bccd64c
[gaim-migrate @ 16066]
Mark Doliner <markdoliner@pidgin.im>
parents:
13663
diff
changeset
|
1304 | tlv->value[0], tlv->value[1], |
|
c8984bccd64c
[gaim-migrate @ 16066]
Mark Doliner <markdoliner@pidgin.im>
parents:
13663
diff
changeset
|
1305 | tlv->value[2], tlv->value[3]); |
| 13235 | 1306 | |
| 1307 | /* | |
| 1308 | * Port number for something. | |
| 1309 | */ | |
| 1310 | if (aim_tlv_gettlv(list2, 0x0005, 1)) | |
| 1311 | args.port = aim_tlv_get16(list2, 0x0005, 1); | |
| 1312 | ||
| 1313 | /* | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1314 | * File transfer "request number": |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1315 | * 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
|
1316 | * 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
|
1317 | * 0x0003 - A third request has been sent; applies only to stage 3 proxied transfers |
| 13235 | 1318 | */ |
| 1319 | if (aim_tlv_gettlv(list2, 0x000a, 1)) | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1320 | args.requestnumber = aim_tlv_get16(list2, 0x000a, 1); |
| 13235 | 1321 | |
| 1322 | /* | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1323 | * Terminate connection/error code. 0x0001 means the other user |
|
30708
535bec1e66fb
Standardize on "cancelled".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30683
diff
changeset
|
1324 | * cancelled the connection. |
| 13235 | 1325 | */ |
| 1326 | if (aim_tlv_gettlv(list2, 0x000b, 1)) | |
| 1327 | args.errorcode = aim_tlv_get16(list2, 0x000b, 1); | |
| 1328 | ||
| 1329 | /* | |
| 1330 | * Invitation message / chat description. | |
| 1331 | */ | |
| 1332 | if (aim_tlv_gettlv(list2, 0x000c, 1)) { | |
| 1333 | args.msg = aim_tlv_getstr(list2, 0x000c, 1); | |
| 1334 | args.msglen = aim_tlv_getlength(list2, 0x000c, 1); | |
| 1335 | } | |
| 1336 | ||
| 1337 | /* | |
| 1338 | * Character set. | |
| 1339 | */ | |
| 1340 | if (aim_tlv_gettlv(list2, 0x000d, 1)) | |
| 1341 | args.encoding = aim_tlv_getstr(list2, 0x000d, 1); | |
| 1342 | ||
| 1343 | /* | |
| 1344 | * Language. | |
| 1345 | */ | |
| 1346 | if (aim_tlv_gettlv(list2, 0x000e, 1)) | |
| 1347 | args.language = aim_tlv_getstr(list2, 0x000e, 1); | |
| 1348 | ||
| 1349 | /* | |
| 1350 | * Flag meaning we should proxy the file transfer through an AIM server | |
| 1351 | */ | |
| 1352 | if (aim_tlv_gettlv(list2, 0x0010, 1)) | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1353 | args.use_proxy = TRUE; |
| 13235 | 1354 | |
|
37523
02346b6472b3
Simplify checks for empty strings
Michael McConville <mmcconville@mykolab.com>
parents:
37144
diff
changeset
|
1355 | if (*proxyip != '\0') |
| 13235 | 1356 | args.proxyip = (char *)proxyip; |
|
37523
02346b6472b3
Simplify checks for empty strings
Michael McConville <mmcconville@mykolab.com>
parents:
37144
diff
changeset
|
1357 | if (*clientip != '\0') |
| 13235 | 1358 | args.clientip = (char *)clientip; |
|
37523
02346b6472b3
Simplify checks for empty strings
Michael McConville <mmcconville@mykolab.com>
parents:
37144
diff
changeset
|
1359 | if (*verifiedip != '\0') |
| 13235 | 1360 | args.verifiedip = (char *)verifiedip; |
| 1361 | ||
| 1362 | /* | |
| 1363 | * This must be present in PROPOSALs, but will probably not | |
| 1364 | * exist in CANCELs and ACCEPTs. Also exists in ICQ Lite | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1365 | * Beta 4.0 URLs (OSCAR_CAPABILITY_ICQSERVERRELAY). |
| 13235 | 1366 | * |
| 1367 | * Service Data blocks are module-specific in format. | |
| 1368 | */ | |
| 1369 | if ((servdatatlv = aim_tlv_gettlv(list2, 0x2711 /* 10001 */, 1))) { | |
| 1370 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1371 | byte_stream_init(&sdbs, servdatatlv->value, servdatatlv->length); |
| 13235 | 1372 | sdbsptr = &sdbs; |
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1373 | |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1374 | /* |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1375 | * The rest of the handling depends on what type it is. |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1376 | * |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1377 | * Not all of them have special handling (yet). |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1378 | */ |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1379 | if (args.type & OSCAR_CAPABILITY_BUDDYICON) |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1380 | incomingim_ch2_buddyicon(od, conn, mod, frame, snac, userinfo, &args, sdbsptr); |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1381 | else if (args.type & OSCAR_CAPABILITY_SENDBUDDYLIST) |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1382 | incomingim_ch2_buddylist(od, conn, mod, frame, snac, userinfo, &args, sdbsptr); |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1383 | else if (args.type & OSCAR_CAPABILITY_CHAT) |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1384 | incomingim_ch2_chat(od, conn, mod, frame, snac, userinfo, &args, sdbsptr); |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1385 | else if (args.type & OSCAR_CAPABILITY_ICQSERVERRELAY) |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1386 | incomingim_ch2_icqserverrelay(od, conn, mod, frame, snac, userinfo, &args, sdbsptr); |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1387 | else if (args.type & OSCAR_CAPABILITY_SENDFILE) |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1388 | incomingim_ch2_sendfile(od, conn, mod, frame, snac, userinfo, &args, sdbsptr); |
| 13235 | 1389 | } |
| 1390 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1391 | if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1392 | ret = userfunc(od, conn, frame, channel, userinfo, &args); |
| 13235 | 1393 | |
| 1394 | ||
| 1395 | if (args.destructor) | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1396 | ((ch2_args_destructor_t)args.destructor)(od, &args); |
| 13235 | 1397 | |
|
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
|
1398 | 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
|
1399 | 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
|
1400 | g_free((char *)args.language); |
| 13235 | 1401 | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1402 | aim_tlvlist_free(list2); |
| 13235 | 1403 | |
| 1404 | return ret; | |
| 1405 | } | |
| 1406 | ||
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1407 | 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 | 1408 | { |
|
13240
db5187cc40d1
[gaim-migrate @ 15605]
Mark Doliner <markdoliner@pidgin.im>
parents:
13235
diff
changeset
|
1409 | ByteStream meat; |
| 13235 | 1410 | aim_rxcallback_t userfunc; |
| 1411 | aim_tlv_t *block; | |
| 1412 | struct aim_incomingim_ch4_args args; | |
| 1413 | int ret = 0; | |
| 1414 | ||
| 1415 | /* | |
| 1416 | * Make a bstream for the meaty part. Yum. Meat. | |
| 1417 | */ | |
| 1418 | if (!(block = aim_tlv_gettlv(tlvlist, 0x0005, 1))) | |
| 1419 | return -1; | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1420 | byte_stream_init(&meat, block->value, block->length); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1421 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1422 | args.uin = byte_stream_getle32(&meat); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1423 | args.type = byte_stream_getle8(&meat); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1424 | 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
|
1425 | 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
|
1426 | /* 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
|
1427 | 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
|
1428 | else |
|
e9d8873f4d27
Add non-US SMS support for ICQ. This is a patch from DB42.
Mark Doliner <markdoliner@pidgin.im>
parents:
17443
diff
changeset
|
1429 | args.msglen = byte_stream_getle16(&meat); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1430 | args.msg = (gchar *)byte_stream_getraw(&meat, args.msglen); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1431 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1432 | if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1433 | ret = userfunc(od, conn, frame, channel, userinfo, &args); |
| 13235 | 1434 | |
|
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
|
1435 | g_free(args.msg); |
| 13235 | 1436 | |
| 1437 | return ret; | |
| 1438 | } | |
| 1439 | ||
| 1440 | /* | |
| 1441 | * Subtype 0x0007 | |
| 1442 | * | |
| 1443 | * It can easily be said that parsing ICBMs is THE single | |
| 1444 | * most difficult thing to do in the in AIM protocol. In | |
| 1445 | * fact, I think I just did say that. | |
| 1446 | * | |
| 1447 | * Below is the best damned solution I've come up with | |
| 1448 | * over the past sixteen months of battling with it. This | |
| 1449 | * can parse both away and normal messages from every client | |
| 1450 | * I have access to. Its not fast, its not clean. But it works. | |
| 1451 | * | |
| 1452 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1453 | static int incomingim(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
| 13235 | 1454 | { |
| 1455 | int ret = 0; | |
| 1456 | guchar *cookie; | |
| 1457 | guint16 channel; | |
| 1458 | aim_userinfo_t userinfo; | |
| 1459 | ||
| 1460 | memset(&userinfo, 0x00, sizeof(aim_userinfo_t)); | |
| 1461 | ||
| 1462 | /* | |
| 1463 | * Read ICBM Cookie. | |
| 1464 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1465 | cookie = byte_stream_getraw(bs, 8); |
| 13235 | 1466 | |
| 1467 | /* | |
| 1468 | * Channel ID. | |
| 1469 | * | |
| 1470 | * Channel 0x0001 is the message channel. It is | |
| 1471 | * used to send basic ICBMs. | |
| 1472 | * | |
| 1473 | * Channel 0x0002 is the Rendezvous channel, which | |
| 1474 | * is where Chat Invitiations and various client-client | |
| 1475 | * connection negotiations come from. | |
| 1476 | * | |
| 1477 | * Channel 0x0003 is used for chat messages. | |
| 1478 | * | |
| 1479 | * Channel 0x0004 is used for ICQ authorization, or | |
| 1480 | * possibly any system notice. | |
| 1481 | * | |
| 1482 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1483 | channel = byte_stream_get16(bs); |
| 13235 | 1484 | |
| 1485 | /* | |
| 1486 | * Extract the standard user info block. | |
| 1487 | * | |
| 1488 | * Note that although this contains TLVs that appear contiguous | |
| 1489 | * with the TLVs read below, they are two different pieces. The | |
| 1490 | * userinfo block contains the number of TLVs that contain user | |
| 1491 | * information, the rest are not even though there is no separation. | |
| 1492 | * You can start reading the message TLVs after aim_info_extract() | |
| 1493 | * parses out the standard userinfo block. | |
| 1494 | * | |
| 1495 | * That also means that TLV types can be duplicated between the | |
| 1496 | * userinfo block and the rest of the message, however there should | |
| 1497 | * never be two TLVs of the same type in one block. | |
| 1498 | * | |
| 1499 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1500 | aim_info_extract(od, bs, &userinfo); |
| 13235 | 1501 | |
| 1502 | /* | |
| 1503 | * From here on, its depends on what channel we're on. | |
| 1504 | * | |
| 1505 | * Technically all channels have a TLV list have this, however, | |
| 1506 | * for the common channel 1 case, in-place parsing is used for | |
| 1507 | * performance reasons (less memory allocation). | |
| 1508 | */ | |
| 1509 | if (channel == 1) { | |
| 1510 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1511 | ret = incomingim_ch1(od, conn, mod, frame, snac, channel, &userinfo, bs, cookie); |
| 13235 | 1512 | |
| 1513 | } 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
|
1514 | GSList *tlvlist; |
| 13235 | 1515 | |
| 1516 | /* | |
| 1517 | * Read block of TLVs (not including the userinfo data). All | |
| 1518 | * further data is derived from what is parsed here. | |
| 1519 | */ | |
| 1520 | tlvlist = aim_tlvlist_read(bs); | |
| 1521 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1522 | ret = incomingim_ch2(od, conn, mod, frame, snac, channel, &userinfo, tlvlist, cookie); |
| 13235 | 1523 | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1524 | aim_tlvlist_free(tlvlist); |
| 13235 | 1525 | |
| 1526 | } 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
|
1527 | GSList *tlvlist; |
| 13235 | 1528 | |
| 1529 | tlvlist = aim_tlvlist_read(bs); | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1530 | 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
|
1531 | aim_tlvlist_free(tlvlist); |
| 13235 | 1532 | |
| 1533 | } else { | |
| 15884 | 1534 | purple_debug_misc("oscar", "icbm: ICBM received on an unsupported channel. Ignoring. (chan = %04x)\n", channel); |
| 13235 | 1535 | } |
| 1536 | ||
| 1537 | 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
|
1538 | g_free(cookie); |
| 13235 | 1539 | |
| 1540 | return ret; | |
| 1541 | } | |
| 1542 | ||
| 1543 | /* Subtype 0x000a */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1544 | static int missedcall(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
| 13235 | 1545 | { |
| 1546 | int ret = 0; | |
| 1547 | aim_rxcallback_t userfunc; | |
| 1548 | guint16 channel, nummissed, reason; | |
| 1549 | aim_userinfo_t userinfo; | |
| 1550 | ||
| 30668 | 1551 | while (byte_stream_bytes_left(bs)) { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1552 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1553 | channel = byte_stream_get16(bs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1554 | aim_info_extract(od, bs, &userinfo); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1555 | nummissed = byte_stream_get16(bs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1556 | reason = byte_stream_get16(bs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1557 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1558 | if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1559 | ret = userfunc(od, conn, frame, channel, &userinfo, nummissed, reason); |
| 13235 | 1560 | |
| 1561 | aim_info_free(&userinfo); | |
| 1562 | } | |
| 1563 | ||
| 1564 | return ret; | |
| 1565 | } | |
| 1566 | ||
| 1567 | /* | |
| 1568 | * Subtype 0x000b | |
| 1569 | * | |
| 1570 | * Possible codes: | |
| 1571 | * AIM_TRANSFER_DENY_DECLINE -- "client has declined transfer" | |
| 1572 | * | |
| 1573 | */ | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
1574 | int aim_im_denytransfer(OscarData *od, const char *bn, const guchar *cookie, guint16 code) |
| 13235 | 1575 | { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1576 | 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
|
1577 | ByteStream bs; |
| 13235 | 1578 | 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
|
1579 | GSList *tlvlist = NULL; |
| 13235 | 1580 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
1581 | if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM))) |
| 13235 | 1582 | return -EINVAL; |
| 1583 | ||
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
1584 | byte_stream_new(&bs, 8+2+1+strlen(bn)+6); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1585 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
1586 | 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
|
1587 | |
|
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
|
1588 | 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
|
1589 | |
|
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
|
1590 | 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
|
1591 | 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
|
1592 | byte_stream_putstr(&bs, bn); |
| 13235 | 1593 | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1594 | 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
|
1595 | 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
|
1596 | aim_tlvlist_free(tlvlist); |
| 13235 | 1597 | |
|
30678
78aacd015725
Removed unused "flags" parameter.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30677
diff
changeset
|
1598 | flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x000b, snacid, &bs); |
|
23004
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22862
diff
changeset
|
1599 | |
|
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
|
1600 | byte_stream_destroy(&bs); |
| 13235 | 1601 | |
| 1602 | return 0; | |
| 1603 | } | |
| 1604 | ||
| 1605 | /* | |
|
30677
f6df3cca2f24
Miranda expects a client ack from the other side for channel 2 messages,
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30668
diff
changeset
|
1606 | * Subtype 0x000b. |
|
f6df3cca2f24
Miranda expects a client ack from the other side for channel 2 messages,
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30668
diff
changeset
|
1607 | * Send confirmation for a channel 2 message (Miranda wants it by default). |
|
f6df3cca2f24
Miranda expects a client ack from the other side for channel 2 messages,
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30668
diff
changeset
|
1608 | */ |
|
f6df3cca2f24
Miranda expects a client ack from the other side for channel 2 messages,
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30668
diff
changeset
|
1609 | void |
|
f6df3cca2f24
Miranda expects a client ack from the other side for channel 2 messages,
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30668
diff
changeset
|
1610 | aim_im_send_icq_confirmation(OscarData *od, const char *bn, const guchar *cookie) |
|
22548
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
1611 | { |
|
35992
34a67264df99
Fix some CWE-476 coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35983
diff
changeset
|
1612 | FlapConnection *conn; |
|
30677
f6df3cca2f24
Miranda expects a client ack from the other side for channel 2 messages,
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30668
diff
changeset
|
1613 | ByteStream bs; |
|
f6df3cca2f24
Miranda expects a client ack from the other side for channel 2 messages,
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30668
diff
changeset
|
1614 | aim_snacid_t snacid; |
|
f6df3cca2f24
Miranda expects a client ack from the other side for channel 2 messages,
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30668
diff
changeset
|
1615 | guint32 header_size, data_size; |
|
f6df3cca2f24
Miranda expects a client ack from the other side for channel 2 messages,
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30668
diff
changeset
|
1616 | guint16 cookie2 = (guint16)g_random_int(); |
|
22548
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
1617 | |
|
30677
f6df3cca2f24
Miranda expects a client ack from the other side for channel 2 messages,
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30668
diff
changeset
|
1618 | purple_debug_misc("oscar", "Sending message ack to %s\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
|
1619 | |
|
30677
f6df3cca2f24
Miranda expects a client ack from the other side for channel 2 messages,
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30668
diff
changeset
|
1620 | header_size = 8 + 2 + 1 + strlen(bn) + 2; |
|
f6df3cca2f24
Miranda expects a client ack from the other side for channel 2 messages,
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30668
diff
changeset
|
1621 | data_size = 2 + 1 + 16 + 4*2 + 2*3 + 4*3 + 1*2 + 2*3 + 1; |
|
f6df3cca2f24
Miranda expects a client ack from the other side for channel 2 messages,
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30668
diff
changeset
|
1622 | byte_stream_new(&bs, header_size + data_size); |
|
22548
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
1623 | |
|
30677
f6df3cca2f24
Miranda expects a client ack from the other side for channel 2 messages,
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30668
diff
changeset
|
1624 | /* The message header. */ |
|
f6df3cca2f24
Miranda expects a client ack from the other side for channel 2 messages,
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30668
diff
changeset
|
1625 | aim_im_puticbm(&bs, cookie, 0x0002, bn); |
|
f6df3cca2f24
Miranda expects a client ack from the other side for channel 2 messages,
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30668
diff
changeset
|
1626 | byte_stream_put16(&bs, 0x0003); /* reason */ |
|
22548
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
1627 | |
|
30677
f6df3cca2f24
Miranda expects a client ack from the other side for channel 2 messages,
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30668
diff
changeset
|
1628 | /* The actual message. */ |
|
f6df3cca2f24
Miranda expects a client ack from the other side for channel 2 messages,
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30668
diff
changeset
|
1629 | byte_stream_putle16(&bs, 0x1b); /* subheader #1 length */ |
|
f6df3cca2f24
Miranda expects a client ack from the other side for channel 2 messages,
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30668
diff
changeset
|
1630 | byte_stream_put8(&bs, 0x08); /* protocol version */ |
|
f6df3cca2f24
Miranda expects a client ack from the other side for channel 2 messages,
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30668
diff
changeset
|
1631 | byte_stream_putcaps(&bs, OSCAR_CAPABILITY_EMPTY); |
|
f6df3cca2f24
Miranda expects a client ack from the other side for channel 2 messages,
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30668
diff
changeset
|
1632 | byte_stream_put32(&bs, 0x3); /* client features */ |
|
f6df3cca2f24
Miranda expects a client ack from the other side for channel 2 messages,
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30668
diff
changeset
|
1633 | byte_stream_put32(&bs, 0x0004); /* DC type */ |
|
f6df3cca2f24
Miranda expects a client ack from the other side for channel 2 messages,
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30668
diff
changeset
|
1634 | byte_stream_put16(&bs, cookie2); /* a cookie, chosen by fair dice roll */ |
|
f6df3cca2f24
Miranda expects a client ack from the other side for channel 2 messages,
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30668
diff
changeset
|
1635 | byte_stream_putle16(&bs, 0x0e); /* header #2 len? */ |
|
f6df3cca2f24
Miranda expects a client ack from the other side for channel 2 messages,
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30668
diff
changeset
|
1636 | byte_stream_put16(&bs, cookie2); /* the same cookie again */ |
|
f6df3cca2f24
Miranda expects a client ack from the other side for channel 2 messages,
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30668
diff
changeset
|
1637 | byte_stream_put32(&bs, 0); /* unknown */ |
|
f6df3cca2f24
Miranda expects a client ack from the other side for channel 2 messages,
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30668
diff
changeset
|
1638 | byte_stream_put32(&bs, 0); /* unknown */ |
|
f6df3cca2f24
Miranda expects a client ack from the other side for channel 2 messages,
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30668
diff
changeset
|
1639 | byte_stream_put32(&bs, 0); /* unknown */ |
|
f6df3cca2f24
Miranda expects a client ack from the other side for channel 2 messages,
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30668
diff
changeset
|
1640 | byte_stream_put8(&bs, 0x01); /* plain text message */ |
|
f6df3cca2f24
Miranda expects a client ack from the other side for channel 2 messages,
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30668
diff
changeset
|
1641 | byte_stream_put8(&bs, 0x00); /* no message flags */ |
|
f6df3cca2f24
Miranda expects a client ack from the other side for channel 2 messages,
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30668
diff
changeset
|
1642 | byte_stream_put16(&bs, 0x0000); /* no icq status */ |
|
f6df3cca2f24
Miranda expects a client ack from the other side for channel 2 messages,
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30668
diff
changeset
|
1643 | byte_stream_put16(&bs, 0x0100); /* priority */ |
|
f6df3cca2f24
Miranda expects a client ack from the other side for channel 2 messages,
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30668
diff
changeset
|
1644 | byte_stream_putle16(&bs, 1); /* query message len */ |
|
f6df3cca2f24
Miranda expects a client ack from the other side for channel 2 messages,
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30668
diff
changeset
|
1645 | byte_stream_put8(&bs, 0x00); /* empty query message */ |
|
22548
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
1646 | |
|
30677
f6df3cca2f24
Miranda expects a client ack from the other side for channel 2 messages,
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30668
diff
changeset
|
1647 | snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x000b, 0x0000, NULL, 0); |
|
35992
34a67264df99
Fix some CWE-476 coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35983
diff
changeset
|
1648 | conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM); |
|
34a67264df99
Fix some CWE-476 coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35983
diff
changeset
|
1649 | g_warn_if_fail(conn); |
|
34a67264df99
Fix some CWE-476 coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35983
diff
changeset
|
1650 | if (conn) { |
|
34a67264df99
Fix some CWE-476 coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35983
diff
changeset
|
1651 | flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x000b, |
|
34a67264df99
Fix some CWE-476 coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35983
diff
changeset
|
1652 | snacid, &bs); |
|
34a67264df99
Fix some CWE-476 coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35983
diff
changeset
|
1653 | } |
|
30677
f6df3cca2f24
Miranda expects a client ack from the other side for channel 2 messages,
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30668
diff
changeset
|
1654 | byte_stream_destroy(&bs); |
|
22548
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
1655 | } |
|
61cdbac12fe7
Move the status note parsing into a separate function, which I think
Mark Doliner <markdoliner@pidgin.im>
parents:
22487
diff
changeset
|
1656 | |
| 13235 | 1657 | /* |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1658 | * Subtype 0x000b - Receive the response from an ICQ status message |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1659 | * request (in which case this contains the ICQ status message) or |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1660 | * a file transfer or direct IM request was declined. |
| 13235 | 1661 | */ |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1662 | static int clientautoresp(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
| 13235 | 1663 | { |
| 1664 | int ret = 0; | |
| 1665 | aim_rxcallback_t userfunc; | |
| 1666 | 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
|
1667 | char *bn; |
| 13235 | 1668 | 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
|
1669 | guint8 bnlen; |
|
24625
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1670 | char *xml = NULL; |
|
30462
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
1671 | guint16 hdrlen; |
|
24625
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1672 | int curpos; |
|
30462
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
1673 | guint16 num1, num2; |
|
24625
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1674 | PurpleAccount *account; |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1675 | PurpleBuddy *buddy; |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1676 | PurplePresence *presence; |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1677 | PurpleStatus *status; |
| 13235 | 1678 | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1679 | cookie = byte_stream_getraw(bs, 8); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1680 | 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
|
1681 | 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
|
1682 | bn = byte_stream_getstr(bs, bnlen); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1683 | reason = byte_stream_get16(bs); |
| 13235 | 1684 | |
|
22125
57b7d398c30e
Partial support for reading ICQ 6 status notes. The status note will
Mark Doliner <markdoliner@pidgin.im>
parents:
21841
diff
changeset
|
1685 | 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
|
1686 | { |
|
30457
00b433ba84df
Remove some stray spaces
Mark Doliner <markdoliner@pidgin.im>
parents:
30296
diff
changeset
|
1687 | hdrlen = byte_stream_getle16(bs); |
|
30462
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
1688 | if (hdrlen == 27 && bs->len > (27 + 51)) { |
|
30457
00b433ba84df
Remove some stray spaces
Mark Doliner <markdoliner@pidgin.im>
parents:
30296
diff
changeset
|
1689 | byte_stream_advance(bs, 51); |
|
00b433ba84df
Remove some stray spaces
Mark Doliner <markdoliner@pidgin.im>
parents:
30296
diff
changeset
|
1690 | num1 = byte_stream_getle16(bs); |
|
00b433ba84df
Remove some stray spaces
Mark Doliner <markdoliner@pidgin.im>
parents:
30296
diff
changeset
|
1691 | num2 = byte_stream_getle16(bs); |
|
30462
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
1692 | purple_debug_misc("oscar", "X-Status: num1 %hu, num2 %hu\n", num1, num2); |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
1693 | |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
1694 | if (num1 == 0x4f00 && num2 == 0x3b00) { |
|
30457
00b433ba84df
Remove some stray spaces
Mark Doliner <markdoliner@pidgin.im>
parents:
30296
diff
changeset
|
1695 | byte_stream_advance(bs, 86); |
|
00b433ba84df
Remove some stray spaces
Mark Doliner <markdoliner@pidgin.im>
parents:
30296
diff
changeset
|
1696 | curpos = byte_stream_curpos(bs); |
|
00b433ba84df
Remove some stray spaces
Mark Doliner <markdoliner@pidgin.im>
parents:
30296
diff
changeset
|
1697 | xml = byte_stream_getstr(bs, bs->len - curpos); |
|
00b433ba84df
Remove some stray spaces
Mark Doliner <markdoliner@pidgin.im>
parents:
30296
diff
changeset
|
1698 | purple_debug_misc("oscar", "X-Status: Received XML reply\n"); |
|
30462
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
1699 | if (xml) { |
|
30533
a56f371f289a
This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <markdoliner@pidgin.im>
parents:
30462
diff
changeset
|
1700 | GString *xstatus; |
|
30889
905eecac1f06
Merged my changes that fix #11964 and #12593. Mark looked over them
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30841
diff
changeset
|
1701 | char *tmp1, *tmp2, *unescaped_xstatus; |
|
30533
a56f371f289a
This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <markdoliner@pidgin.im>
parents:
30462
diff
changeset
|
1702 | |
|
a56f371f289a
This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <markdoliner@pidgin.im>
parents:
30462
diff
changeset
|
1703 | /* purple_debug_misc("oscar", "X-Status: XML reply: %s\n", xml); */ |
|
a56f371f289a
This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <markdoliner@pidgin.im>
parents:
30462
diff
changeset
|
1704 | |
|
a56f371f289a
This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <markdoliner@pidgin.im>
parents:
30462
diff
changeset
|
1705 | xstatus = g_string_new(NULL); |
|
a56f371f289a
This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <markdoliner@pidgin.im>
parents:
30462
diff
changeset
|
1706 | |
|
a56f371f289a
This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <markdoliner@pidgin.im>
parents:
30462
diff
changeset
|
1707 | tmp1 = strstr(xml, "<title>"); |
|
a56f371f289a
This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <markdoliner@pidgin.im>
parents:
30462
diff
changeset
|
1708 | if (tmp1 != NULL) { |
|
a56f371f289a
This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <markdoliner@pidgin.im>
parents:
30462
diff
changeset
|
1709 | tmp1 += 13; |
|
a56f371f289a
This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <markdoliner@pidgin.im>
parents:
30462
diff
changeset
|
1710 | tmp2 = strstr(tmp1, "</title>"); |
|
a56f371f289a
This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <markdoliner@pidgin.im>
parents:
30462
diff
changeset
|
1711 | if (tmp2 != NULL) |
|
a56f371f289a
This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <markdoliner@pidgin.im>
parents:
30462
diff
changeset
|
1712 | g_string_append_len(xstatus, tmp1, tmp2 - tmp1); |
|
30457
00b433ba84df
Remove some stray spaces
Mark Doliner <markdoliner@pidgin.im>
parents:
30296
diff
changeset
|
1713 | } |
|
30533
a56f371f289a
This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <markdoliner@pidgin.im>
parents:
30462
diff
changeset
|
1714 | tmp1 = strstr(xml, "<desc>"); |
|
a56f371f289a
This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <markdoliner@pidgin.im>
parents:
30462
diff
changeset
|
1715 | if (tmp1 != NULL) { |
|
a56f371f289a
This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <markdoliner@pidgin.im>
parents:
30462
diff
changeset
|
1716 | tmp1 += 12; |
|
a56f371f289a
This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <markdoliner@pidgin.im>
parents:
30462
diff
changeset
|
1717 | tmp2 = strstr(tmp1, "</desc>"); |
|
a56f371f289a
This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <markdoliner@pidgin.im>
parents:
30462
diff
changeset
|
1718 | if (tmp2 != NULL) { |
|
30889
905eecac1f06
Merged my changes that fix #11964 and #12593. Mark looked over them
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30841
diff
changeset
|
1719 | if (xstatus->len > 0 && tmp2 > tmp1) |
|
30533
a56f371f289a
This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <markdoliner@pidgin.im>
parents:
30462
diff
changeset
|
1720 | g_string_append(xstatus, " - "); |
|
a56f371f289a
This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <markdoliner@pidgin.im>
parents:
30462
diff
changeset
|
1721 | g_string_append_len(xstatus, tmp1, tmp2 - tmp1); |
|
a56f371f289a
This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <markdoliner@pidgin.im>
parents:
30462
diff
changeset
|
1722 | } |
|
30457
00b433ba84df
Remove some stray spaces
Mark Doliner <markdoliner@pidgin.im>
parents:
30296
diff
changeset
|
1723 | } |
|
30889
905eecac1f06
Merged my changes that fix #11964 and #12593. Mark looked over them
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30841
diff
changeset
|
1724 | unescaped_xstatus = purple_unescape_text(xstatus->str); |
|
905eecac1f06
Merged my changes that fix #11964 and #12593. Mark looked over them
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30841
diff
changeset
|
1725 | g_string_free(xstatus, TRUE); |
|
905eecac1f06
Merged my changes that fix #11964 and #12593. Mark looked over them
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30841
diff
changeset
|
1726 | if (*unescaped_xstatus) { |
|
905eecac1f06
Merged my changes that fix #11964 and #12593. Mark looked over them
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30841
diff
changeset
|
1727 | purple_debug_misc("oscar", "X-Status reply: %s\n", unescaped_xstatus); |
|
30533
a56f371f289a
This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <markdoliner@pidgin.im>
parents:
30462
diff
changeset
|
1728 | account = purple_connection_get_account(od->gc); |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34631
diff
changeset
|
1729 | buddy = purple_blist_find_buddy(account, bn); |
|
30533
a56f371f289a
This patch attempts to fix four bugs in the oscar protocol plugin that
Mark Doliner <markdoliner@pidgin.im>
parents:
30462
diff
changeset
|
1730 | presence = purple_buddy_get_presence(buddy); |
|
30889
905eecac1f06
Merged my changes that fix #11964 and #12593. Mark looked over them
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30841
diff
changeset
|
1731 | status = purple_presence_get_status(presence, "mood"); |
|
905eecac1f06
Merged my changes that fix #11964 and #12593. Mark looked over them
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30841
diff
changeset
|
1732 | if (status) { |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
34868
diff
changeset
|
1733 | purple_protocol_got_user_status(account, bn, |
|
30889
905eecac1f06
Merged my changes that fix #11964 and #12593. Mark looked over them
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30841
diff
changeset
|
1734 | "mood", |
|
905eecac1f06
Merged my changes that fix #11964 and #12593. Mark looked over them
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30841
diff
changeset
|
1735 | PURPLE_MOOD_NAME, purple_status_get_attr_string(status, PURPLE_MOOD_NAME), |
|
905eecac1f06
Merged my changes that fix #11964 and #12593. Mark looked over them
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30841
diff
changeset
|
1736 | PURPLE_MOOD_COMMENT, unescaped_xstatus, NULL); |
|
905eecac1f06
Merged my changes that fix #11964 and #12593. Mark looked over them
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30841
diff
changeset
|
1737 | } |
|
24625
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1738 | } |
|
30889
905eecac1f06
Merged my changes that fix #11964 and #12593. Mark looked over them
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30841
diff
changeset
|
1739 | g_free(unescaped_xstatus); |
|
30457
00b433ba84df
Remove some stray spaces
Mark Doliner <markdoliner@pidgin.im>
parents:
30296
diff
changeset
|
1740 | } else { |
|
00b433ba84df
Remove some stray spaces
Mark Doliner <markdoliner@pidgin.im>
parents:
30296
diff
changeset
|
1741 | purple_debug_misc("oscar", "X-Status: Can't get XML reply string\n"); |
|
24625
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1742 | } |
|
30457
00b433ba84df
Remove some stray spaces
Mark Doliner <markdoliner@pidgin.im>
parents:
30296
diff
changeset
|
1743 | } else { |
|
30462
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
1744 | purple_debug_misc("oscar", "X-Status: 0x0004, 0x000b not an xstatus reply\n"); |
|
24625
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1745 | } |
|
30457
00b433ba84df
Remove some stray spaces
Mark Doliner <markdoliner@pidgin.im>
parents:
30296
diff
changeset
|
1746 | |
|
00b433ba84df
Remove some stray spaces
Mark Doliner <markdoliner@pidgin.im>
parents:
30296
diff
changeset
|
1747 | } |
|
22125
57b7d398c30e
Partial support for reading ICQ 6 status notes. The status note will
Mark Doliner <markdoliner@pidgin.im>
parents:
21841
diff
changeset
|
1748 | |
| 13235 | 1749 | } else if (channel == 0x0004) { /* ICQ message */ |
| 1750 | switch (reason) { | |
| 1751 | case 0x0003: { /* ICQ status message. Maybe other stuff too, you never know with these people. */ | |
| 1752 | guint8 statusmsgtype, *msg; | |
| 1753 | guint16 len; | |
| 1754 | guint32 state; | |
| 1755 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1756 | len = byte_stream_getle16(bs); /* Should be 0x001b */ |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1757 | byte_stream_advance(bs, len); /* Unknown */ |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1758 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1759 | len = byte_stream_getle16(bs); /* Should be 0x000e */ |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1760 | byte_stream_advance(bs, len); /* Unknown */ |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1761 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1762 | statusmsgtype = byte_stream_getle8(bs); |
| 13235 | 1763 | switch (statusmsgtype) { |
| 1764 | case 0xe8: | |
| 1765 | state = AIM_ICQ_STATE_AWAY; | |
| 1766 | break; | |
| 1767 | case 0xe9: | |
| 1768 | state = AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_BUSY; | |
| 1769 | break; | |
| 1770 | case 0xea: | |
| 1771 | state = AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_OUT; | |
| 1772 | break; | |
| 1773 | case 0xeb: | |
| 1774 | state = AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_DND | AIM_ICQ_STATE_BUSY; | |
| 1775 | break; | |
| 1776 | case 0xec: | |
| 1777 | state = AIM_ICQ_STATE_CHAT; | |
| 1778 | break; | |
| 1779 | default: | |
| 1780 | state = 0; | |
| 1781 | break; | |
| 1782 | } | |
| 1783 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1784 | 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
|
1785 | byte_stream_getle16(bs); /* Unknown - 0x0000 */ |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1786 | byte_stream_getle16(bs); /* Unknown - 0x0000 */ |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1787 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1788 | len = byte_stream_getle16(bs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1789 | msg = byte_stream_getraw(bs, len); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1790 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1791 | 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
|
1792 | ret = userfunc(od, conn, frame, channel, bn, reason, state, msg); |
| 13235 | 1793 | |
|
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
|
1794 | g_free(msg); |
| 13235 | 1795 | } break; |
| 1796 | ||
| 1797 | default: { | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1798 | 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
|
1799 | ret = userfunc(od, conn, frame, channel, bn, reason); |
| 13235 | 1800 | } break; |
| 1801 | } /* end switch */ | |
| 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(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
|
1805 | g_free(bn); |
|
26657
1067482b6de1
propagate from branch 'im.pidgin.pidgin' (head 69f29e0c8111a1c5b6270f7924a468b75f6b5aa9)
Richard Laager <rlaager@pidgin.im>
diff
changeset
|
1806 | g_free(xml); |
| 13235 | 1807 | |
| 1808 | return ret; | |
| 1809 | } | |
| 1810 | ||
| 1811 | /* | |
|
30660
cd134a2014f2
Stop using custom encodings (and LATIN-1, for that matter) for sending
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30657
diff
changeset
|
1812 | * Subtype 0x000c - Receive an ack after sending an ICBM. The ack contains the ICBM header of the message you sent. |
| 13235 | 1813 | */ |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1814 | static int msgack(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
| 13235 | 1815 | { |
| 1816 | 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
|
1817 | char *bn; |
| 13235 | 1818 | int ret = 0; |
| 1819 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1820 | cookie = byte_stream_getraw(bs, 8); |
|
35983
029ab6fae0e6
Backport more warning fixes for prpls from default
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33770
diff
changeset
|
1821 | byte_stream_get16(bs); /* ch */ |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
1822 | bn = byte_stream_getstr(bs, byte_stream_get8(bs)); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1823 | |
|
30660
cd134a2014f2
Stop using custom encodings (and LATIN-1, for that matter) for sending
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30657
diff
changeset
|
1824 | purple_debug_info("oscar", "Sent message to %s.\n", bn); |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
1825 | |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
1826 | 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
|
1827 | g_free(cookie); |
| 13235 | 1828 | |
| 1829 | return ret; | |
| 1830 | } | |
| 1831 | ||
| 1832 | /* | |
|
22479
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
1833 | * 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
|
1834 | * 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
|
1835 | * 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
|
1836 | * 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
|
1837 | * |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
1838 | * 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
|
1839 | * 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
|
1840 | * 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
|
1841 | * 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
|
1842 | * 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
|
1843 | */ |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
1844 | 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
|
1845 | { |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
1846 | FlapConnection *conn; |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
1847 | |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
1848 | 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
|
1849 | return -EINVAL; |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
1850 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
1851 | 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
|
1852 | |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
1853 | return 0; |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
1854 | } |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
1855 | |
|
10f266abebd0
Add support for offline messages for AIM, thanks to some info from
Mark Doliner <markdoliner@pidgin.im>
parents:
22125
diff
changeset
|
1856 | /* |
| 13235 | 1857 | * Subtype 0x0014 - Send a mini typing notification (mtn) packet. |
| 1858 | * | |
| 1859 | * This is supported by winaim5 and newer, MacAIM bleh and newer, iChat bleh and newer, | |
| 15884 | 1860 | * and Purple 0.60 and newer. |
| 13235 | 1861 | * |
| 1862 | */ | |
|
28522
836f2f99ba99
Rename two variables based on insight from
Mark Doliner <markdoliner@pidgin.im>
parents:
28521
diff
changeset
|
1863 | int aim_im_sendmtn(OscarData *od, guint16 channel, const char *bn, guint16 event) |
| 13235 | 1864 | { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1865 | 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
|
1866 | ByteStream bs; |
| 13235 | 1867 | aim_snacid_t snacid; |
| 1868 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1869 | if (!od || !(conn = flap_connection_findbygroup(od, 0x0002))) |
| 13235 | 1870 | return -EINVAL; |
| 1871 | ||
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
1872 | if (!bn) |
| 13235 | 1873 | return -EINVAL; |
| 1874 | ||
|
30462
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
1875 | byte_stream_new(&bs, 11 + strlen(bn) + 2); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1876 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
1877 | snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0014, 0x0000, NULL, 0); |
| 13235 | 1878 | |
|
28522
836f2f99ba99
Rename two variables based on insight from
Mark Doliner <markdoliner@pidgin.im>
parents:
28521
diff
changeset
|
1879 | /* ICBM cookie */ |
|
836f2f99ba99
Rename two variables based on insight from
Mark Doliner <markdoliner@pidgin.im>
parents:
28521
diff
changeset
|
1880 | byte_stream_put32(&bs, 0x00000000); |
|
836f2f99ba99
Rename two variables based on insight from
Mark Doliner <markdoliner@pidgin.im>
parents:
28521
diff
changeset
|
1881 | byte_stream_put32(&bs, 0x00000000); |
| 13235 | 1882 | |
| 1883 | /* | |
|
28522
836f2f99ba99
Rename two variables based on insight from
Mark Doliner <markdoliner@pidgin.im>
parents:
28521
diff
changeset
|
1884 | * Channel (should be 0x0001 for mtn) |
| 13235 | 1885 | */ |
|
28522
836f2f99ba99
Rename two variables based on insight from
Mark Doliner <markdoliner@pidgin.im>
parents:
28521
diff
changeset
|
1886 | byte_stream_put16(&bs, channel); |
| 13235 | 1887 | |
| 1888 | /* | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
1889 | * Dest buddy name |
| 13235 | 1890 | */ |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
1891 | 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
|
1892 | byte_stream_putstr(&bs, bn); |
| 13235 | 1893 | |
| 1894 | /* | |
|
28522
836f2f99ba99
Rename two variables based on insight from
Mark Doliner <markdoliner@pidgin.im>
parents:
28521
diff
changeset
|
1895 | * Event (should be 0x0000, 0x0001, or 0x0002 for mtn) |
| 13235 | 1896 | */ |
|
28522
836f2f99ba99
Rename two variables based on insight from
Mark Doliner <markdoliner@pidgin.im>
parents:
28521
diff
changeset
|
1897 | byte_stream_put16(&bs, event); |
|
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
|
1898 | |
|
30683
21bad3873104
Fix a compile error from my merge
Mark Doliner <markdoliner@pidgin.im>
parents:
30682
diff
changeset
|
1899 | flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0014, 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
|
1900 | |
|
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
|
1901 | byte_stream_destroy(&bs); |
|
23004
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22862
diff
changeset
|
1902 | |
| 13235 | 1903 | return 0; |
| 1904 | } | |
| 1905 | ||
| 1906 | /* | |
|
24625
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1907 | * Subtype 0x0006 - Send eXtra Status request |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1908 | */ |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1909 | int icq_im_xstatus_request(OscarData *od, const char *sn) |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1910 | { |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1911 | FlapConnection *conn; |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1912 | aim_snacid_t snacid; |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1913 | guchar cookie[8]; |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1914 | GSList *outer_tlvlist = NULL, *inner_tlvlist = NULL; |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1915 | ByteStream bs, header, plugindata; |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1916 | PurpleAccount *account; |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1917 | const char *fmt; |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1918 | char *statxml; |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1919 | int xmllen; |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1920 | |
|
30462
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
1921 | static const guint8 pluginid[] = { |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
1922 | 0x09, 0x46, 0x13, 0x49, 0x4C, 0x7F, 0x11, 0xD1, |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
1923 | 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00 |
|
24625
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1924 | }; |
|
30457
00b433ba84df
Remove some stray spaces
Mark Doliner <markdoliner@pidgin.im>
parents:
30296
diff
changeset
|
1925 | |
|
30462
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
1926 | static const guint8 c_plugindata[] = { |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
1927 | 0x1B, 0x00, 0x0A, |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
1928 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
1929 | 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0xF9, 0xD1, 0x0E, 0x00, 0xF9, 0xD1, 0x00, 0x00, |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
1930 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x00, 0x00, 0x01, 0x00, |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
1931 | 0x01, 0x00, 0x00, 0x4F, 0x00, 0x3B, 0x60, 0xB3, 0xEF, 0xD8, 0x2A, 0x6C, 0x45, 0xA4, 0xE0, 0x9C, |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
1932 | 0x5A, 0x5E, 0x67, 0xE8, 0x65, 0x08, 0x00, 0x2A, 0x00, 0x00, 0x00, 0x53, 0x63, 0x72, 0x69, 0x70, |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
1933 | 0x74, 0x20, 0x50, 0x6C, 0x75, 0x67, 0x2D, 0x69, 0x6E, 0x3A, 0x20, 0x52, 0x65, 0x6D, 0x6F, 0x74, |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
1934 | 0x65, 0x20, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x41, |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
1935 | 0x72, 0x72, 0x69, 0x76, 0x65, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
1936 | 0x00, 0x00, 0x00, 0x00, 0x14, 0x01, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00 |
|
24625
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1937 | }; |
|
30457
00b433ba84df
Remove some stray spaces
Mark Doliner <markdoliner@pidgin.im>
parents:
30296
diff
changeset
|
1938 | |
|
24625
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1939 | if (!od || !(conn = flap_connection_findbygroup(od, 0x0004))) |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1940 | return -EINVAL; |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1941 | |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1942 | if (!sn) |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1943 | return -EINVAL; |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1944 | |
|
30457
00b433ba84df
Remove some stray spaces
Mark Doliner <markdoliner@pidgin.im>
parents:
30296
diff
changeset
|
1945 | fmt = "<N><QUERY><Q><PluginID>srvMng</PluginID></Q></QUERY><NOTIFY><srv><id>cAwaySrv</id><req><id>AwayStat</id><trans>2</trans><senderId>%s</senderId></req></srv></NOTIFY></N>\r\n"; |
|
24625
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1946 | |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1947 | account = purple_connection_get_account(od->gc); |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1948 | |
|
32438
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31274
diff
changeset
|
1949 | statxml = g_strdup_printf(fmt, purple_account_get_username(account)); |
|
30841
b4a5a160e11a
Simplify the way that string length and memory allocation is done.
Daniel Atallah <datallah@pidgin.im>
parents:
30708
diff
changeset
|
1950 | xmllen = strlen(statxml); |
|
24625
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1951 | |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1952 | aim_icbm_makecookie(cookie); |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1953 | |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1954 | byte_stream_new(&bs, 10 + 8 + 2 + 1 + strlen(sn) + 2 |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1955 | + 2 + 2 + 8 + 16 + 2 + 2 + 2 + 2 + 2 |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1956 | + 2 + 2 + sizeof(c_plugindata) + xmllen |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1957 | + 2 + 2); |
|
30457
00b433ba84df
Remove some stray spaces
Mark Doliner <markdoliner@pidgin.im>
parents:
30296
diff
changeset
|
1958 | |
|
24625
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1959 | snacid = aim_cachesnac(od, 0x0004, 0x0006, 0x0000, NULL, 0); |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1960 | aim_im_puticbm(&bs, cookie, 0x0002, sn); |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1961 | |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1962 | byte_stream_new(&header, (7*2) + 16 + 8 + 2 + sizeof(c_plugindata) + xmllen); /* TLV 0x0005 Stream + Size */ |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1963 | byte_stream_put16(&header, 0x0000); /* Message Type: Request */ |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1964 | byte_stream_putraw(&header, cookie, sizeof(cookie)); /* Message ID */ |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1965 | byte_stream_putraw(&header, pluginid, sizeof(pluginid)); /* Plugin ID */ |
|
30457
00b433ba84df
Remove some stray spaces
Mark Doliner <markdoliner@pidgin.im>
parents:
30296
diff
changeset
|
1966 | |
|
24625
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1967 | aim_tlvlist_add_16(&inner_tlvlist, 0x000a, 0x0001); |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1968 | aim_tlvlist_add_noval(&inner_tlvlist, 0x000f); |
|
30457
00b433ba84df
Remove some stray spaces
Mark Doliner <markdoliner@pidgin.im>
parents:
30296
diff
changeset
|
1969 | |
|
24625
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1970 | /* Add Plugin Specific Data */ |
|
30462
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
1971 | byte_stream_new(&plugindata, (sizeof(c_plugindata) + xmllen)); |
|
24625
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1972 | byte_stream_putraw(&plugindata, c_plugindata, sizeof(c_plugindata)); /* Content of TLV 0x2711 */ |
|
30841
b4a5a160e11a
Simplify the way that string length and memory allocation is done.
Daniel Atallah <datallah@pidgin.im>
parents:
30708
diff
changeset
|
1973 | byte_stream_putraw(&plugindata, (const guint8*)statxml, xmllen); |
|
24625
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1974 | |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1975 | aim_tlvlist_add_raw(&inner_tlvlist, 0x2711, (sizeof(c_plugindata) + xmllen), plugindata.data); |
|
30457
00b433ba84df
Remove some stray spaces
Mark Doliner <markdoliner@pidgin.im>
parents:
30296
diff
changeset
|
1976 | |
|
24625
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1977 | aim_tlvlist_write(&header, &inner_tlvlist); |
|
30462
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
1978 | aim_tlvlist_free(inner_tlvlist); |
|
30457
00b433ba84df
Remove some stray spaces
Mark Doliner <markdoliner@pidgin.im>
parents:
30296
diff
changeset
|
1979 | |
|
24625
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1980 | aim_tlvlist_add_raw(&outer_tlvlist, 0x0005, byte_stream_curpos(&header), header.data); |
|
30462
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
1981 | aim_tlvlist_add_noval(&outer_tlvlist, 0x0003); /* Empty TLV 0x0003 */ |
|
30457
00b433ba84df
Remove some stray spaces
Mark Doliner <markdoliner@pidgin.im>
parents:
30296
diff
changeset
|
1982 | |
|
24625
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1983 | aim_tlvlist_write(&bs, &outer_tlvlist); |
|
30457
00b433ba84df
Remove some stray spaces
Mark Doliner <markdoliner@pidgin.im>
parents:
30296
diff
changeset
|
1984 | |
|
24625
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1985 | purple_debug_misc("oscar", "X-Status Request\n"); |
|
30678
78aacd015725
Removed unused "flags" parameter.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30677
diff
changeset
|
1986 | flap_connection_send_snac_with_priority(od, conn, 0x0004, 0x0006, snacid, &bs, TRUE); |
|
24625
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1987 | |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1988 | aim_tlvlist_free(outer_tlvlist); |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1989 | byte_stream_destroy(&header); |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1990 | byte_stream_destroy(&plugindata); |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1991 | byte_stream_destroy(&bs); |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1992 | g_free(statxml); |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1993 | |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1994 | return 0; |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1995 | } |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1996 | |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1997 | int icq_relay_xstatus(OscarData *od, const char *sn, const guchar *cookie) |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1998 | { |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
1999 | FlapConnection *conn; |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
2000 | ByteStream bs; |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
2001 | aim_snacid_t snacid; |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
2002 | PurpleAccount *account; |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
2003 | PurpleStatus *status; |
|
30462
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
2004 | const char *fmt; |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
2005 | const char *formatted_msg; |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
2006 | char *msg; |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
2007 | char *statxml; |
|
24625
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
2008 | const char *title; |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
2009 | int len; |
|
30457
00b433ba84df
Remove some stray spaces
Mark Doliner <markdoliner@pidgin.im>
parents:
30296
diff
changeset
|
2010 | |
|
24625
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
2011 | static const guint8 plugindata[] = { |
|
30462
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
2012 | 0x1B, 0x00, |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
2013 | 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
2014 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
2015 | 0x01, 0x00, 0x00, 0x00, 0x00, 0xF9, 0xD1, 0x0E, 0x00, 0xF9, 0xD1, |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
2016 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
2017 | 0x00, 0x1A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x4F, |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
2018 | 0x00, 0x3B, 0x60, 0xB3, 0xEF, 0xD8, 0x2A, 0x6C, 0x45, 0xA4, 0xE0, |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
2019 | 0x9C, 0x5A, 0x5E, 0x67, 0xE8, 0x65, 0x08, 0x00, 0x2A, 0x00, 0x00, |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
2020 | 0x00, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x20, 0x50, 0x6C, 0x75, |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
2021 | 0x67, 0x2D, 0x69, 0x6E, 0x3A, 0x20, 0x52, 0x65, 0x6D, 0x6F, 0x74, |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
2022 | 0x65, 0x20, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
2023 | 0x69, 0x6F, 0x6E, 0x20, 0x41, 0x72, 0x72, 0x69, 0x76, 0x65, 0x00, |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
2024 | 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
2025 | 0x00, 0x00, 0x00, 0xF3, 0x01, 0x00, 0x00, 0xEF, 0x01, 0x00, 0x00 |
|
30457
00b433ba84df
Remove some stray spaces
Mark Doliner <markdoliner@pidgin.im>
parents:
30296
diff
changeset
|
2026 | }; |
|
24625
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
2027 | |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
2028 | fmt = "<NR><RES><ret event='OnRemoteNotification'><srv><id>cAwaySrv</id><val srv_id='cAwaySrv'><Root><CASXtraSetAwayMessage></CASXtraSetAwayMessage>&l t;uin>%s</uin><index>1</index><title>%s</title><desc>%s</desc></Root></val></srv><srv><id>cRandomizerSrv</id><val srv_id='cRandomizerSrv'>undefined</val></srv></ret></RES></NR>\r\n"; |
|
30457
00b433ba84df
Remove some stray spaces
Mark Doliner <markdoliner@pidgin.im>
parents:
30296
diff
changeset
|
2029 | |
|
24625
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
2030 | if (!od || !(conn = flap_connection_findbygroup(od, 0x0002))) |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
2031 | return -EINVAL; |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
2032 | |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
2033 | if (!sn) |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
2034 | return -EINVAL; |
|
30457
00b433ba84df
Remove some stray spaces
Mark Doliner <markdoliner@pidgin.im>
parents:
30296
diff
changeset
|
2035 | |
|
24625
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
2036 | account = purple_connection_get_account(od->gc); |
|
30462
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
2037 | if (!account) |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
2038 | return -EINVAL; |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
2039 | |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
35992
diff
changeset
|
2040 | /* if (purple_strequal(account->username, sn)) |
|
24625
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
2041 | icq_im_xstatus_request(od, sn); */ |
|
30457
00b433ba84df
Remove some stray spaces
Mark Doliner <markdoliner@pidgin.im>
parents:
30296
diff
changeset
|
2042 | |
|
32438
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31274
diff
changeset
|
2043 | status = purple_presence_get_active_status(purple_account_get_presence(account)); |
|
30462
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
2044 | if (!status) |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
2045 | return -EINVAL; |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
2046 | |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
2047 | title = purple_status_get_name(status); |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
2048 | if (!title) |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
2049 | return -EINVAL; |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
2050 | |
|
24625
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
2051 | formatted_msg = purple_status_get_attr_string(status, "message"); |
|
30462
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
2052 | if (!formatted_msg) |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
2053 | return -EINVAL; |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
2054 | |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
2055 | msg = purple_markup_strip_html(formatted_msg); |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
2056 | if (!msg) |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
2057 | return -EINVAL; |
|
4d07585c3d1e
Formatting changes. Hopefully I didn't break anything this time
Mark Doliner <markdoliner@pidgin.im>
parents:
30457
diff
changeset
|
2058 | |
|
32438
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31274
diff
changeset
|
2059 | statxml = g_strdup_printf(fmt, purple_account_get_username(account), title, msg); |
|
30841
b4a5a160e11a
Simplify the way that string length and memory allocation is done.
Daniel Atallah <datallah@pidgin.im>
parents:
30708
diff
changeset
|
2060 | len = strlen(statxml); |
|
24625
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
2061 | |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
2062 | purple_debug_misc("oscar", "X-Status AutoReply: %s, %s\n", formatted_msg, msg); |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
2063 | |
|
30841
b4a5a160e11a
Simplify the way that string length and memory allocation is done.
Daniel Atallah <datallah@pidgin.im>
parents:
30708
diff
changeset
|
2064 | byte_stream_new(&bs, 10 + 8 + 2 + 1 + strlen(sn) + 2 + sizeof(plugindata) + len); /* 16 extra */ |
|
24625
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
2065 | |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
2066 | snacid = aim_cachesnac(od, 0x0004, 0x000b, 0x0000, NULL, 0); |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
2067 | aim_im_puticbm(&bs, cookie, 0x0002, sn); |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
2068 | byte_stream_put16(&bs, 0x0003); |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
2069 | byte_stream_putraw(&bs, plugindata, sizeof(plugindata)); |
|
30841
b4a5a160e11a
Simplify the way that string length and memory allocation is done.
Daniel Atallah <datallah@pidgin.im>
parents:
30708
diff
changeset
|
2070 | byte_stream_putraw(&bs, (const guint8*)statxml, len); |
|
30457
00b433ba84df
Remove some stray spaces
Mark Doliner <markdoliner@pidgin.im>
parents:
30296
diff
changeset
|
2071 | |
|
30678
78aacd015725
Removed unused "flags" parameter.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30677
diff
changeset
|
2072 | flap_connection_send_snac_with_priority(od, conn, 0x0004, 0x000b, snacid, &bs, TRUE); |
|
24625
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
2073 | |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
2074 | g_free(statxml); |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
2075 | g_free(msg); |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
2076 | byte_stream_destroy(&bs); |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
2077 | |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
2078 | return 0; |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
2079 | } |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
2080 | |
|
4082cd694acb
This patch comes from the combined work of contributors minstrel, NightFox,
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
23456
diff
changeset
|
2081 | /* |
| 13235 | 2082 | * Subtype 0x0014 - Receive a mini typing notification (mtn) packet. |
| 2083 | * | |
| 2084 | * This is supported by winaim5 and newer, MacAIM bleh and newer, iChat bleh and newer, | |
| 15884 | 2085 | * and Purple 0.60 and newer. |
| 13235 | 2086 | * |
| 2087 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2088 | static int mtn_receive(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
| 13235 | 2089 | { |
| 2090 | int ret = 0; | |
| 2091 | 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
|
2092 | 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
|
2093 | guint8 bnlen; |
|
28522
836f2f99ba99
Rename two variables based on insight from
Mark Doliner <markdoliner@pidgin.im>
parents:
28521
diff
changeset
|
2094 | guint16 channel, event; |
|
836f2f99ba99
Rename two variables based on insight from
Mark Doliner <markdoliner@pidgin.im>
parents:
28521
diff
changeset
|
2095 | |
|
836f2f99ba99
Rename two variables based on insight from
Mark Doliner <markdoliner@pidgin.im>
parents:
28521
diff
changeset
|
2096 | byte_stream_advance(bs, 8); /* ICBM cookie */ |
|
836f2f99ba99
Rename two variables based on insight from
Mark Doliner <markdoliner@pidgin.im>
parents:
28521
diff
changeset
|
2097 | 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
|
2098 | 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
|
2099 | bn = byte_stream_getstr(bs, bnlen); |
|
32978
15ee0ec69dfa
Validate utf8 for a few random strings that we read, in case AOL or ICQ
Mark Doliner <markdoliner@pidgin.im>
parents:
32863
diff
changeset
|
2100 | if (!g_utf8_validate(bn, -1, NULL)) { |
|
15ee0ec69dfa
Validate utf8 for a few random strings that we read, in case AOL or ICQ
Mark Doliner <markdoliner@pidgin.im>
parents:
32863
diff
changeset
|
2101 | purple_debug_warning("oscar", "Received SNAC %04hx/%04hx with " |
|
15ee0ec69dfa
Validate utf8 for a few random strings that we read, in case AOL or ICQ
Mark Doliner <markdoliner@pidgin.im>
parents:
32863
diff
changeset
|
2102 | "invalid UTF-8 buddy name.\n", snac->family, snac->subtype); |
|
15ee0ec69dfa
Validate utf8 for a few random strings that we read, in case AOL or ICQ
Mark Doliner <markdoliner@pidgin.im>
parents:
32863
diff
changeset
|
2103 | g_free(bn); |
|
15ee0ec69dfa
Validate utf8 for a few random strings that we read, in case AOL or ICQ
Mark Doliner <markdoliner@pidgin.im>
parents:
32863
diff
changeset
|
2104 | return 1; |
|
15ee0ec69dfa
Validate utf8 for a few random strings that we read, in case AOL or ICQ
Mark Doliner <markdoliner@pidgin.im>
parents:
32863
diff
changeset
|
2105 | } |
|
28522
836f2f99ba99
Rename two variables based on insight from
Mark Doliner <markdoliner@pidgin.im>
parents:
28521
diff
changeset
|
2106 | event = byte_stream_get16(bs); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2107 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2108 | if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) |
|
28522
836f2f99ba99
Rename two variables based on insight from
Mark Doliner <markdoliner@pidgin.im>
parents:
28521
diff
changeset
|
2109 | ret = userfunc(od, conn, frame, channel, bn, event); |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2110 | |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25086
diff
changeset
|
2111 | g_free(bn); |
| 13235 | 2112 | |
| 2113 | return ret; | |
| 2114 | } | |
| 2115 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2116 | static int |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2117 | snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
| 13235 | 2118 | { |
|
28806
a724c42684d3
oscar: Display more detailed error messages when an outgoing message is bounced.
Aman Gupta <aman@tmm1.net>
parents:
28522
diff
changeset
|
2119 | if (snac->subtype == 0x0001) |
|
a724c42684d3
oscar: Display more detailed error messages when an outgoing message is bounced.
Aman Gupta <aman@tmm1.net>
parents:
28522
diff
changeset
|
2120 | return error(od, conn, mod, frame, snac, bs); |
|
a724c42684d3
oscar: Display more detailed error messages when an outgoing message is bounced.
Aman Gupta <aman@tmm1.net>
parents:
28522
diff
changeset
|
2121 | else if (snac->subtype == 0x0005) |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2122 | return aim_im_paraminfo(od, conn, mod, frame, snac, bs); |
| 13235 | 2123 | else if (snac->subtype == 0x0007) |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2124 | return incomingim(od, conn, mod, frame, snac, bs); |
| 13235 | 2125 | else if (snac->subtype == 0x000a) |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2126 | return missedcall(od, conn, mod, frame, snac, bs); |
| 13235 | 2127 | else if (snac->subtype == 0x000b) |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2128 | return clientautoresp(od, conn, mod, frame, snac, bs); |
| 13235 | 2129 | else if (snac->subtype == 0x000c) |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2130 | return msgack(od, conn, mod, frame, snac, bs); |
| 13235 | 2131 | else if (snac->subtype == 0x0014) |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2132 | return mtn_receive(od, conn, mod, frame, snac, bs); |
| 13235 | 2133 | |
| 2134 | return 0; | |
| 2135 | } | |
| 2136 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2137 | int |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
2138 | msg_modfirst(OscarData *od, aim_module_t *mod) |
| 13235 | 2139 | { |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
2140 | mod->family = SNAC_FAMILY_ICBM; |
| 13235 | 2141 | mod->version = 0x0001; |
| 2142 | mod->toolid = 0x0110; | |
| 2143 | mod->toolversion = 0x0629; | |
| 2144 | mod->flags = 0; | |
| 2145 | strncpy(mod->name, "messaging", sizeof(mod->name)); | |
| 2146 | mod->snachandler = snachandler; | |
| 2147 | ||
| 2148 | return 0; | |
| 2149 | } |