Sun, 11 Apr 2010 10:02:02 +0000
There's no reason to call into oscar.c anymore, so move this icon stuff
directly into family_oservice.c
2 files changed, 38 insertions(+), 71 deletions(-)
But more importantly, this is simpler and oscar.c is smaller.
| 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:
17443
diff
changeset
|
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 13235 | 19 | */ |
| 20 | ||
| 21 | /* | |
| 22 | * Family 0x0001 - This is a very special group. All connections support | |
| 23 | * this group, as it does some particularly good things (like rate limiting). | |
| 24 | */ | |
| 25 | ||
| 26 | #include "oscar.h" | |
| 27 | ||
| 28 | #include "cipher.h" | |
| 29 | ||
|
29259
87336a2f470d
optimization to the oscar prpl to use less memory, care of Shaun Lindsay
Mark Doliner <markdoliner@pidgin.im>
parents:
29257
diff
changeset
|
30 | /* |
|
87336a2f470d
optimization to the oscar prpl to use less memory, care of Shaun Lindsay
Mark Doliner <markdoliner@pidgin.im>
parents:
29257
diff
changeset
|
31 | * Each time we make a FLAP connection to an oscar server the server gives |
|
87336a2f470d
optimization to the oscar prpl to use less memory, care of Shaun Lindsay
Mark Doliner <markdoliner@pidgin.im>
parents:
29257
diff
changeset
|
32 | * us a list of rate classes. Each rate class has different properties for |
|
87336a2f470d
optimization to the oscar prpl to use less memory, care of Shaun Lindsay
Mark Doliner <markdoliner@pidgin.im>
parents:
29257
diff
changeset
|
33 | * how frequently we can send SNACs in that rate class before we become |
|
87336a2f470d
optimization to the oscar prpl to use less memory, care of Shaun Lindsay
Mark Doliner <markdoliner@pidgin.im>
parents:
29257
diff
changeset
|
34 | * throttled or disconnected. |
|
87336a2f470d
optimization to the oscar prpl to use less memory, care of Shaun Lindsay
Mark Doliner <markdoliner@pidgin.im>
parents:
29257
diff
changeset
|
35 | * |
|
87336a2f470d
optimization to the oscar prpl to use less memory, care of Shaun Lindsay
Mark Doliner <markdoliner@pidgin.im>
parents:
29257
diff
changeset
|
36 | * The server also gives us a list of every available SNAC and tells us which |
|
87336a2f470d
optimization to the oscar prpl to use less memory, care of Shaun Lindsay
Mark Doliner <markdoliner@pidgin.im>
parents:
29257
diff
changeset
|
37 | * rate class it's in. There are a lot of different SNACs, so this list can be |
|
87336a2f470d
optimization to the oscar prpl to use less memory, care of Shaun Lindsay
Mark Doliner <markdoliner@pidgin.im>
parents:
29257
diff
changeset
|
38 | * fairly large. One important characteristic of these rate classes is that |
|
87336a2f470d
optimization to the oscar prpl to use less memory, care of Shaun Lindsay
Mark Doliner <markdoliner@pidgin.im>
parents:
29257
diff
changeset
|
39 | * currently (and since at least 2004) most SNACs are in the same rate class. |
|
87336a2f470d
optimization to the oscar prpl to use less memory, care of Shaun Lindsay
Mark Doliner <markdoliner@pidgin.im>
parents:
29257
diff
changeset
|
40 | * |
|
87336a2f470d
optimization to the oscar prpl to use less memory, care of Shaun Lindsay
Mark Doliner <markdoliner@pidgin.im>
parents:
29257
diff
changeset
|
41 | * One optimization we can do to save memory is to only keep track of SNACs |
|
87336a2f470d
optimization to the oscar prpl to use less memory, care of Shaun Lindsay
Mark Doliner <markdoliner@pidgin.im>
parents:
29257
diff
changeset
|
42 | * that are in classes other than this default rate class. So if we try to |
|
87336a2f470d
optimization to the oscar prpl to use less memory, care of Shaun Lindsay
Mark Doliner <markdoliner@pidgin.im>
parents:
29257
diff
changeset
|
43 | * look up a SNAC and it's not in our hash table then we can assume that it's |
|
87336a2f470d
optimization to the oscar prpl to use less memory, care of Shaun Lindsay
Mark Doliner <markdoliner@pidgin.im>
parents:
29257
diff
changeset
|
44 | * in the default rate class. |
|
87336a2f470d
optimization to the oscar prpl to use less memory, care of Shaun Lindsay
Mark Doliner <markdoliner@pidgin.im>
parents:
29257
diff
changeset
|
45 | */ |
|
87336a2f470d
optimization to the oscar prpl to use less memory, care of Shaun Lindsay
Mark Doliner <markdoliner@pidgin.im>
parents:
29257
diff
changeset
|
46 | #define OSCAR_DEFAULT_RATECLASS 1 |
|
87336a2f470d
optimization to the oscar prpl to use less memory, care of Shaun Lindsay
Mark Doliner <markdoliner@pidgin.im>
parents:
29257
diff
changeset
|
47 | |
| 13235 | 48 | /* Subtype 0x0002 - Client Online */ |
|
13610
b2c15a312144
[gaim-migrate @ 15995]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
49 | void |
|
24114
9f8a5772ffc6
It helps to rename the function
Mark Doliner <markdoliner@pidgin.im>
parents:
23526
diff
changeset
|
50 | aim_srv_clientready(OscarData *od, FlapConnection *conn) |
| 13235 | 51 | { |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
52 | ByteStream bs; |
| 13235 | 53 | aim_snacid_t snacid; |
|
14410
a5ae93474db6
[gaim-migrate @ 17050]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
54 | GSList *cur; |
| 13235 | 55 | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
56 | byte_stream_new(&bs, 1142); |
| 13235 | 57 | |
| 58 | /* | |
| 59 | * Send only the tool versions that the server cares about (that it | |
| 60 | * marked as supporting in the server ready SNAC). | |
| 61 | */ | |
|
13612
c51da9e6fec1
[gaim-migrate @ 15997]
Mark Doliner <markdoliner@pidgin.im>
parents:
13610
diff
changeset
|
62 | for (cur = conn->groups; cur != NULL; cur = cur->next) |
|
13610
b2c15a312144
[gaim-migrate @ 15995]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
63 | { |
| 13235 | 64 | aim_module_t *mod; |
| 65 | ||
|
13612
c51da9e6fec1
[gaim-migrate @ 15997]
Mark Doliner <markdoliner@pidgin.im>
parents:
13610
diff
changeset
|
66 | if ((mod = aim__findmodulebygroup(od, GPOINTER_TO_UINT(cur->data)))) |
|
c51da9e6fec1
[gaim-migrate @ 15997]
Mark Doliner <markdoliner@pidgin.im>
parents:
13610
diff
changeset
|
67 | { |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
68 | byte_stream_put16(&bs, mod->family); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
69 | byte_stream_put16(&bs, mod->version); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
70 | byte_stream_put16(&bs, mod->toolid); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
71 | byte_stream_put16(&bs, mod->toolversion); |
|
13612
c51da9e6fec1
[gaim-migrate @ 15997]
Mark Doliner <markdoliner@pidgin.im>
parents:
13610
diff
changeset
|
72 | } |
| 13235 | 73 | } |
| 74 | ||
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
75 | snacid = aim_cachesnac(od, SNAC_FAMILY_OSERVICE, 0x0002, 0x0000, NULL, 0); |
|
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
76 | flap_connection_send_snac(od, conn, SNAC_FAMILY_OSERVICE, 0x0002, 0x0000, snacid, &bs); |
|
23004
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22860
diff
changeset
|
77 | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
78 | byte_stream_destroy(&bs); |
| 13235 | 79 | } |
| 80 | ||
| 81 | /* | |
| 82 | * Subtype 0x0003 - Host Online | |
| 83 | * | |
| 84 | * See comments in conn.c about how the group associations are supposed | |
| 85 | * to work, and how they really work. | |
| 86 | * | |
| 87 | * This info probably doesn't even need to make it to the client. | |
| 88 | * | |
| 89 | * We don't actually call the client here. This starts off the connection | |
| 90 | * initialization routine required by all AIM connections. The next time | |
| 91 | * the client is called is the CONNINITDONE callback, which should be | |
| 92 | * shortly after the rate information is acknowledged. | |
| 93 | * | |
| 94 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
95 | static int |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
96 | hostonline(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
| 13235 | 97 | { |
|
13612
c51da9e6fec1
[gaim-migrate @ 15997]
Mark Doliner <markdoliner@pidgin.im>
parents:
13610
diff
changeset
|
98 | int group; |
| 13235 | 99 | |
|
13612
c51da9e6fec1
[gaim-migrate @ 15997]
Mark Doliner <markdoliner@pidgin.im>
parents:
13610
diff
changeset
|
100 | while (byte_stream_empty(bs)) |
|
c51da9e6fec1
[gaim-migrate @ 15997]
Mark Doliner <markdoliner@pidgin.im>
parents:
13610
diff
changeset
|
101 | { |
|
c51da9e6fec1
[gaim-migrate @ 15997]
Mark Doliner <markdoliner@pidgin.im>
parents:
13610
diff
changeset
|
102 | group = byte_stream_get16(bs); |
|
14410
a5ae93474db6
[gaim-migrate @ 17050]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
103 | conn->groups = g_slist_prepend(conn->groups, GUINT_TO_POINTER(group)); |
| 13235 | 104 | } |
| 105 | ||
| 106 | /* | |
| 107 | * Next step is in the Host Versions handler. | |
| 108 | * | |
| 109 | * Note that we must send this before we request rates, since | |
| 110 | * the format of the rate information depends on the versions we | |
| 111 | * give it. | |
| 112 | * | |
| 113 | */ | |
|
15147
101192282f5d
[gaim-migrate @ 17871]
Mark Doliner <markdoliner@pidgin.im>
parents:
14708
diff
changeset
|
114 | aim_srv_setversions(od, conn); |
| 13235 | 115 | |
| 116 | return 1; | |
| 117 | } | |
| 118 | ||
| 119 | /* Subtype 0x0004 - Service request */ | |
|
15147
101192282f5d
[gaim-migrate @ 17871]
Mark Doliner <markdoliner@pidgin.im>
parents:
14708
diff
changeset
|
120 | void |
|
101192282f5d
[gaim-migrate @ 17871]
Mark Doliner <markdoliner@pidgin.im>
parents:
14708
diff
changeset
|
121 | aim_srv_requestnew(OscarData *od, guint16 serviceid) |
| 13235 | 122 | { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
123 | FlapConnection *conn; |
|
25127
5fc0c3f2a102
Part 2 of the continuing effort to get OSCAR over SSL working.
Paul Aurich <darkrain42@pidgin.im>
parents:
24114
diff
changeset
|
124 | ByteStream bs; |
|
5fc0c3f2a102
Part 2 of the continuing effort to get OSCAR over SSL working.
Paul Aurich <darkrain42@pidgin.im>
parents:
24114
diff
changeset
|
125 | aim_snacid_t snacid; |
|
5fc0c3f2a102
Part 2 of the continuing effort to get OSCAR over SSL working.
Paul Aurich <darkrain42@pidgin.im>
parents:
24114
diff
changeset
|
126 | GSList *tlvlist = NULL; |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
127 | |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
128 | conn = flap_connection_findbygroup(od, SNAC_FAMILY_BOS); |
|
15341
486e3de35514
[gaim-migrate @ 18069]
Evan Schoenberg <evands@pidgin.im>
parents:
15168
diff
changeset
|
129 | if(!conn) |
|
486e3de35514
[gaim-migrate @ 18069]
Evan Schoenberg <evands@pidgin.im>
parents:
15168
diff
changeset
|
130 | return; |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
131 | |
|
25127
5fc0c3f2a102
Part 2 of the continuing effort to get OSCAR over SSL working.
Paul Aurich <darkrain42@pidgin.im>
parents:
24114
diff
changeset
|
132 | byte_stream_new(&bs, 6); |
|
5fc0c3f2a102
Part 2 of the continuing effort to get OSCAR over SSL working.
Paul Aurich <darkrain42@pidgin.im>
parents:
24114
diff
changeset
|
133 | |
|
5fc0c3f2a102
Part 2 of the continuing effort to get OSCAR over SSL working.
Paul Aurich <darkrain42@pidgin.im>
parents:
24114
diff
changeset
|
134 | byte_stream_put16(&bs, serviceid); |
|
5fc0c3f2a102
Part 2 of the continuing effort to get OSCAR over SSL working.
Paul Aurich <darkrain42@pidgin.im>
parents:
24114
diff
changeset
|
135 | |
|
5fc0c3f2a102
Part 2 of the continuing effort to get OSCAR over SSL working.
Paul Aurich <darkrain42@pidgin.im>
parents:
24114
diff
changeset
|
136 | if (od->use_ssl) |
|
25519
d15507b37c1a
Shuffle a few comments around to make it look like I did something
Mark Doliner <markdoliner@pidgin.im>
parents:
25127
diff
changeset
|
137 | /* Request SSL Connection */ |
|
25127
5fc0c3f2a102
Part 2 of the continuing effort to get OSCAR over SSL working.
Paul Aurich <darkrain42@pidgin.im>
parents:
24114
diff
changeset
|
138 | aim_tlvlist_add_noval(&tlvlist, 0x008c); |
|
5fc0c3f2a102
Part 2 of the continuing effort to get OSCAR over SSL working.
Paul Aurich <darkrain42@pidgin.im>
parents:
24114
diff
changeset
|
139 | |
|
5fc0c3f2a102
Part 2 of the continuing effort to get OSCAR over SSL working.
Paul Aurich <darkrain42@pidgin.im>
parents:
24114
diff
changeset
|
140 | aim_tlvlist_write(&bs, &tlvlist); |
|
5fc0c3f2a102
Part 2 of the continuing effort to get OSCAR over SSL working.
Paul Aurich <darkrain42@pidgin.im>
parents:
24114
diff
changeset
|
141 | aim_tlvlist_free(tlvlist); |
|
5fc0c3f2a102
Part 2 of the continuing effort to get OSCAR over SSL working.
Paul Aurich <darkrain42@pidgin.im>
parents:
24114
diff
changeset
|
142 | |
|
5fc0c3f2a102
Part 2 of the continuing effort to get OSCAR over SSL working.
Paul Aurich <darkrain42@pidgin.im>
parents:
24114
diff
changeset
|
143 | snacid = aim_cachesnac(od, SNAC_FAMILY_OSERVICE, 0x0004, 0x0000, NULL, 0); |
|
5fc0c3f2a102
Part 2 of the continuing effort to get OSCAR over SSL working.
Paul Aurich <darkrain42@pidgin.im>
parents:
24114
diff
changeset
|
144 | flap_connection_send_snac(od, conn, SNAC_FAMILY_OSERVICE, 0x0004, 0x0000, snacid, &bs); |
|
5fc0c3f2a102
Part 2 of the continuing effort to get OSCAR over SSL working.
Paul Aurich <darkrain42@pidgin.im>
parents:
24114
diff
changeset
|
145 | |
|
5fc0c3f2a102
Part 2 of the continuing effort to get OSCAR over SSL working.
Paul Aurich <darkrain42@pidgin.im>
parents:
24114
diff
changeset
|
146 | byte_stream_destroy(&bs); |
| 13235 | 147 | } |
| 148 | ||
| 149 | /* | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
150 | * Join a room of name roomname. This is the first step to joining an |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
151 | * already created room. It's basically a Service Request for |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
152 | * family 0x000e, with a little added on to specify the exchange and room |
| 13235 | 153 | * name. |
| 154 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
155 | int |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
156 | aim_chat_join(OscarData *od, guint16 exchange, const char *roomname, guint16 instance) |
| 13235 | 157 | { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
158 | 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:
22622
diff
changeset
|
159 | ByteStream bs; |
| 13235 | 160 | 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
|
161 | GSList *tlvlist = NULL; |
| 13235 | 162 | struct chatsnacinfo csi; |
| 163 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
164 | conn = flap_connection_findbygroup(od, SNAC_FAMILY_BOS); |
|
25127
5fc0c3f2a102
Part 2 of the continuing effort to get OSCAR over SSL working.
Paul Aurich <darkrain42@pidgin.im>
parents:
24114
diff
changeset
|
165 | if (!conn || !roomname || roomname[0] == '\0') |
| 13235 | 166 | return -EINVAL; |
| 167 | ||
|
25127
5fc0c3f2a102
Part 2 of the continuing effort to get OSCAR over SSL working.
Paul Aurich <darkrain42@pidgin.im>
parents:
24114
diff
changeset
|
168 | byte_stream_new(&bs, 506); |
| 13235 | 169 | |
| 170 | memset(&csi, 0, sizeof(csi)); | |
| 171 | csi.exchange = exchange; | |
|
25700
1c47af7fda59
I forgot about g_strlcpy in 3d3f63414473d19a9f2eb0cdeab673cde67dbda9.
Daniel Atallah <datallah@pidgin.im>
parents:
25696
diff
changeset
|
172 | g_strlcpy(csi.name, roomname, sizeof(csi.name)); |
| 13235 | 173 | csi.instance = instance; |
| 174 | ||
| 175 | /* | |
| 176 | * Requesting service chat (0x000e) | |
| 177 | */ | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
178 | byte_stream_put16(&bs, 0x000e); |
| 13235 | 179 | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
180 | aim_tlvlist_add_chatroom(&tlvlist, 0x0001, exchange, roomname, instance); |
|
25127
5fc0c3f2a102
Part 2 of the continuing effort to get OSCAR over SSL working.
Paul Aurich <darkrain42@pidgin.im>
parents:
24114
diff
changeset
|
181 | |
|
5fc0c3f2a102
Part 2 of the continuing effort to get OSCAR over SSL working.
Paul Aurich <darkrain42@pidgin.im>
parents:
24114
diff
changeset
|
182 | if (od->use_ssl) |
|
25519
d15507b37c1a
Shuffle a few comments around to make it look like I did something
Mark Doliner <markdoliner@pidgin.im>
parents:
25127
diff
changeset
|
183 | /* Request SSL Connection */ |
|
25127
5fc0c3f2a102
Part 2 of the continuing effort to get OSCAR over SSL working.
Paul Aurich <darkrain42@pidgin.im>
parents:
24114
diff
changeset
|
184 | aim_tlvlist_add_noval(&tlvlist, 0x008c); |
|
5fc0c3f2a102
Part 2 of the continuing effort to get OSCAR over SSL working.
Paul Aurich <darkrain42@pidgin.im>
parents:
24114
diff
changeset
|
185 | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
186 | 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
|
187 | aim_tlvlist_free(tlvlist); |
| 13235 | 188 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
189 | snacid = aim_cachesnac(od, SNAC_FAMILY_OSERVICE, 0x0004, 0x0000, &csi, sizeof(csi)); |
|
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
190 | flap_connection_send_snac(od, conn, SNAC_FAMILY_OSERVICE, 0x0004, 0x0000, snacid, &bs); |
| 13235 | 191 | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
192 | byte_stream_destroy(&bs); |
|
23004
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22860
diff
changeset
|
193 | |
| 13235 | 194 | return 0; |
| 195 | } | |
| 196 | ||
| 197 | /* Subtype 0x0005 - Redirect */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
198 | static int |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
199 | redirect(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
| 13235 | 200 | { |
| 201 | struct aim_redirect_data redir; | |
| 202 | aim_rxcallback_t userfunc; | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
203 | GSList *tlvlist; |
| 13235 | 204 | aim_snac_t *origsnac = NULL; |
| 205 | int ret = 0; | |
| 206 | ||
| 207 | memset(&redir, 0, sizeof(redir)); | |
| 208 | ||
| 209 | tlvlist = aim_tlvlist_read(bs); | |
| 210 | ||
| 211 | if (!aim_tlv_gettlv(tlvlist, 0x000d, 1) || | |
| 212 | !aim_tlv_gettlv(tlvlist, 0x0005, 1) || | |
| 213 | !aim_tlv_gettlv(tlvlist, 0x0006, 1)) { | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
214 | aim_tlvlist_free(tlvlist); |
| 13235 | 215 | return 0; |
| 216 | } | |
| 217 | ||
| 218 | redir.group = aim_tlv_get16(tlvlist, 0x000d, 1); | |
| 219 | redir.ip = aim_tlv_getstr(tlvlist, 0x0005, 1); | |
| 220 | redir.cookielen = aim_tlv_gettlv(tlvlist, 0x0006, 1)->length; | |
| 221 | redir.cookie = (guchar *)aim_tlv_getstr(tlvlist, 0x0006, 1); | |
|
25127
5fc0c3f2a102
Part 2 of the continuing effort to get OSCAR over SSL working.
Paul Aurich <darkrain42@pidgin.im>
parents:
24114
diff
changeset
|
222 | redir.ssl_cert_cn = aim_tlv_getstr(tlvlist, 0x008d, 1); |
|
5fc0c3f2a102
Part 2 of the continuing effort to get OSCAR over SSL working.
Paul Aurich <darkrain42@pidgin.im>
parents:
24114
diff
changeset
|
223 | redir.use_ssl = aim_tlv_get8(tlvlist, 0x008e, 1); |
| 13235 | 224 | |
| 225 | /* Fetch original SNAC so we can get csi if needed */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
226 | origsnac = aim_remsnac(od, snac->id); |
| 13235 | 227 | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
228 | if ((redir.group == SNAC_FAMILY_CHAT) && origsnac) { |
| 13235 | 229 | struct chatsnacinfo *csi = (struct chatsnacinfo *)origsnac->data; |
| 230 | ||
| 231 | redir.chat.exchange = csi->exchange; | |
| 232 | redir.chat.room = csi->name; | |
| 233 | redir.chat.instance = csi->instance; | |
| 234 | } | |
| 235 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
236 | if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
237 | ret = userfunc(od, conn, frame, &redir); |
| 13235 | 238 | |
|
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
|
239 | g_free((void *)redir.ip); |
|
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
|
240 | g_free((void *)redir.cookie); |
|
25127
5fc0c3f2a102
Part 2 of the continuing effort to get OSCAR over SSL working.
Paul Aurich <darkrain42@pidgin.im>
parents:
24114
diff
changeset
|
241 | g_free((void *)redir.ssl_cert_cn); |
| 13235 | 242 | |
| 243 | if (origsnac) | |
|
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
|
244 | g_free(origsnac->data); |
|
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
245 | g_free(origsnac); |
| 13235 | 246 | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
247 | aim_tlvlist_free(tlvlist); |
| 13235 | 248 | |
| 249 | return ret; | |
| 250 | } | |
| 251 | ||
| 252 | /* Subtype 0x0006 - Request Rate Information. */ | |
|
13610
b2c15a312144
[gaim-migrate @ 15995]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
253 | void |
|
15147
101192282f5d
[gaim-migrate @ 17871]
Mark Doliner <markdoliner@pidgin.im>
parents:
14708
diff
changeset
|
254 | aim_srv_reqrates(OscarData *od, FlapConnection *conn) |
| 13235 | 255 | { |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
256 | aim_genericreq_n_snacid(od, conn, SNAC_FAMILY_OSERVICE, 0x0006); |
| 13235 | 257 | } |
| 258 | ||
| 259 | /* | |
| 260 | * OSCAR defines several 'rate classes'. Each class has separate | |
| 261 | * rate limiting properties (limit level, alert level, disconnect | |
| 262 | * level, etc), and a set of SNAC family/type pairs associated with | |
| 263 | * it. The rate classes, their limiting properties, and the definitions | |
|
14708
6006e069317c
[gaim-migrate @ 17392]
Evan Schoenberg <evands@pidgin.im>
parents:
14614
diff
changeset
|
264 | * of which SNACs belong to which class are defined in the |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
265 | * Rate Response packet at login to each host. |
| 13235 | 266 | * |
| 267 | * Logically, all rate offenses within one class count against further | |
| 268 | * offenses for other SNACs in the same class (ie, sending messages | |
| 269 | * too fast will limit the number of user info requests you can send, | |
| 270 | * since those two SNACs are in the same rate class). | |
| 271 | * | |
| 272 | * Since the rate classes are defined dynamically at login, the values | |
| 273 | * below may change. But they seem to be fairly constant. | |
| 274 | * | |
| 275 | * Currently, BOS defines five rate classes, with the commonly used | |
| 276 | * members as follows... | |
| 277 | * | |
| 278 | * Rate class 0x0001: | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
279 | * - Everything thats not in any of the other classes |
| 13235 | 280 | * |
| 281 | * Rate class 0x0002: | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
282 | * - Buddy list add/remove |
| 13235 | 283 | * - Permit list add/remove |
| 284 | * - Deny list add/remove | |
| 285 | * | |
| 286 | * Rate class 0x0003: | |
| 287 | * - User information requests | |
| 288 | * - Outgoing ICBMs | |
| 289 | * | |
| 290 | * Rate class 0x0004: | |
| 291 | * - A few unknowns: 2/9, 2/b, and f/2 | |
| 292 | * | |
| 293 | * Rate class 0x0005: | |
| 294 | * - Chat room create | |
| 295 | * - Outgoing chat ICBMs | |
| 296 | * | |
| 297 | * The only other thing of note is that class 5 (chat) has slightly looser | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
298 | * limiting properties than class 3 (normal messages). But thats just a |
| 13235 | 299 | * small bit of trivia for you. |
| 300 | * | |
| 301 | * The last thing that needs to be learned about the rate limiting | |
| 302 | * system is how the actual numbers relate to the passing of time. This | |
| 303 | * seems to be a big mystery. | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
304 | * |
|
15147
101192282f5d
[gaim-migrate @ 17871]
Mark Doliner <markdoliner@pidgin.im>
parents:
14708
diff
changeset
|
305 | * See joscar's javadoc for the RateClassInfo class for a great |
|
101192282f5d
[gaim-migrate @ 17871]
Mark Doliner <markdoliner@pidgin.im>
parents:
14708
diff
changeset
|
306 | * explanation. You might be able to find it at |
|
101192282f5d
[gaim-migrate @ 17871]
Mark Doliner <markdoliner@pidgin.im>
parents:
14708
diff
changeset
|
307 | * http://dscoder.com/RateClassInfo.html |
| 13235 | 308 | */ |
| 309 | ||
|
15148
48ce0abb422a
[gaim-migrate @ 17872]
Mark Doliner <markdoliner@pidgin.im>
parents:
15147
diff
changeset
|
310 | static struct rateclass * |
|
48ce0abb422a
[gaim-migrate @ 17872]
Mark Doliner <markdoliner@pidgin.im>
parents:
15147
diff
changeset
|
311 | rateclass_find(GSList *rateclasses, guint16 id) |
| 13235 | 312 | { |
|
15148
48ce0abb422a
[gaim-migrate @ 17872]
Mark Doliner <markdoliner@pidgin.im>
parents:
15147
diff
changeset
|
313 | GSList *tmp; |
| 13235 | 314 | |
|
15148
48ce0abb422a
[gaim-migrate @ 17872]
Mark Doliner <markdoliner@pidgin.im>
parents:
15147
diff
changeset
|
315 | for (tmp = rateclasses; tmp != NULL; tmp = tmp->next) |
|
48ce0abb422a
[gaim-migrate @ 17872]
Mark Doliner <markdoliner@pidgin.im>
parents:
15147
diff
changeset
|
316 | { |
|
15152
6eb1a86c7729
[gaim-migrate @ 17876]
Mark Doliner <markdoliner@pidgin.im>
parents:
15149
diff
changeset
|
317 | struct rateclass *rateclass; |
|
15148
48ce0abb422a
[gaim-migrate @ 17872]
Mark Doliner <markdoliner@pidgin.im>
parents:
15147
diff
changeset
|
318 | rateclass = tmp->data; |
|
48ce0abb422a
[gaim-migrate @ 17872]
Mark Doliner <markdoliner@pidgin.im>
parents:
15147
diff
changeset
|
319 | if (rateclass->classid == id) |
|
48ce0abb422a
[gaim-migrate @ 17872]
Mark Doliner <markdoliner@pidgin.im>
parents:
15147
diff
changeset
|
320 | return rateclass; |
| 13235 | 321 | } |
| 322 | ||
| 323 | return NULL; | |
| 324 | } | |
| 325 | ||
| 326 | /* Subtype 0x0007 - Rate Parameters */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
327 | static int |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
328 | rateresp(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
| 13235 | 329 | { |
| 330 | guint16 numclasses, i; | |
| 331 | aim_rxcallback_t userfunc; | |
| 332 | ||
| 333 | /* | |
| 334 | * First are the parameters for each rate class. | |
| 335 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
336 | numclasses = byte_stream_get16(bs); |
|
15148
48ce0abb422a
[gaim-migrate @ 17872]
Mark Doliner <markdoliner@pidgin.im>
parents:
15147
diff
changeset
|
337 | for (i = 0; i < numclasses; i++) |
|
48ce0abb422a
[gaim-migrate @ 17872]
Mark Doliner <markdoliner@pidgin.im>
parents:
15147
diff
changeset
|
338 | { |
|
48ce0abb422a
[gaim-migrate @ 17872]
Mark Doliner <markdoliner@pidgin.im>
parents:
15147
diff
changeset
|
339 | struct rateclass *rateclass; |
|
28804
24b032f5d478
oscar: Update the rate calculations based on OSCAR docs.
Aman Gupta <aman@tmm1.net>
parents:
27112
diff
changeset
|
340 | guint32 delta; |
|
24b032f5d478
oscar: Update the rate calculations based on OSCAR docs.
Aman Gupta <aman@tmm1.net>
parents:
27112
diff
changeset
|
341 | struct timeval now; |
| 13235 | 342 | |
|
28804
24b032f5d478
oscar: Update the rate calculations based on OSCAR docs.
Aman Gupta <aman@tmm1.net>
parents:
27112
diff
changeset
|
343 | gettimeofday(&now, NULL); |
|
29254
49bb9cb05e38
We set every field of this struct explicitly when we create it, so don't
Mark Doliner <markdoliner@pidgin.im>
parents:
28804
diff
changeset
|
344 | rateclass = g_new(struct rateclass, 1); |
| 13235 | 345 | |
|
15148
48ce0abb422a
[gaim-migrate @ 17872]
Mark Doliner <markdoliner@pidgin.im>
parents:
15147
diff
changeset
|
346 | rateclass->classid = byte_stream_get16(bs); |
|
48ce0abb422a
[gaim-migrate @ 17872]
Mark Doliner <markdoliner@pidgin.im>
parents:
15147
diff
changeset
|
347 | rateclass->windowsize = byte_stream_get32(bs); |
|
48ce0abb422a
[gaim-migrate @ 17872]
Mark Doliner <markdoliner@pidgin.im>
parents:
15147
diff
changeset
|
348 | rateclass->clear = byte_stream_get32(bs); |
|
48ce0abb422a
[gaim-migrate @ 17872]
Mark Doliner <markdoliner@pidgin.im>
parents:
15147
diff
changeset
|
349 | rateclass->alert = byte_stream_get32(bs); |
|
48ce0abb422a
[gaim-migrate @ 17872]
Mark Doliner <markdoliner@pidgin.im>
parents:
15147
diff
changeset
|
350 | rateclass->limit = byte_stream_get32(bs); |
|
48ce0abb422a
[gaim-migrate @ 17872]
Mark Doliner <markdoliner@pidgin.im>
parents:
15147
diff
changeset
|
351 | rateclass->disconnect = byte_stream_get32(bs); |
|
48ce0abb422a
[gaim-migrate @ 17872]
Mark Doliner <markdoliner@pidgin.im>
parents:
15147
diff
changeset
|
352 | rateclass->current = byte_stream_get32(bs); |
|
48ce0abb422a
[gaim-migrate @ 17872]
Mark Doliner <markdoliner@pidgin.im>
parents:
15147
diff
changeset
|
353 | rateclass->max = byte_stream_get32(bs); |
|
29255
244dcac8ada2
We don't need to keep the delta in memory. We keep the actual time of
Mark Doliner <markdoliner@pidgin.im>
parents:
29254
diff
changeset
|
354 | if (mod->version >= 3) { |
|
244dcac8ada2
We don't need to keep the delta in memory. We keep the actual time of
Mark Doliner <markdoliner@pidgin.im>
parents:
29254
diff
changeset
|
355 | delta = byte_stream_get32(bs); |
|
28804
24b032f5d478
oscar: Update the rate calculations based on OSCAR docs.
Aman Gupta <aman@tmm1.net>
parents:
27112
diff
changeset
|
356 | rateclass->dropping_snacs = byte_stream_get8(bs); |
|
29255
244dcac8ada2
We don't need to keep the delta in memory. We keep the actual time of
Mark Doliner <markdoliner@pidgin.im>
parents:
29254
diff
changeset
|
357 | } else { |
|
244dcac8ada2
We don't need to keep the delta in memory. We keep the actual time of
Mark Doliner <markdoliner@pidgin.im>
parents:
29254
diff
changeset
|
358 | delta = 0; |
|
244dcac8ada2
We don't need to keep the delta in memory. We keep the actual time of
Mark Doliner <markdoliner@pidgin.im>
parents:
29254
diff
changeset
|
359 | rateclass->dropping_snacs = 0; |
|
28804
24b032f5d478
oscar: Update the rate calculations based on OSCAR docs.
Aman Gupta <aman@tmm1.net>
parents:
27112
diff
changeset
|
360 | } |
|
29256
333a12d3c0ee
Move two logging statements from oscar.c to family_oservice.c so we
Mark Doliner <markdoliner@pidgin.im>
parents:
29255
diff
changeset
|
361 | |
|
29255
244dcac8ada2
We don't need to keep the delta in memory. We keep the actual time of
Mark Doliner <markdoliner@pidgin.im>
parents:
29254
diff
changeset
|
362 | rateclass->last.tv_sec = now.tv_sec - delta / 1000; |
|
29257
887e473a2be1
Let's just do this mod on the fly instead of changing the variable
Mark Doliner <markdoliner@pidgin.im>
parents:
29256
diff
changeset
|
363 | rateclass->last.tv_usec = now.tv_usec - (delta % 1000) * 1000; |
| 13235 | 364 | |
|
15148
48ce0abb422a
[gaim-migrate @ 17872]
Mark Doliner <markdoliner@pidgin.im>
parents:
15147
diff
changeset
|
365 | conn->rateclasses = g_slist_prepend(conn->rateclasses, rateclass); |
|
29259
87336a2f470d
optimization to the oscar prpl to use less memory, care of Shaun Lindsay
Mark Doliner <markdoliner@pidgin.im>
parents:
29257
diff
changeset
|
366 | |
|
87336a2f470d
optimization to the oscar prpl to use less memory, care of Shaun Lindsay
Mark Doliner <markdoliner@pidgin.im>
parents:
29257
diff
changeset
|
367 | if (rateclass->classid == OSCAR_DEFAULT_RATECLASS) |
|
87336a2f470d
optimization to the oscar prpl to use less memory, care of Shaun Lindsay
Mark Doliner <markdoliner@pidgin.im>
parents:
29257
diff
changeset
|
368 | conn->default_rateclass = rateclass; |
| 13235 | 369 | } |
|
15148
48ce0abb422a
[gaim-migrate @ 17872]
Mark Doliner <markdoliner@pidgin.im>
parents:
15147
diff
changeset
|
370 | conn->rateclasses = g_slist_reverse(conn->rateclasses); |
| 13235 | 371 | |
| 372 | /* | |
| 373 | * Then the members of each class. | |
| 374 | */ | |
|
15148
48ce0abb422a
[gaim-migrate @ 17872]
Mark Doliner <markdoliner@pidgin.im>
parents:
15147
diff
changeset
|
375 | for (i = 0; i < numclasses; i++) |
|
48ce0abb422a
[gaim-migrate @ 17872]
Mark Doliner <markdoliner@pidgin.im>
parents:
15147
diff
changeset
|
376 | { |
| 13235 | 377 | guint16 classid, count; |
|
15148
48ce0abb422a
[gaim-migrate @ 17872]
Mark Doliner <markdoliner@pidgin.im>
parents:
15147
diff
changeset
|
378 | struct rateclass *rateclass; |
| 13235 | 379 | int j; |
| 380 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
381 | classid = byte_stream_get16(bs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
382 | count = byte_stream_get16(bs); |
| 13235 | 383 | |
|
29259
87336a2f470d
optimization to the oscar prpl to use less memory, care of Shaun Lindsay
Mark Doliner <markdoliner@pidgin.im>
parents:
29257
diff
changeset
|
384 | if (classid == OSCAR_DEFAULT_RATECLASS) { |
|
87336a2f470d
optimization to the oscar prpl to use less memory, care of Shaun Lindsay
Mark Doliner <markdoliner@pidgin.im>
parents:
29257
diff
changeset
|
385 | /* |
|
87336a2f470d
optimization to the oscar prpl to use less memory, care of Shaun Lindsay
Mark Doliner <markdoliner@pidgin.im>
parents:
29257
diff
changeset
|
386 | * Don't bother adding these SNACs to the hash table. See the |
|
87336a2f470d
optimization to the oscar prpl to use less memory, care of Shaun Lindsay
Mark Doliner <markdoliner@pidgin.im>
parents:
29257
diff
changeset
|
387 | * comment for OSCAR_DEFAULT_RATECLASS at the top of this file. |
|
87336a2f470d
optimization to the oscar prpl to use less memory, care of Shaun Lindsay
Mark Doliner <markdoliner@pidgin.im>
parents:
29257
diff
changeset
|
388 | */ |
|
87336a2f470d
optimization to the oscar prpl to use less memory, care of Shaun Lindsay
Mark Doliner <markdoliner@pidgin.im>
parents:
29257
diff
changeset
|
389 | byte_stream_advance(bs, 4 * count); |
|
87336a2f470d
optimization to the oscar prpl to use less memory, care of Shaun Lindsay
Mark Doliner <markdoliner@pidgin.im>
parents:
29257
diff
changeset
|
390 | continue; |
|
87336a2f470d
optimization to the oscar prpl to use less memory, care of Shaun Lindsay
Mark Doliner <markdoliner@pidgin.im>
parents:
29257
diff
changeset
|
391 | } |
|
87336a2f470d
optimization to the oscar prpl to use less memory, care of Shaun Lindsay
Mark Doliner <markdoliner@pidgin.im>
parents:
29257
diff
changeset
|
392 | |
|
15148
48ce0abb422a
[gaim-migrate @ 17872]
Mark Doliner <markdoliner@pidgin.im>
parents:
15147
diff
changeset
|
393 | rateclass = rateclass_find(conn->rateclasses, classid); |
| 13235 | 394 | |
|
15148
48ce0abb422a
[gaim-migrate @ 17872]
Mark Doliner <markdoliner@pidgin.im>
parents:
15147
diff
changeset
|
395 | for (j = 0; j < count; j++) |
|
48ce0abb422a
[gaim-migrate @ 17872]
Mark Doliner <markdoliner@pidgin.im>
parents:
15147
diff
changeset
|
396 | { |
| 13235 | 397 | guint16 group, subtype; |
| 398 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
399 | group = byte_stream_get16(bs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
400 | subtype = byte_stream_get16(bs); |
| 13235 | 401 | |
|
15148
48ce0abb422a
[gaim-migrate @ 17872]
Mark Doliner <markdoliner@pidgin.im>
parents:
15147
diff
changeset
|
402 | if (rateclass != NULL) |
|
29261
e39105368ed6
Put all our rateclass members in a single hash table instead of in one
Mark Doliner <markdoliner@pidgin.im>
parents:
29259
diff
changeset
|
403 | g_hash_table_insert(conn->rateclass_members, |
|
15168
4e604d302448
[gaim-migrate @ 17892]
Mark Doliner <markdoliner@pidgin.im>
parents:
15153
diff
changeset
|
404 | GUINT_TO_POINTER((group << 16) + subtype), |
|
29261
e39105368ed6
Put all our rateclass members in a single hash table instead of in one
Mark Doliner <markdoliner@pidgin.im>
parents:
29259
diff
changeset
|
405 | rateclass); |
| 13235 | 406 | } |
| 407 | } | |
| 408 | ||
| 409 | /* | |
| 410 | * We don't pass the rate information up to the client, as it really | |
| 411 | * doesn't care. The information is stored in the connection, however | |
|
15148
48ce0abb422a
[gaim-migrate @ 17872]
Mark Doliner <markdoliner@pidgin.im>
parents:
15147
diff
changeset
|
412 | * so that we can do rate limiting management when sending SNACs. |
| 13235 | 413 | */ |
| 414 | ||
| 415 | /* | |
|
28804
24b032f5d478
oscar: Update the rate calculations based on OSCAR docs.
Aman Gupta <aman@tmm1.net>
parents:
27112
diff
changeset
|
416 | * Subscribe to rate change information for all rate classes. |
| 13235 | 417 | */ |
|
15147
101192282f5d
[gaim-migrate @ 17871]
Mark Doliner <markdoliner@pidgin.im>
parents:
14708
diff
changeset
|
418 | aim_srv_rates_addparam(od, conn); |
| 13235 | 419 | |
| 420 | /* | |
| 421 | * Finally, tell the client it's ready to go... | |
| 422 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
423 | if ((userfunc = aim_callhandler(od, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE))) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
424 | userfunc(od, conn, frame); |
| 13235 | 425 | |
| 426 | return 1; | |
| 427 | } | |
| 428 | ||
| 429 | /* Subtype 0x0008 - Add Rate Parameter */ | |
|
13610
b2c15a312144
[gaim-migrate @ 15995]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
430 | void |
|
15147
101192282f5d
[gaim-migrate @ 17871]
Mark Doliner <markdoliner@pidgin.im>
parents:
14708
diff
changeset
|
431 | aim_srv_rates_addparam(OscarData *od, FlapConnection *conn) |
| 13235 | 432 | { |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
433 | ByteStream bs; |
| 13235 | 434 | aim_snacid_t snacid; |
|
15148
48ce0abb422a
[gaim-migrate @ 17872]
Mark Doliner <markdoliner@pidgin.im>
parents:
15147
diff
changeset
|
435 | GSList *tmp; |
| 13235 | 436 | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
437 | byte_stream_new(&bs, 502); |
| 13235 | 438 | |
|
15148
48ce0abb422a
[gaim-migrate @ 17872]
Mark Doliner <markdoliner@pidgin.im>
parents:
15147
diff
changeset
|
439 | for (tmp = conn->rateclasses; tmp != NULL; tmp = tmp->next) |
|
48ce0abb422a
[gaim-migrate @ 17872]
Mark Doliner <markdoliner@pidgin.im>
parents:
15147
diff
changeset
|
440 | { |
|
48ce0abb422a
[gaim-migrate @ 17872]
Mark Doliner <markdoliner@pidgin.im>
parents:
15147
diff
changeset
|
441 | struct rateclass *rateclass; |
|
48ce0abb422a
[gaim-migrate @ 17872]
Mark Doliner <markdoliner@pidgin.im>
parents:
15147
diff
changeset
|
442 | rateclass = tmp->data; |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
443 | byte_stream_put16(&bs, rateclass->classid); |
|
15148
48ce0abb422a
[gaim-migrate @ 17872]
Mark Doliner <markdoliner@pidgin.im>
parents:
15147
diff
changeset
|
444 | } |
| 13235 | 445 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
446 | snacid = aim_cachesnac(od, SNAC_FAMILY_OSERVICE, 0x0008, 0x0000, NULL, 0); |
|
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
447 | flap_connection_send_snac(od, conn, SNAC_FAMILY_OSERVICE, 0x0008, 0x0000, snacid, &bs); |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
448 | |
|
23004
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22860
diff
changeset
|
449 | byte_stream_destroy(&bs); |
| 13235 | 450 | } |
| 451 | ||
| 452 | /* Subtype 0x0009 - Delete Rate Parameter */ | |
|
13610
b2c15a312144
[gaim-migrate @ 15995]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
453 | void |
|
15147
101192282f5d
[gaim-migrate @ 17871]
Mark Doliner <markdoliner@pidgin.im>
parents:
14708
diff
changeset
|
454 | aim_srv_rates_delparam(OscarData *od, FlapConnection *conn) |
| 13235 | 455 | { |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
456 | ByteStream bs; |
| 13235 | 457 | aim_snacid_t snacid; |
|
15148
48ce0abb422a
[gaim-migrate @ 17872]
Mark Doliner <markdoliner@pidgin.im>
parents:
15147
diff
changeset
|
458 | GSList *tmp; |
| 13235 | 459 | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
460 | byte_stream_new(&bs, 502); |
| 13235 | 461 | |
|
15148
48ce0abb422a
[gaim-migrate @ 17872]
Mark Doliner <markdoliner@pidgin.im>
parents:
15147
diff
changeset
|
462 | for (tmp = conn->rateclasses; tmp != NULL; tmp = tmp->next) |
|
48ce0abb422a
[gaim-migrate @ 17872]
Mark Doliner <markdoliner@pidgin.im>
parents:
15147
diff
changeset
|
463 | { |
|
48ce0abb422a
[gaim-migrate @ 17872]
Mark Doliner <markdoliner@pidgin.im>
parents:
15147
diff
changeset
|
464 | struct rateclass *rateclass; |
|
48ce0abb422a
[gaim-migrate @ 17872]
Mark Doliner <markdoliner@pidgin.im>
parents:
15147
diff
changeset
|
465 | rateclass = tmp->data; |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
466 | byte_stream_put16(&bs, rateclass->classid); |
|
15148
48ce0abb422a
[gaim-migrate @ 17872]
Mark Doliner <markdoliner@pidgin.im>
parents:
15147
diff
changeset
|
467 | } |
| 13235 | 468 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
469 | snacid = aim_cachesnac(od, SNAC_FAMILY_OSERVICE, 0x0009, 0x0000, NULL, 0); |
|
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
470 | flap_connection_send_snac(od, conn, SNAC_FAMILY_OSERVICE, 0x0009, 0x0000, snacid, &bs); |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
471 | |
|
23004
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22860
diff
changeset
|
472 | byte_stream_destroy(&bs); |
| 13235 | 473 | } |
| 474 | ||
| 475 | /* Subtype 0x000a - Rate Change */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
476 | static int |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
477 | ratechange(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
| 13235 | 478 | { |
|
15149
d7c7d3e54f14
[gaim-migrate @ 17873]
Mark Doliner <markdoliner@pidgin.im>
parents:
15148
diff
changeset
|
479 | guint16 code, classid; |
|
d7c7d3e54f14
[gaim-migrate @ 17873]
Mark Doliner <markdoliner@pidgin.im>
parents:
15148
diff
changeset
|
480 | struct rateclass *rateclass; |
|
28804
24b032f5d478
oscar: Update the rate calculations based on OSCAR docs.
Aman Gupta <aman@tmm1.net>
parents:
27112
diff
changeset
|
481 | guint32 delta; |
|
24b032f5d478
oscar: Update the rate calculations based on OSCAR docs.
Aman Gupta <aman@tmm1.net>
parents:
27112
diff
changeset
|
482 | struct timeval now; |
|
29256
333a12d3c0ee
Move two logging statements from oscar.c to family_oservice.c so we
Mark Doliner <markdoliner@pidgin.im>
parents:
29255
diff
changeset
|
483 | static const char *codes[5] = { |
|
333a12d3c0ee
Move two logging statements from oscar.c to family_oservice.c so we
Mark Doliner <markdoliner@pidgin.im>
parents:
29255
diff
changeset
|
484 | "invalid", |
|
333a12d3c0ee
Move two logging statements from oscar.c to family_oservice.c so we
Mark Doliner <markdoliner@pidgin.im>
parents:
29255
diff
changeset
|
485 | "change", |
|
333a12d3c0ee
Move two logging statements from oscar.c to family_oservice.c so we
Mark Doliner <markdoliner@pidgin.im>
parents:
29255
diff
changeset
|
486 | "warning", |
|
333a12d3c0ee
Move two logging statements from oscar.c to family_oservice.c so we
Mark Doliner <markdoliner@pidgin.im>
parents:
29255
diff
changeset
|
487 | "limit", |
|
333a12d3c0ee
Move two logging statements from oscar.c to family_oservice.c so we
Mark Doliner <markdoliner@pidgin.im>
parents:
29255
diff
changeset
|
488 | "limit cleared", |
|
333a12d3c0ee
Move two logging statements from oscar.c to family_oservice.c so we
Mark Doliner <markdoliner@pidgin.im>
parents:
29255
diff
changeset
|
489 | }; |
| 13235 | 490 | |
|
28804
24b032f5d478
oscar: Update the rate calculations based on OSCAR docs.
Aman Gupta <aman@tmm1.net>
parents:
27112
diff
changeset
|
491 | gettimeofday(&now, NULL); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
492 | code = byte_stream_get16(bs); |
|
15149
d7c7d3e54f14
[gaim-migrate @ 17873]
Mark Doliner <markdoliner@pidgin.im>
parents:
15148
diff
changeset
|
493 | classid = byte_stream_get16(bs); |
|
d7c7d3e54f14
[gaim-migrate @ 17873]
Mark Doliner <markdoliner@pidgin.im>
parents:
15148
diff
changeset
|
494 | |
|
d7c7d3e54f14
[gaim-migrate @ 17873]
Mark Doliner <markdoliner@pidgin.im>
parents:
15148
diff
changeset
|
495 | rateclass = rateclass_find(conn->rateclasses, classid); |
|
d7c7d3e54f14
[gaim-migrate @ 17873]
Mark Doliner <markdoliner@pidgin.im>
parents:
15148
diff
changeset
|
496 | if (rateclass == NULL) |
|
d7c7d3e54f14
[gaim-migrate @ 17873]
Mark Doliner <markdoliner@pidgin.im>
parents:
15148
diff
changeset
|
497 | /* This should never really happen */ |
|
d7c7d3e54f14
[gaim-migrate @ 17873]
Mark Doliner <markdoliner@pidgin.im>
parents:
15148
diff
changeset
|
498 | return 0; |
| 13235 | 499 | |
|
15149
d7c7d3e54f14
[gaim-migrate @ 17873]
Mark Doliner <markdoliner@pidgin.im>
parents:
15148
diff
changeset
|
500 | rateclass->windowsize = byte_stream_get32(bs); |
|
d7c7d3e54f14
[gaim-migrate @ 17873]
Mark Doliner <markdoliner@pidgin.im>
parents:
15148
diff
changeset
|
501 | rateclass->clear = byte_stream_get32(bs); |
|
d7c7d3e54f14
[gaim-migrate @ 17873]
Mark Doliner <markdoliner@pidgin.im>
parents:
15148
diff
changeset
|
502 | rateclass->alert = byte_stream_get32(bs); |
|
d7c7d3e54f14
[gaim-migrate @ 17873]
Mark Doliner <markdoliner@pidgin.im>
parents:
15148
diff
changeset
|
503 | rateclass->limit = byte_stream_get32(bs); |
|
d7c7d3e54f14
[gaim-migrate @ 17873]
Mark Doliner <markdoliner@pidgin.im>
parents:
15148
diff
changeset
|
504 | rateclass->disconnect = byte_stream_get32(bs); |
|
d7c7d3e54f14
[gaim-migrate @ 17873]
Mark Doliner <markdoliner@pidgin.im>
parents:
15148
diff
changeset
|
505 | rateclass->current = byte_stream_get32(bs); |
|
d7c7d3e54f14
[gaim-migrate @ 17873]
Mark Doliner <markdoliner@pidgin.im>
parents:
15148
diff
changeset
|
506 | rateclass->max = byte_stream_get32(bs); |
|
29255
244dcac8ada2
We don't need to keep the delta in memory. We keep the actual time of
Mark Doliner <markdoliner@pidgin.im>
parents:
29254
diff
changeset
|
507 | if (mod->version >= 3) { |
|
244dcac8ada2
We don't need to keep the delta in memory. We keep the actual time of
Mark Doliner <markdoliner@pidgin.im>
parents:
29254
diff
changeset
|
508 | delta = byte_stream_get32(bs); |
|
28804
24b032f5d478
oscar: Update the rate calculations based on OSCAR docs.
Aman Gupta <aman@tmm1.net>
parents:
27112
diff
changeset
|
509 | rateclass->dropping_snacs = byte_stream_get8(bs); |
|
29255
244dcac8ada2
We don't need to keep the delta in memory. We keep the actual time of
Mark Doliner <markdoliner@pidgin.im>
parents:
29254
diff
changeset
|
510 | } else { |
|
244dcac8ada2
We don't need to keep the delta in memory. We keep the actual time of
Mark Doliner <markdoliner@pidgin.im>
parents:
29254
diff
changeset
|
511 | delta = 0; |
|
244dcac8ada2
We don't need to keep the delta in memory. We keep the actual time of
Mark Doliner <markdoliner@pidgin.im>
parents:
29254
diff
changeset
|
512 | rateclass->dropping_snacs = 0; |
|
28804
24b032f5d478
oscar: Update the rate calculations based on OSCAR docs.
Aman Gupta <aman@tmm1.net>
parents:
27112
diff
changeset
|
513 | } |
|
29256
333a12d3c0ee
Move two logging statements from oscar.c to family_oservice.c so we
Mark Doliner <markdoliner@pidgin.im>
parents:
29255
diff
changeset
|
514 | |
|
29255
244dcac8ada2
We don't need to keep the delta in memory. We keep the actual time of
Mark Doliner <markdoliner@pidgin.im>
parents:
29254
diff
changeset
|
515 | rateclass->last.tv_sec = now.tv_sec - delta / 1000; |
|
29257
887e473a2be1
Let's just do this mod on the fly instead of changing the variable
Mark Doliner <markdoliner@pidgin.im>
parents:
29256
diff
changeset
|
516 | rateclass->last.tv_usec = now.tv_usec - (delta % 1000) * 1000; |
|
28804
24b032f5d478
oscar: Update the rate calculations based on OSCAR docs.
Aman Gupta <aman@tmm1.net>
parents:
27112
diff
changeset
|
517 | |
|
29256
333a12d3c0ee
Move two logging statements from oscar.c to family_oservice.c so we
Mark Doliner <markdoliner@pidgin.im>
parents:
29255
diff
changeset
|
518 | purple_debug_misc("oscar", "rate %s (param ID 0x%04hx): curavg = %u, " |
|
333a12d3c0ee
Move two logging statements from oscar.c to family_oservice.c so we
Mark Doliner <markdoliner@pidgin.im>
parents:
29255
diff
changeset
|
519 | "maxavg = %u, alert at %u, clear warning at %u, limit at %u, " |
|
333a12d3c0ee
Move two logging statements from oscar.c to family_oservice.c so we
Mark Doliner <markdoliner@pidgin.im>
parents:
29255
diff
changeset
|
520 | "disconnect at %u, delta is %u, dropping is %u (window size = %u)\n", |
|
333a12d3c0ee
Move two logging statements from oscar.c to family_oservice.c so we
Mark Doliner <markdoliner@pidgin.im>
parents:
29255
diff
changeset
|
521 | (code < 5) ? codes[code] : codes[0], rateclass->classid, |
|
333a12d3c0ee
Move two logging statements from oscar.c to family_oservice.c so we
Mark Doliner <markdoliner@pidgin.im>
parents:
29255
diff
changeset
|
522 | rateclass->current, rateclass->max, rateclass->alert, |
|
333a12d3c0ee
Move two logging statements from oscar.c to family_oservice.c so we
Mark Doliner <markdoliner@pidgin.im>
parents:
29255
diff
changeset
|
523 | rateclass->clear, rateclass->limit, rateclass->disconnect, |
|
333a12d3c0ee
Move two logging statements from oscar.c to family_oservice.c so we
Mark Doliner <markdoliner@pidgin.im>
parents:
29255
diff
changeset
|
524 | delta, rateclass->dropping_snacs, rateclass->windowsize); |
|
333a12d3c0ee
Move two logging statements from oscar.c to family_oservice.c so we
Mark Doliner <markdoliner@pidgin.im>
parents:
29255
diff
changeset
|
525 | |
|
333a12d3c0ee
Move two logging statements from oscar.c to family_oservice.c so we
Mark Doliner <markdoliner@pidgin.im>
parents:
29255
diff
changeset
|
526 | if (code == AIM_RATE_CODE_LIMIT) { |
|
29312
2d56a0fadf5a
Good call, this doesn't need to be translated. This messaged used to be
Mark Doliner <markdoliner@pidgin.im>
parents:
29261
diff
changeset
|
527 | purple_debug_warning("oscar", "The last action you attempted " |
|
29256
333a12d3c0ee
Move two logging statements from oscar.c to family_oservice.c so we
Mark Doliner <markdoliner@pidgin.im>
parents:
29255
diff
changeset
|
528 | "could not be performed because you are over the rate " |
|
29312
2d56a0fadf5a
Good call, this doesn't need to be translated. This messaged used to be
Mark Doliner <markdoliner@pidgin.im>
parents:
29261
diff
changeset
|
529 | "limit. Please wait 10 seconds and try again.\n"); |
|
28804
24b032f5d478
oscar: Update the rate calculations based on OSCAR docs.
Aman Gupta <aman@tmm1.net>
parents:
27112
diff
changeset
|
530 | } |
| 13235 | 531 | |
|
29256
333a12d3c0ee
Move two logging statements from oscar.c to family_oservice.c so we
Mark Doliner <markdoliner@pidgin.im>
parents:
29255
diff
changeset
|
532 | return 1; |
| 13235 | 533 | } |
| 534 | ||
| 535 | /* | |
| 536 | * How Migrations work. | |
| 537 | * | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
538 | * The server sends a Server Pause message, which the client should respond to |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
539 | * with a Server Pause Ack, which contains the families it needs on this |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
540 | * connection. The server will send a Migration Notice with an IP address, and |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
541 | * then disconnect. Next the client should open the connection and send the |
| 13235 | 542 | * cookie. Repeat the normal login process and pretend this never happened. |
| 543 | * | |
| 544 | * The Server Pause contains no data. | |
| 545 | * | |
| 546 | */ | |
| 547 | ||
| 548 | /* Subtype 0x000b - Service Pause */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
549 | static int |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
550 | serverpause(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
| 13235 | 551 | { |
| 552 | int ret = 0; | |
| 553 | aim_rxcallback_t userfunc; | |
| 554 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
555 | if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
556 | ret = userfunc(od, conn, frame); |
| 13235 | 557 | |
| 558 | return ret; | |
| 559 | } | |
| 560 | ||
| 561 | /* | |
| 562 | * Subtype 0x000c - Service Pause Acknowledgement | |
| 563 | * | |
|
15147
101192282f5d
[gaim-migrate @ 17871]
Mark Doliner <markdoliner@pidgin.im>
parents:
14708
diff
changeset
|
564 | * It is rather important that aim_srv_sendpauseack() gets called for the exact |
| 13235 | 565 | * same connection that the Server Pause callback was called for, since |
| 566 | * libfaim extracts the data for the SNAC from the connection structure. | |
| 567 | * | |
| 568 | * Of course, if you don't do that, more bad things happen than just what | |
| 569 | * libfaim can cause. | |
| 570 | * | |
| 571 | */ | |
|
13610
b2c15a312144
[gaim-migrate @ 15995]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
572 | void |
|
15147
101192282f5d
[gaim-migrate @ 17871]
Mark Doliner <markdoliner@pidgin.im>
parents:
14708
diff
changeset
|
573 | aim_srv_sendpauseack(OscarData *od, FlapConnection *conn) |
| 13235 | 574 | { |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
575 | ByteStream bs; |
| 13235 | 576 | aim_snacid_t snacid; |
|
14410
a5ae93474db6
[gaim-migrate @ 17050]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
577 | GSList *cur; |
| 13235 | 578 | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
579 | byte_stream_new(&bs, 1014); |
| 13235 | 580 | |
| 581 | /* | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
582 | * This list should have all the groups that the original |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
583 | * Host Online / Server Ready said this host supports. And |
| 13235 | 584 | * we want them all back after the migration. |
| 585 | */ | |
|
13612
c51da9e6fec1
[gaim-migrate @ 15997]
Mark Doliner <markdoliner@pidgin.im>
parents:
13610
diff
changeset
|
586 | for (cur = conn->groups; cur != NULL; cur = cur->next) |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
587 | byte_stream_put16(&bs, GPOINTER_TO_UINT(cur->data)); |
| 13235 | 588 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
589 | snacid = aim_cachesnac(od, SNAC_FAMILY_OSERVICE, 0x000c, 0x0000, NULL, 0); |
|
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
590 | flap_connection_send_snac(od, conn, SNAC_FAMILY_OSERVICE, 0x000c, 0x0000, snacid, &bs); |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
591 | |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
592 | byte_stream_destroy(&bs); |
| 13235 | 593 | } |
| 594 | ||
| 595 | /* Subtype 0x000d - Service Resume */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
596 | static int |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
597 | serverresume(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
| 13235 | 598 | { |
| 599 | int ret = 0; | |
| 600 | aim_rxcallback_t userfunc; | |
| 601 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
602 | if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
603 | ret = userfunc(od, conn, frame); |
| 13235 | 604 | |
| 605 | return ret; | |
| 606 | } | |
| 607 | ||
| 608 | /* Subtype 0x000e - Request self-info */ | |
|
13610
b2c15a312144
[gaim-migrate @ 15995]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
609 | void |
|
15147
101192282f5d
[gaim-migrate @ 17871]
Mark Doliner <markdoliner@pidgin.im>
parents:
14708
diff
changeset
|
610 | aim_srv_reqpersonalinfo(OscarData *od, FlapConnection *conn) |
| 13235 | 611 | { |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
612 | aim_genericreq_n_snacid(od, conn, SNAC_FAMILY_OSERVICE, 0x000e); |
| 13235 | 613 | } |
| 614 | ||
| 615 | /* Subtype 0x000f - Self User Info */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
616 | static int |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
617 | selfinfo(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
| 13235 | 618 | { |
| 619 | int ret = 0; | |
| 620 | aim_rxcallback_t userfunc; | |
| 621 | aim_userinfo_t userinfo; | |
| 622 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
623 | aim_info_extract(od, bs, &userinfo); |
| 13235 | 624 | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
625 | if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
626 | ret = userfunc(od, conn, frame, &userinfo); |
| 13235 | 627 | |
| 628 | aim_info_free(&userinfo); | |
| 629 | ||
| 630 | return ret; | |
| 631 | } | |
| 632 | ||
| 633 | /* Subtype 0x0010 - Evil Notification */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
634 | static int |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
635 | evilnotify(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
| 13235 | 636 | { |
| 637 | int ret = 0; | |
| 638 | aim_rxcallback_t userfunc; | |
| 639 | guint16 newevil; | |
| 640 | aim_userinfo_t userinfo; | |
| 641 | ||
| 642 | memset(&userinfo, 0, sizeof(aim_userinfo_t)); | |
| 643 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
644 | newevil = byte_stream_get16(bs); |
| 13235 | 645 | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
646 | if (byte_stream_empty(bs)) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
647 | aim_info_extract(od, bs, &userinfo); |
| 13235 | 648 | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
649 | if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
650 | ret = userfunc(od, conn, frame, newevil, &userinfo); |
| 13235 | 651 | |
| 652 | aim_info_free(&userinfo); | |
| 653 | ||
| 654 | return ret; | |
| 655 | } | |
| 656 | ||
| 657 | /* | |
| 658 | * Subtype 0x0011 - Idle Notification | |
| 659 | * | |
| 660 | * Should set your current idle time in seconds. Note that this should | |
| 661 | * never be called consecutively with a non-zero idle time. That makes | |
| 662 | * OSCAR do funny things. Instead, just set it once you go idle, and then | |
| 663 | * call it again with zero when you're back. | |
| 664 | * | |
| 665 | */ | |
|
15147
101192282f5d
[gaim-migrate @ 17871]
Mark Doliner <markdoliner@pidgin.im>
parents:
14708
diff
changeset
|
666 | void |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
667 | aim_srv_setidle(OscarData *od, guint32 idletime) |
| 13235 | 668 | { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
669 | FlapConnection *conn; |
| 13235 | 670 | |
|
15147
101192282f5d
[gaim-migrate @ 17871]
Mark Doliner <markdoliner@pidgin.im>
parents:
14708
diff
changeset
|
671 | conn = flap_connection_findbygroup(od, SNAC_FAMILY_BOS); |
|
15341
486e3de35514
[gaim-migrate @ 18069]
Evan Schoenberg <evands@pidgin.im>
parents:
15168
diff
changeset
|
672 | if(!conn) |
|
486e3de35514
[gaim-migrate @ 18069]
Evan Schoenberg <evands@pidgin.im>
parents:
15168
diff
changeset
|
673 | return; |
|
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
|
674 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
675 | aim_genericreq_l(od, conn, SNAC_FAMILY_OSERVICE, 0x0011, &idletime); |
| 13235 | 676 | } |
| 677 | ||
| 678 | /* | |
| 679 | * Subtype 0x0012 - Service Migrate | |
| 680 | * | |
| 681 | * This is the final SNAC sent on the original connection during a migration. | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
682 | * It contains the IP and cookie used to connect to the new server, and |
| 13235 | 683 | * optionally a list of the SNAC groups being migrated. |
| 684 | * | |
| 685 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
686 | static int |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
687 | migrate(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
| 13235 | 688 | { |
| 689 | aim_rxcallback_t userfunc; | |
| 690 | int ret = 0; | |
| 691 | guint16 groupcount, i; | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
692 | GSList *tlvlist; |
| 13235 | 693 | char *ip = NULL; |
| 694 | aim_tlv_t *cktlv; | |
| 695 | ||
| 696 | /* | |
| 697 | * Apparently there's some fun stuff that can happen right here. The | |
| 698 | * migration can actually be quite selective about what groups it | |
| 699 | * moves to the new server. When not all the groups for a connection | |
| 700 | * are migrated, or they are all migrated but some groups are moved | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
701 | * to a different server than others, it is called a bifurcated |
| 13235 | 702 | * migration. |
| 703 | * | |
| 704 | * Let's play dumb and not support that. | |
| 705 | * | |
| 706 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
707 | groupcount = byte_stream_get16(bs); |
| 13235 | 708 | for (i = 0; i < groupcount; i++) { |
| 709 | guint16 group; | |
| 710 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
711 | group = byte_stream_get16(bs); |
| 13235 | 712 | |
| 15884 | 713 | purple_debug_misc("oscar", "bifurcated migration unsupported -- group 0x%04x\n", group); |
| 13235 | 714 | } |
| 715 | ||
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
716 | tlvlist = aim_tlvlist_read(bs); |
| 13235 | 717 | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
718 | if (aim_tlv_gettlv(tlvlist, 0x0005, 1)) |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
719 | ip = aim_tlv_getstr(tlvlist, 0x0005, 1); |
| 13235 | 720 | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
721 | cktlv = aim_tlv_gettlv(tlvlist, 0x0006, 1); |
| 13235 | 722 | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
723 | if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
724 | ret = userfunc(od, conn, frame, ip, cktlv ? cktlv->value : NULL); |
| 13235 | 725 | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
726 | aim_tlvlist_free(tlvlist); |
|
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
|
727 | g_free(ip); |
| 13235 | 728 | |
| 729 | return ret; | |
| 730 | } | |
| 731 | ||
| 732 | /* Subtype 0x0013 - Message of the Day */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
733 | static int |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
734 | motd(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
| 13235 | 735 | { |
| 736 | aim_rxcallback_t userfunc; | |
| 737 | char *msg = NULL; | |
| 738 | int ret = 0; | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
739 | GSList *tlvlist; |
| 13235 | 740 | guint16 id; |
| 741 | ||
| 742 | /* | |
| 743 | * Code. | |
| 744 | * | |
| 745 | * Valid values: | |
| 746 | * 1 Mandatory upgrade | |
| 747 | * 2 Advisory upgrade | |
| 748 | * 3 System bulletin | |
| 749 | * 4 Nothing's wrong ("top o the world" -- normal) | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
750 | * 5 Lets-break-something. |
| 13235 | 751 | * |
| 752 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
753 | id = byte_stream_get16(bs); |
| 13235 | 754 | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
755 | /* |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
756 | * TLVs follow |
| 13235 | 757 | */ |
| 758 | tlvlist = aim_tlvlist_read(bs); | |
| 759 | ||
| 760 | msg = aim_tlv_getstr(tlvlist, 0x000b, 1); | |
| 761 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
762 | if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
763 | ret = userfunc(od, conn, frame, id, msg); |
| 13235 | 764 | |
|
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
|
765 | g_free(msg); |
| 13235 | 766 | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
767 | aim_tlvlist_free(tlvlist); |
| 13235 | 768 | |
| 769 | return ret; | |
| 770 | } | |
| 771 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
772 | /* |
| 13235 | 773 | * Subtype 0x0014 - Set privacy flags |
| 774 | * | |
| 775 | * Normally 0x03. | |
| 776 | * | |
| 777 | * Bit 1: Allows other AIM users to see how long you've been idle. | |
| 778 | * Bit 2: Allows other AIM users to see how long you've been a member. | |
| 779 | * | |
| 780 | */ | |
|
15147
101192282f5d
[gaim-migrate @ 17871]
Mark Doliner <markdoliner@pidgin.im>
parents:
14708
diff
changeset
|
781 | void |
|
101192282f5d
[gaim-migrate @ 17871]
Mark Doliner <markdoliner@pidgin.im>
parents:
14708
diff
changeset
|
782 | aim_srv_setprivacyflags(OscarData *od, FlapConnection *conn, guint32 flags) |
| 13235 | 783 | { |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
784 | aim_genericreq_l(od, conn, SNAC_FAMILY_OSERVICE, 0x0014, &flags); |
| 13235 | 785 | } |
| 786 | ||
| 787 | /* | |
| 788 | * Subtype 0x0016 - No-op | |
| 789 | * | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
790 | * WinAIM sends these every 4min or so to keep the connection alive. Its not |
| 13235 | 791 | * really necessary. |
| 792 | * | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
793 | * Wha? No? Since when? I think WinAIM sends an empty channel 5 |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
794 | * FLAP as a no-op... |
| 13235 | 795 | */ |
|
15147
101192282f5d
[gaim-migrate @ 17871]
Mark Doliner <markdoliner@pidgin.im>
parents:
14708
diff
changeset
|
796 | void |
|
101192282f5d
[gaim-migrate @ 17871]
Mark Doliner <markdoliner@pidgin.im>
parents:
14708
diff
changeset
|
797 | aim_srv_nop(OscarData *od, FlapConnection *conn) |
| 13235 | 798 | { |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
799 | aim_genericreq_n(od, conn, SNAC_FAMILY_OSERVICE, 0x0016); |
| 13235 | 800 | } |
| 801 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
802 | /* |
| 13235 | 803 | * Subtype 0x0017 - Set client versions |
| 804 | * | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
805 | * If you've seen the clientonline/clientready SNAC you're probably |
| 13235 | 806 | * wondering what the point of this one is. And that point seems to be |
| 807 | * that the versions in the client online SNAC are sent too late for the | |
| 808 | * server to be able to use them to change the protocol for the earlier | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
809 | * login packets (client versions are sent right after Host Online is |
| 13235 | 810 | * received, but client online versions aren't sent until quite a bit later). |
| 811 | * We can see them already making use of this by changing the format of | |
| 812 | * the rate information based on what version of group 1 we advertise here. | |
| 813 | * | |
| 814 | */ | |
|
13610
b2c15a312144
[gaim-migrate @ 15995]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
815 | void |
|
15147
101192282f5d
[gaim-migrate @ 17871]
Mark Doliner <markdoliner@pidgin.im>
parents:
14708
diff
changeset
|
816 | aim_srv_setversions(OscarData *od, FlapConnection *conn) |
| 13235 | 817 | { |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
818 | ByteStream bs; |
| 13235 | 819 | aim_snacid_t snacid; |
|
14410
a5ae93474db6
[gaim-migrate @ 17050]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
820 | GSList *cur; |
| 13235 | 821 | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
822 | byte_stream_new(&bs, 1142); |
| 13235 | 823 | |
| 824 | /* | |
| 825 | * Send only the versions that the server cares about (that it | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
826 | * marked as supporting in the server ready SNAC). |
| 13235 | 827 | */ |
|
13612
c51da9e6fec1
[gaim-migrate @ 15997]
Mark Doliner <markdoliner@pidgin.im>
parents:
13610
diff
changeset
|
828 | for (cur = conn->groups; cur != NULL; cur = cur->next) |
|
c51da9e6fec1
[gaim-migrate @ 15997]
Mark Doliner <markdoliner@pidgin.im>
parents:
13610
diff
changeset
|
829 | { |
| 13235 | 830 | aim_module_t *mod; |
| 831 | ||
|
13612
c51da9e6fec1
[gaim-migrate @ 15997]
Mark Doliner <markdoliner@pidgin.im>
parents:
13610
diff
changeset
|
832 | if ((mod = aim__findmodulebygroup(od, GPOINTER_TO_UINT(cur->data)))) |
|
c51da9e6fec1
[gaim-migrate @ 15997]
Mark Doliner <markdoliner@pidgin.im>
parents:
13610
diff
changeset
|
833 | { |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
834 | byte_stream_put16(&bs, mod->family); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
835 | byte_stream_put16(&bs, mod->version); |
|
13612
c51da9e6fec1
[gaim-migrate @ 15997]
Mark Doliner <markdoliner@pidgin.im>
parents:
13610
diff
changeset
|
836 | } |
| 13235 | 837 | } |
| 838 | ||
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
839 | snacid = aim_cachesnac(od, SNAC_FAMILY_OSERVICE, 0x0017, 0x0000, NULL, 0); |
|
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
840 | flap_connection_send_snac(od, conn, SNAC_FAMILY_OSERVICE, 0x0017, 0x0000, snacid, &bs); |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
841 | |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
842 | byte_stream_destroy(&bs); |
| 13235 | 843 | } |
| 844 | ||
| 845 | /* Subtype 0x0018 - Host versions */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
846 | static int |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
847 | hostversions(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
| 13235 | 848 | { |
| 849 | int vercount; | |
| 850 | guint8 *versions; | |
| 851 | ||
| 852 | /* This is frivolous. (Thank you SmarterChild.) */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
853 | vercount = byte_stream_empty(bs)/4; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
854 | versions = byte_stream_getraw(bs, byte_stream_empty(bs)); |
|
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
|
855 | g_free(versions); |
| 13235 | 856 | |
| 857 | /* | |
| 858 | * Now request rates. | |
| 859 | */ | |
|
15147
101192282f5d
[gaim-migrate @ 17871]
Mark Doliner <markdoliner@pidgin.im>
parents:
14708
diff
changeset
|
860 | aim_srv_reqrates(od, conn); |
| 13235 | 861 | |
| 862 | return 1; | |
| 863 | } | |
| 864 | ||
|
15686
b6d016a42e34
Combine two functions that did similar things. This is a little
Mark Doliner <markdoliner@pidgin.im>
parents:
15435
diff
changeset
|
865 | /** |
|
b6d016a42e34
Combine two functions that did similar things. This is a little
Mark Doliner <markdoliner@pidgin.im>
parents:
15435
diff
changeset
|
866 | * Subtype 0x001e - Extended Status/Extra Info. |
| 13235 | 867 | * |
| 868 | * These settings are transient, not server-stored (i.e. they only | |
| 869 | * apply to this session, and must be re-set the next time you sign | |
| 870 | * on). | |
| 871 | * | |
| 872 | * You can set your ICQ status (available, away, do not disturb, | |
| 873 | * etc.), or whether your IP address should be hidden or not, or | |
| 874 | * if your status is visible on ICQ web sites, and you can set | |
| 875 | * your IP address info and what not. | |
| 876 | * | |
|
15686
b6d016a42e34
Combine two functions that did similar things. This is a little
Mark Doliner <markdoliner@pidgin.im>
parents:
15435
diff
changeset
|
877 | * You can also set your "available" message. This is currently |
| 15884 | 878 | * only supported by iChat, Purple and other 3rd party clients. |
|
15686
b6d016a42e34
Combine two functions that did similar things. This is a little
Mark Doliner <markdoliner@pidgin.im>
parents:
15435
diff
changeset
|
879 | * |
| 13235 | 880 | * These are the same TLVs seen in user info. You can |
| 881 | * also set 0x0008 and 0x000c. | |
| 882 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
883 | int |
|
15686
b6d016a42e34
Combine two functions that did similar things. This is a little
Mark Doliner <markdoliner@pidgin.im>
parents:
15435
diff
changeset
|
884 | aim_srv_setextrainfo(OscarData *od, |
|
b6d016a42e34
Combine two functions that did similar things. This is a little
Mark Doliner <markdoliner@pidgin.im>
parents:
15435
diff
changeset
|
885 | gboolean seticqstatus, guint32 icqstatus, |
|
26070
32029cc3ca2a
Rename "availmsg" to "statusmsg" here. I think recent official AIM
Mark Doliner <markdoliner@pidgin.im>
parents:
26069
diff
changeset
|
886 | gboolean setstatusmsg, const char *statusmsg, const char *itmsurl) |
| 13235 | 887 | { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
888 | 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:
22622
diff
changeset
|
889 | ByteStream bs; |
| 13235 | 890 | 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
|
891 | GSList *tlvlist = NULL; |
| 13235 | 892 | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
893 | if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM))) |
| 13235 | 894 | return -EINVAL; |
| 895 | ||
|
15686
b6d016a42e34
Combine two functions that did similar things. This is a little
Mark Doliner <markdoliner@pidgin.im>
parents:
15435
diff
changeset
|
896 | if (seticqstatus) |
|
b6d016a42e34
Combine two functions that did similar things. This is a little
Mark Doliner <markdoliner@pidgin.im>
parents:
15435
diff
changeset
|
897 | { |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
898 | aim_tlvlist_add_32(&tlvlist, 0x0006, icqstatus | |
|
15686
b6d016a42e34
Combine two functions that did similar things. This is a little
Mark Doliner <markdoliner@pidgin.im>
parents:
15435
diff
changeset
|
899 | AIM_ICQ_STATE_HIDEIP | AIM_ICQ_STATE_DIRECTREQUIREAUTH); |
|
b6d016a42e34
Combine two functions that did similar things. This is a little
Mark Doliner <markdoliner@pidgin.im>
parents:
15435
diff
changeset
|
900 | } |
|
b6d016a42e34
Combine two functions that did similar things. This is a little
Mark Doliner <markdoliner@pidgin.im>
parents:
15435
diff
changeset
|
901 | |
|
b6d016a42e34
Combine two functions that did similar things. This is a little
Mark Doliner <markdoliner@pidgin.im>
parents:
15435
diff
changeset
|
902 | #if 0 |
|
b6d016a42e34
Combine two functions that did similar things. This is a little
Mark Doliner <markdoliner@pidgin.im>
parents:
15435
diff
changeset
|
903 | if (other_stuff_that_isnt_implemented) |
|
b6d016a42e34
Combine two functions that did similar things. This is a little
Mark Doliner <markdoliner@pidgin.im>
parents:
15435
diff
changeset
|
904 | { |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
905 | aim_tlvlist_add_raw(&tlvlist, 0x000c, 0x0025, |
|
15686
b6d016a42e34
Combine two functions that did similar things. This is a little
Mark Doliner <markdoliner@pidgin.im>
parents:
15435
diff
changeset
|
906 | chunk_of_x25_bytes_with_ip_address_etc); |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
907 | aim_tlvlist_add_raw(&tlvlist, 0x0011, 0x0005, unknown 0x01 61 10 f6 41); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
908 | aim_tlvlist_add_16(&tlvlist, 0x0012, unknown 0x00 00); |
|
15686
b6d016a42e34
Combine two functions that did similar things. This is a little
Mark Doliner <markdoliner@pidgin.im>
parents:
15435
diff
changeset
|
909 | } |
|
b6d016a42e34
Combine two functions that did similar things. This is a little
Mark Doliner <markdoliner@pidgin.im>
parents:
15435
diff
changeset
|
910 | #endif |
| 13235 | 911 | |
|
26070
32029cc3ca2a
Rename "availmsg" to "statusmsg" here. I think recent official AIM
Mark Doliner <markdoliner@pidgin.im>
parents:
26069
diff
changeset
|
912 | if (setstatusmsg) |
|
15686
b6d016a42e34
Combine two functions that did similar things. This is a little
Mark Doliner <markdoliner@pidgin.im>
parents:
15435
diff
changeset
|
913 | { |
|
26070
32029cc3ca2a
Rename "availmsg" to "statusmsg" here. I think recent official AIM
Mark Doliner <markdoliner@pidgin.im>
parents:
26069
diff
changeset
|
914 | size_t statusmsglen, itmsurllen; |
|
15686
b6d016a42e34
Combine two functions that did similar things. This is a little
Mark Doliner <markdoliner@pidgin.im>
parents:
15435
diff
changeset
|
915 | ByteStream tmpbs; |
|
b6d016a42e34
Combine two functions that did similar things. This is a little
Mark Doliner <markdoliner@pidgin.im>
parents:
15435
diff
changeset
|
916 | |
|
26070
32029cc3ca2a
Rename "availmsg" to "statusmsg" here. I think recent official AIM
Mark Doliner <markdoliner@pidgin.im>
parents:
26069
diff
changeset
|
917 | statusmsglen = (statusmsg != NULL) ? strlen(statusmsg) : 0; |
|
15689
bcf3c0ddb974
Allow setting of the iTunes Music Store URL for AIM accounts. It's
Mark Doliner <markdoliner@pidgin.im>
parents:
15686
diff
changeset
|
918 | itmsurllen = (itmsurl != NULL) ? strlen(itmsurl) : 0; |
|
15686
b6d016a42e34
Combine two functions that did similar things. This is a little
Mark Doliner <markdoliner@pidgin.im>
parents:
15435
diff
changeset
|
919 | |
|
26070
32029cc3ca2a
Rename "availmsg" to "statusmsg" here. I think recent official AIM
Mark Doliner <markdoliner@pidgin.im>
parents:
26069
diff
changeset
|
920 | byte_stream_new(&tmpbs, statusmsglen + 8 + itmsurllen + 8); |
|
32029cc3ca2a
Rename "availmsg" to "statusmsg" here. I think recent official AIM
Mark Doliner <markdoliner@pidgin.im>
parents:
26069
diff
changeset
|
921 | byte_stream_put_bart_asset_str(&tmpbs, 0x0002, statusmsg); |
|
26069
0fa1f9b71cea
Create two helper functions for setting the available message and iTunes
Mark Doliner <markdoliner@pidgin.im>
parents:
25519
diff
changeset
|
922 | byte_stream_put_bart_asset_str(&tmpbs, 0x0009, itmsurl); |
|
15689
bcf3c0ddb974
Allow setting of the iTunes Music Store URL for AIM accounts. It's
Mark Doliner <markdoliner@pidgin.im>
parents:
15686
diff
changeset
|
923 | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
924 | aim_tlvlist_add_raw(&tlvlist, 0x001d, |
|
15686
b6d016a42e34
Combine two functions that did similar things. This is a little
Mark Doliner <markdoliner@pidgin.im>
parents:
15435
diff
changeset
|
925 | byte_stream_curpos(&tmpbs), tmpbs.data); |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
926 | byte_stream_destroy(&tmpbs); |
|
15686
b6d016a42e34
Combine two functions that did similar things. This is a little
Mark Doliner <markdoliner@pidgin.im>
parents:
15435
diff
changeset
|
927 | } |
|
b6d016a42e34
Combine two functions that did similar things. This is a little
Mark Doliner <markdoliner@pidgin.im>
parents:
15435
diff
changeset
|
928 | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
929 | byte_stream_new(&bs, aim_tlvlist_size(tlvlist)); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
930 | |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
931 | aim_tlvlist_write(&bs, &tlvlist); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
932 | aim_tlvlist_free(tlvlist); |
| 13235 | 933 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
934 | snacid = aim_cachesnac(od, SNAC_FAMILY_OSERVICE, 0x001e, 0x0000, NULL, 0); |
|
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
935 | flap_connection_send_snac(od, conn, SNAC_FAMILY_OSERVICE, 0x001e, 0x0000, snacid, &bs); |
| 13235 | 936 | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
937 | byte_stream_destroy(&bs); |
|
23004
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22860
diff
changeset
|
938 | |
| 13235 | 939 | return 0; |
| 940 | } | |
| 941 | ||
|
15686
b6d016a42e34
Combine two functions that did similar things. This is a little
Mark Doliner <markdoliner@pidgin.im>
parents:
15435
diff
changeset
|
942 | /** |
| 13235 | 943 | * Starting this past week (26 Mar 2001, say), AOL has started sending |
| 944 | * this nice little extra SNAC. AFAIK, it has never been used until now. | |
| 945 | * | |
| 946 | * The request contains eight bytes. The first four are an offset, the | |
| 947 | * second four are a length. | |
| 948 | * | |
| 949 | * The offset is an offset into aim.exe when it is mapped during execution | |
| 950 | * on Win32. So far, AOL has only been requesting bytes in static regions | |
| 951 | * of memory. (I won't put it past them to start requesting data in | |
| 952 | * less static regions -- regions that are initialized at run time, but still | |
| 953 | * before the client receives this request.) | |
| 954 | * | |
| 955 | * When the client receives the request, it adds it to the current ds | |
| 956 | * (0x00400000) and dereferences it, copying the data into a buffer which | |
| 957 | * it then runs directly through the MD5 hasher. The 16 byte output of | |
| 958 | * the hash is then sent back to the server. | |
| 959 | * | |
| 960 | * If the client does not send any data back, or the data does not match | |
| 961 | * the data that the specific client should have, the client will get the | |
| 962 | * following message from "AOL Instant Messenger": | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
963 | * "You have been disconnected from the AOL Instant Message Service (SM) |
| 13235 | 964 | * for accessing the AOL network using unauthorized software. You can |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
965 | * download a FREE, fully featured, and authorized client, here |
| 13235 | 966 | * http://www.aol.com/aim/download2.html" |
| 967 | * The connection is then closed, receiving disconnect code 1, URL | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
968 | * http://www.aim.aol.com/errors/USER_LOGGED_OFF_NEW_LOGIN.html. |
| 13235 | 969 | * |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
970 | * Note, however, that numerous inconsistencies can cause the above error, |
| 13235 | 971 | * not just sending back a bad hash. Do not immediatly suspect this code |
| 972 | * if you get disconnected. AOL and the open/free software community have | |
| 973 | * played this game for a couple years now, generating the above message | |
| 974 | * on numerous ocassions. | |
| 975 | * | |
| 976 | * Anyway, neener. We win again. | |
| 977 | * | |
| 978 | */ | |
| 979 | /* Subtype 0x001f - Client verification */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
980 | static int |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
981 | memrequest(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
| 13235 | 982 | { |
| 983 | int ret = 0; | |
| 984 | aim_rxcallback_t userfunc; | |
| 985 | guint32 offset, len; | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
986 | GSList *tlvlist; |
| 13235 | 987 | char *modname; |
| 988 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
989 | offset = byte_stream_get32(bs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
990 | len = byte_stream_get32(bs); |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
991 | tlvlist = aim_tlvlist_read(bs); |
| 13235 | 992 | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
993 | modname = aim_tlv_getstr(tlvlist, 0x0001, 1); |
| 13235 | 994 | |
|
22622
1ecb840b5101
Fix a bunch of compiler warnings caused by my addition of G_GNUC_PRINTF()
Mark Doliner <markdoliner@pidgin.im>
parents:
19859
diff
changeset
|
995 | purple_debug_info("oscar", "Got memory request for data at 0x%08x (%u bytes) of requested %s\n", offset, len, modname ? modname : "aim.exe"); |
| 13235 | 996 | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
997 | if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
998 | ret = userfunc(od, conn, frame, offset, len, modname); |
| 13235 | 999 | |
|
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
|
1000 | g_free(modname); |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1001 | aim_tlvlist_free(tlvlist); |
| 13235 | 1002 | |
| 1003 | return ret; | |
| 1004 | } | |
| 1005 | ||
| 1006 | /* Subtype 0x0020 - Client verification reply */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1007 | int |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1008 | aim_sendmemblock(OscarData *od, FlapConnection *conn, guint32 offset, guint32 len, const guint8 *buf, guint8 flag) |
| 13235 | 1009 | { |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
1010 | ByteStream bs; |
| 13235 | 1011 | aim_snacid_t snacid; |
| 1012 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1013 | if (!od || !conn) |
| 13235 | 1014 | return -EINVAL; |
| 1015 | ||
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
1016 | byte_stream_new(&bs, 2+16); |
| 13235 | 1017 | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
1018 | byte_stream_put16(&bs, 0x0010); /* md5 is always 16 bytes */ |
| 13235 | 1019 | |
| 1020 | if ((flag == AIM_SENDMEMBLOCK_FLAG_ISHASH) && buf && (len == 0x10)) { /* we're getting a hash */ | |
| 1021 | ||
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
1022 | byte_stream_putraw(&bs, buf, 0x10); |
| 13235 | 1023 | |
| 1024 | } else if (buf && (len > 0)) { /* use input buffer */ | |
| 15884 | 1025 | PurpleCipherContext *context; |
| 13235 | 1026 | guchar digest[16]; |
| 1027 | ||
|
23526
23c321e72167
Helper functions are cool
Mark Doliner <markdoliner@pidgin.im>
parents:
23456
diff
changeset
|
1028 | context = purple_cipher_context_new_by_name("md5", NULL); |
| 15884 | 1029 | purple_cipher_context_append(context, buf, len); |
| 1030 | purple_cipher_context_digest(context, 16, digest, NULL); | |
| 1031 | purple_cipher_context_destroy(context); | |
| 13235 | 1032 | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
1033 | byte_stream_putraw(&bs, digest, 0x10); |
| 13235 | 1034 | |
| 1035 | } else if (len == 0) { /* no length, just hash NULL (buf is optional) */ | |
| 15884 | 1036 | PurpleCipherContext *context; |
| 13235 | 1037 | guchar digest[16]; |
| 1038 | guint8 nil = '\0'; | |
| 1039 | ||
| 1040 | /* | |
| 1041 | * I'm not sure if we really need the empty append with the | |
| 1042 | * new MD5 functions, so I'll leave it in, just in case. | |
| 1043 | */ | |
|
23526
23c321e72167
Helper functions are cool
Mark Doliner <markdoliner@pidgin.im>
parents:
23456
diff
changeset
|
1044 | context = purple_cipher_context_new_by_name("md5", NULL); |
| 15884 | 1045 | purple_cipher_context_append(context, &nil, 0); |
| 1046 | purple_cipher_context_digest(context, 16, digest, NULL); | |
| 1047 | purple_cipher_context_destroy(context); | |
| 13235 | 1048 | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
1049 | byte_stream_putraw(&bs, digest, 0x10); |
| 13235 | 1050 | |
| 1051 | } else { | |
| 1052 | ||
| 1053 | /* | |
| 1054 | * This data is correct for AIM 3.5.1670. | |
| 1055 | * | |
| 1056 | * Using these blocks is as close to "legal" as you can get | |
| 1057 | * without using an AIM binary. | |
| 1058 | * | |
| 1059 | */ | |
| 1060 | if ((offset == 0x03ffffff) && (len == 0x03ffffff)) { | |
| 1061 | ||
| 1062 | #if 1 /* with "AnrbnrAqhfzcd" */ | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
1063 | byte_stream_put32(&bs, 0x44a95d26); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
1064 | byte_stream_put32(&bs, 0xd2490423); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
1065 | byte_stream_put32(&bs, 0x93b8821f); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
1066 | byte_stream_put32(&bs, 0x51c54b01); |
| 13235 | 1067 | #else /* no filename */ |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
1068 | byte_stream_put32(&bs, 0x1df8cbae); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
1069 | byte_stream_put32(&bs, 0x5523b839); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
1070 | byte_stream_put32(&bs, 0xa0e10db3); |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
1071 | byte_stream_put32(&bs, 0xa46d3b39); |
| 13235 | 1072 | #endif |
| 1073 | ||
| 1074 | } else | |
| 15884 | 1075 | purple_debug_warning("oscar", "sendmemblock: unknown hash request\n"); |
| 13235 | 1076 | |
| 1077 | } | |
| 1078 | ||
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
1079 | snacid = aim_cachesnac(od, SNAC_FAMILY_OSERVICE, 0x0020, 0x0000, NULL, 0); |
|
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
1080 | flap_connection_send_snac(od, conn, SNAC_FAMILY_OSERVICE, 0x0020, 0x0000, snacid, &bs); |
| 13235 | 1081 | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22622
diff
changeset
|
1082 | byte_stream_destroy(&bs); |
|
23004
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22860
diff
changeset
|
1083 | |
| 13235 | 1084 | return 0; |
| 1085 | } | |
| 1086 | ||
| 1087 | /* | |
| 1088 | * Subtype 0x0021 - Receive our extended status | |
| 1089 | * | |
| 1090 | * This is used for iChat's "available" messages, and maybe ICQ extended | |
| 1091 | * status messages? It's also used to tell the client whether or not it | |
| 1092 | * needs to upload an SSI buddy icon... who engineers this stuff, anyway? | |
| 1093 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1094 | static int |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1095 | aim_parse_extstatus(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
| 13235 | 1096 | { |
| 1097 | guint16 type; | |
| 1098 | guint8 flags, length; | |
| 1099 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1100 | type = byte_stream_get16(bs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1101 | flags = byte_stream_get8(bs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1102 | length = byte_stream_get8(bs); |
| 13235 | 1103 | |
|
13952
2bc729a80bd3
[gaim-migrate @ 16372]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1104 | /* |
|
2bc729a80bd3
[gaim-migrate @ 16372]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1105 | * A flag of 0x01 could mean "this is the checksum we have for you" |
|
2bc729a80bd3
[gaim-migrate @ 16372]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1106 | * A flag of 0x40 could mean "I don't have your icon, upload it" |
|
2bc729a80bd3
[gaim-migrate @ 16372]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1107 | */ |
|
2bc729a80bd3
[gaim-migrate @ 16372]
Mark Doliner <markdoliner@pidgin.im>
parents:
13665
diff
changeset
|
1108 | |
|
29986
ac5cbbbd080d
There's no reason to call into oscar.c anymore, so move this icon stuff
Mark Doliner <markdoliner@pidgin.im>
parents:
29978
diff
changeset
|
1109 | switch (type) { |
| 13235 | 1110 | case 0x0000: |
| 1111 | case 0x0001: { /* buddy icon checksum */ | |
| 1112 | /* not sure what the difference between 1 and 0 is */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1113 | guint8 *md5 = byte_stream_getraw(bs, length); |
|
29986
ac5cbbbd080d
There's no reason to call into oscar.c anymore, so move this icon stuff
Mark Doliner <markdoliner@pidgin.im>
parents:
29978
diff
changeset
|
1114 | |
|
ac5cbbbd080d
There's no reason to call into oscar.c anymore, so move this icon stuff
Mark Doliner <markdoliner@pidgin.im>
parents:
29978
diff
changeset
|
1115 | if ((flags == 0x00) || (flags == 0x41)) { |
|
ac5cbbbd080d
There's no reason to call into oscar.c anymore, so move this icon stuff
Mark Doliner <markdoliner@pidgin.im>
parents:
29978
diff
changeset
|
1116 | if (!flap_connection_getbytype(od, SNAC_FAMILY_BART) && !od->iconconnecting) { |
|
ac5cbbbd080d
There's no reason to call into oscar.c anymore, so move this icon stuff
Mark Doliner <markdoliner@pidgin.im>
parents:
29978
diff
changeset
|
1117 | od->iconconnecting = TRUE; |
|
ac5cbbbd080d
There's no reason to call into oscar.c anymore, so move this icon stuff
Mark Doliner <markdoliner@pidgin.im>
parents:
29978
diff
changeset
|
1118 | od->set_icon = TRUE; |
|
ac5cbbbd080d
There's no reason to call into oscar.c anymore, so move this icon stuff
Mark Doliner <markdoliner@pidgin.im>
parents:
29978
diff
changeset
|
1119 | aim_srv_requestnew(od, SNAC_FAMILY_BART); |
|
ac5cbbbd080d
There's no reason to call into oscar.c anymore, so move this icon stuff
Mark Doliner <markdoliner@pidgin.im>
parents:
29978
diff
changeset
|
1120 | } else { |
|
ac5cbbbd080d
There's no reason to call into oscar.c anymore, so move this icon stuff
Mark Doliner <markdoliner@pidgin.im>
parents:
29978
diff
changeset
|
1121 | PurpleAccount *account = purple_connection_get_account(od->gc); |
|
ac5cbbbd080d
There's no reason to call into oscar.c anymore, so move this icon stuff
Mark Doliner <markdoliner@pidgin.im>
parents:
29978
diff
changeset
|
1122 | PurpleStoredImage *img = purple_buddy_icons_find_account_icon(account); |
|
ac5cbbbd080d
There's no reason to call into oscar.c anymore, so move this icon stuff
Mark Doliner <markdoliner@pidgin.im>
parents:
29978
diff
changeset
|
1123 | if (img == NULL) { |
|
ac5cbbbd080d
There's no reason to call into oscar.c anymore, so move this icon stuff
Mark Doliner <markdoliner@pidgin.im>
parents:
29978
diff
changeset
|
1124 | aim_ssi_delicon(od); |
|
ac5cbbbd080d
There's no reason to call into oscar.c anymore, so move this icon stuff
Mark Doliner <markdoliner@pidgin.im>
parents:
29978
diff
changeset
|
1125 | } else { |
|
ac5cbbbd080d
There's no reason to call into oscar.c anymore, so move this icon stuff
Mark Doliner <markdoliner@pidgin.im>
parents:
29978
diff
changeset
|
1126 | |
|
ac5cbbbd080d
There's no reason to call into oscar.c anymore, so move this icon stuff
Mark Doliner <markdoliner@pidgin.im>
parents:
29978
diff
changeset
|
1127 | purple_debug_info("oscar", |
|
ac5cbbbd080d
There's no reason to call into oscar.c anymore, so move this icon stuff
Mark Doliner <markdoliner@pidgin.im>
parents:
29978
diff
changeset
|
1128 | "Uploading icon to icon server\n"); |
|
ac5cbbbd080d
There's no reason to call into oscar.c anymore, so move this icon stuff
Mark Doliner <markdoliner@pidgin.im>
parents:
29978
diff
changeset
|
1129 | aim_bart_upload(od, purple_imgstore_get_data(img), |
|
ac5cbbbd080d
There's no reason to call into oscar.c anymore, so move this icon stuff
Mark Doliner <markdoliner@pidgin.im>
parents:
29978
diff
changeset
|
1130 | purple_imgstore_get_size(img)); |
|
ac5cbbbd080d
There's no reason to call into oscar.c anymore, so move this icon stuff
Mark Doliner <markdoliner@pidgin.im>
parents:
29978
diff
changeset
|
1131 | purple_imgstore_unref(img); |
|
ac5cbbbd080d
There's no reason to call into oscar.c anymore, so move this icon stuff
Mark Doliner <markdoliner@pidgin.im>
parents:
29978
diff
changeset
|
1132 | } |
|
ac5cbbbd080d
There's no reason to call into oscar.c anymore, so move this icon stuff
Mark Doliner <markdoliner@pidgin.im>
parents:
29978
diff
changeset
|
1133 | } |
|
ac5cbbbd080d
There's no reason to call into oscar.c anymore, so move this icon stuff
Mark Doliner <markdoliner@pidgin.im>
parents:
29978
diff
changeset
|
1134 | } else if (flags == 0x81) { |
|
ac5cbbbd080d
There's no reason to call into oscar.c anymore, so move this icon stuff
Mark Doliner <markdoliner@pidgin.im>
parents:
29978
diff
changeset
|
1135 | PurpleAccount *account = purple_connection_get_account(od->gc); |
|
ac5cbbbd080d
There's no reason to call into oscar.c anymore, so move this icon stuff
Mark Doliner <markdoliner@pidgin.im>
parents:
29978
diff
changeset
|
1136 | PurpleStoredImage *img = purple_buddy_icons_find_account_icon(account); |
|
ac5cbbbd080d
There's no reason to call into oscar.c anymore, so move this icon stuff
Mark Doliner <markdoliner@pidgin.im>
parents:
29978
diff
changeset
|
1137 | if (img == NULL) |
|
ac5cbbbd080d
There's no reason to call into oscar.c anymore, so move this icon stuff
Mark Doliner <markdoliner@pidgin.im>
parents:
29978
diff
changeset
|
1138 | aim_ssi_delicon(od); |
|
ac5cbbbd080d
There's no reason to call into oscar.c anymore, so move this icon stuff
Mark Doliner <markdoliner@pidgin.im>
parents:
29978
diff
changeset
|
1139 | else { |
|
ac5cbbbd080d
There's no reason to call into oscar.c anymore, so move this icon stuff
Mark Doliner <markdoliner@pidgin.im>
parents:
29978
diff
changeset
|
1140 | aim_ssi_seticon(od, md5, length); |
|
ac5cbbbd080d
There's no reason to call into oscar.c anymore, so move this icon stuff
Mark Doliner <markdoliner@pidgin.im>
parents:
29978
diff
changeset
|
1141 | purple_imgstore_unref(img); |
|
ac5cbbbd080d
There's no reason to call into oscar.c anymore, so move this icon stuff
Mark Doliner <markdoliner@pidgin.im>
parents:
29978
diff
changeset
|
1142 | } |
|
ac5cbbbd080d
There's no reason to call into oscar.c anymore, so move this icon stuff
Mark Doliner <markdoliner@pidgin.im>
parents:
29978
diff
changeset
|
1143 | } |
|
ac5cbbbd080d
There's no reason to call into oscar.c anymore, so move this icon stuff
Mark Doliner <markdoliner@pidgin.im>
parents:
29978
diff
changeset
|
1144 | |
|
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
|
1145 | g_free(md5); |
|
29986
ac5cbbbd080d
There's no reason to call into oscar.c anymore, so move this icon stuff
Mark Doliner <markdoliner@pidgin.im>
parents:
29978
diff
changeset
|
1146 | } break; |
|
ac5cbbbd080d
There's no reason to call into oscar.c anymore, so move this icon stuff
Mark Doliner <markdoliner@pidgin.im>
parents:
29978
diff
changeset
|
1147 | |
|
ac5cbbbd080d
There's no reason to call into oscar.c anymore, so move this icon stuff
Mark Doliner <markdoliner@pidgin.im>
parents:
29978
diff
changeset
|
1148 | case 0x0002: { |
|
ac5cbbbd080d
There's no reason to call into oscar.c anymore, so move this icon stuff
Mark Doliner <markdoliner@pidgin.im>
parents:
29978
diff
changeset
|
1149 | /* We just set an available message? */ |
| 13235 | 1150 | /* there is a second length that is just for the message */ |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1151 | char *msg = byte_stream_getstr(bs, byte_stream_get16(bs)); |
|
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
|
1152 | g_free(msg); |
|
29986
ac5cbbbd080d
There's no reason to call into oscar.c anymore, so move this icon stuff
Mark Doliner <markdoliner@pidgin.im>
parents:
29978
diff
changeset
|
1153 | } break; |
| 13235 | 1154 | } |
| 1155 | ||
|
29986
ac5cbbbd080d
There's no reason to call into oscar.c anymore, so move this icon stuff
Mark Doliner <markdoliner@pidgin.im>
parents:
29978
diff
changeset
|
1156 | return 0; |
| 13235 | 1157 | } |
| 1158 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1159 | static int |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1160 | snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
| 13235 | 1161 | { |
| 1162 | if (snac->subtype == 0x0003) | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1163 | return hostonline(od, conn, mod, frame, snac, bs); |
| 13235 | 1164 | else if (snac->subtype == 0x0005) |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1165 | return redirect(od, conn, mod, frame, snac, bs); |
| 13235 | 1166 | else if (snac->subtype == 0x0007) |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1167 | return rateresp(od, conn, mod, frame, snac, bs); |
| 13235 | 1168 | else if (snac->subtype == 0x000a) |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1169 | return ratechange(od, conn, mod, frame, snac, bs); |
| 13235 | 1170 | else if (snac->subtype == 0x000b) |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1171 | return serverpause(od, conn, mod, frame, snac, bs); |
| 13235 | 1172 | else if (snac->subtype == 0x000d) |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1173 | return serverresume(od, conn, mod, frame, snac, bs); |
| 13235 | 1174 | else if (snac->subtype == 0x000f) |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1175 | return selfinfo(od, conn, mod, frame, snac, bs); |
| 13235 | 1176 | else if (snac->subtype == 0x0010) |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1177 | return evilnotify(od, conn, mod, frame, snac, bs); |
| 13235 | 1178 | else if (snac->subtype == 0x0012) |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1179 | return migrate(od, conn, mod, frame, snac, bs); |
| 13235 | 1180 | else if (snac->subtype == 0x0013) |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1181 | return motd(od, conn, mod, frame, snac, bs); |
| 13235 | 1182 | else if (snac->subtype == 0x0018) |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1183 | return hostversions(od, conn, mod, frame, snac, bs); |
| 13235 | 1184 | else if (snac->subtype == 0x001f) |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1185 | return memrequest(od, conn, mod, frame, snac, bs); |
| 13235 | 1186 | else if (snac->subtype == 0x0021) |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1187 | return aim_parse_extstatus(od, conn, mod, frame, snac, bs); |
| 13235 | 1188 | |
| 1189 | return 0; | |
| 1190 | } | |
| 1191 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1192 | int service_modfirst(OscarData *od, aim_module_t *mod) |
| 13235 | 1193 | { |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
1194 | mod->family = SNAC_FAMILY_OSERVICE; |
| 13235 | 1195 | mod->version = 0x0003; |
| 1196 | mod->toolid = 0x0110; | |
| 1197 | mod->toolversion = 0x0629; | |
| 1198 | mod->flags = 0; | |
| 1199 | strncpy(mod->name, "oservice", sizeof(mod->name)); | |
| 1200 | mod->snachandler = snachandler; | |
| 1201 | ||
| 1202 | return 0; | |
| 1203 | } |