Mercurial > pidgin.yaz
annotate src/protocols/oscar/info.c @ 6000:711a425ac97c
[gaim-migrate @ 6448]
The Trepia male/female icons are.. a little easier to read.. kind of..
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Thu, 03 Jul 2003 03:23:27 +0000 |
parents | 04dc7fe68889 |
children | 30d4c432101c |
rev | line source |
---|---|
2086 | 1 /* |
3952 | 2 * Family 0x0002 - Information. |
2086 | 3 * |
4 * The functions here are responsible for requesting and parsing information- | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
5 * gathering SNACs. Or something like that. |
2086 | 6 * |
7 */ | |
8 | |
9 #define FAIM_INTERNAL | |
10 #include <aim.h> | |
4156
d833bacc054f
[gaim-migrate @ 4384]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4151
diff
changeset
|
11 #ifdef _WIN32 |
d833bacc054f
[gaim-migrate @ 4384]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4151
diff
changeset
|
12 #include "win32dep.h" |
d833bacc054f
[gaim-migrate @ 4384]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4151
diff
changeset
|
13 #endif |
2086 | 14 |
15 struct aim_priv_inforeq { | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
16 char sn[MAXSNLEN+1]; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
17 fu16_t infotype; |
2086 | 18 }; |
19 | |
3952 | 20 /* |
21 * Subtype 0x0002 | |
22 * | |
23 * Request Location services rights. | |
24 * | |
25 */ | |
26 faim_export int aim_bos_reqlocaterights(aim_session_t *sess, aim_conn_t *conn) | |
27 { | |
28 return aim_genericreq_n(sess, conn, 0x0002, 0x0002); | |
29 } | |
30 | |
31 /* | |
32 * Subtype 0x0004 | |
33 * | |
34 * Gives BOS your profile. | |
4151 | 35 * |
36 * profile_encoding and awaymsg_encoding MUST be set if profile or | |
37 * away are set, respectively, and their value may or may not be | |
38 * restricted to a few choices. I am currently aware of: | |
39 * | |
40 * us-ascii Just that | |
41 * unicode-2-0 UCS2-BE | |
42 * | |
43 * profile_len and awaymsg_len MUST be set similarly, and they MUST | |
44 * be the length of their respective strings in bytes. | |
45 * | |
46 * To get the previous behavior of awaymsg == "" un-setting the away | |
47 * message, set awaymsg non-NULL and awaymsg_len to 0 (this is the | |
48 * obvious equivalent). | |
3952 | 49 * |
50 */ | |
4151 | 51 faim_export int aim_bos_setprofile(aim_session_t *sess, aim_conn_t *conn, |
52 const char *profile_encoding, const char *profile, const int profile_len, | |
53 const char *awaymsg_encoding, const char *awaymsg, const int awaymsg_len, | |
54 fu32_t caps) | |
3952 | 55 { |
4151 | 56 static const char defencoding[] = {"text/aolrtf; charset=\"%s\""}; |
3952 | 57 aim_frame_t *fr; |
58 aim_tlvlist_t *tl = NULL; | |
59 aim_snacid_t snacid; | |
4151 | 60 char *encoding; |
61 | |
62 if ((profile && profile_encoding == NULL) || (awaymsg && awaymsg_len && awaymsg_encoding == NULL)) { | |
63 return -EINVAL; | |
64 } | |
3952 | 65 |
66 /* Build to packet first to get real length */ | |
67 if (profile) { | |
4151 | 68 /* no + 1 here because of %s */ |
69 encoding = malloc(strlen(defencoding) + strlen(profile_encoding)); | |
70 if (encoding == NULL) { | |
71 return -ENOMEM; | |
72 } | |
73 snprintf(encoding, strlen(defencoding) + strlen(profile_encoding), defencoding, profile_encoding); | |
74 aim_addtlvtochain_raw(&tl, 0x0001, strlen(encoding), encoding); | |
75 aim_addtlvtochain_raw(&tl, 0x0002, profile_len, profile); | |
76 free(encoding); | |
3952 | 77 } |
78 | |
79 /* | |
80 * So here's how this works: | |
81 * - You are away when you have a non-zero-length type 4 TLV stored. | |
82 * - You become unaway when you clear the TLV with a zero-length | |
83 * type 4 TLV. | |
84 * - If you do not send the type 4 TLV, your status does not change | |
85 * (that is, if you were away, you'll remain away). | |
86 */ | |
87 if (awaymsg) { | |
4151 | 88 if (awaymsg_len) { |
89 encoding = malloc(strlen(defencoding) + strlen(awaymsg_encoding)); | |
90 if (encoding == NULL) { | |
91 return -ENOMEM; | |
92 } | |
93 snprintf(encoding, strlen(defencoding) + strlen(awaymsg_encoding), defencoding, awaymsg_encoding); | |
94 aim_addtlvtochain_raw(&tl, 0x0003, strlen(encoding), encoding); | |
95 aim_addtlvtochain_raw(&tl, 0x0004, awaymsg_len, awaymsg); | |
96 free(encoding); | |
3952 | 97 } else |
98 aim_addtlvtochain_noval(&tl, 0x0004); | |
99 } | |
100 | |
101 aim_addtlvtochain_caps(&tl, 0x0005, caps); | |
102 | |
103 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + aim_sizetlvchain(&tl)))) | |
104 return -ENOMEM; | |
105 | |
106 snacid = aim_cachesnac(sess, 0x0002, 0x0004, 0x0000, NULL, 0); | |
107 | |
108 aim_putsnac(&fr->data, 0x0002, 0x004, 0x0000, snacid); | |
109 aim_writetlvchain(&fr->data, &tl); | |
110 aim_freetlvchain(&tl); | |
111 | |
112 aim_tx_enqueue(sess, fr); | |
113 | |
114 return 0; | |
115 } | |
116 | |
117 /* | |
118 * Subtype 0x0005 - Request info of another AIM user. | |
119 * | |
120 */ | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
121 faim_export int aim_getinfo(aim_session_t *sess, aim_conn_t *conn, const char *sn, fu16_t infotype) |
2086 | 122 { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
123 struct aim_priv_inforeq privdata; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
124 aim_frame_t *fr; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
125 aim_snacid_t snacid; |
2086 | 126 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
127 if (!sess || !conn || !sn) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
128 return -EINVAL; |
2086 | 129 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
130 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 12+1+strlen(sn)))) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
131 return -ENOMEM; |
2086 | 132 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
133 strncpy(privdata.sn, sn, sizeof(privdata.sn)); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
134 privdata.infotype = infotype; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
135 snacid = aim_cachesnac(sess, 0x0002, 0x0005, 0x0000, &privdata, sizeof(struct aim_priv_inforeq)); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
136 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
137 aim_putsnac(&fr->data, 0x0002, 0x0005, 0x0000, snacid); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
138 aimbs_put16(&fr->data, infotype); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
139 aimbs_put8(&fr->data, strlen(sn)); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
140 aimbs_putraw(&fr->data, sn, strlen(sn)); |
2086 | 141 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
142 aim_tx_enqueue(sess, fr); |
2086 | 143 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
144 return 0; |
2086 | 145 } |
146 | |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
147 faim_export const char *aim_userinfo_sn(aim_userinfo_t *ui) |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
148 { |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
149 |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
150 if (!ui) |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
151 return NULL; |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
152 |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
153 return ui->sn; |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
154 } |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
155 |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
156 faim_export fu16_t aim_userinfo_flags(aim_userinfo_t *ui) |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
157 { |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
158 |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
159 if (!ui) |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
160 return 0; |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
161 |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
162 return ui->flags; |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
163 } |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
164 |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
165 faim_export fu16_t aim_userinfo_idle(aim_userinfo_t *ui) |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
166 { |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
167 |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
168 if (!ui) |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
169 return 0; |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
170 |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
171 return ui->idletime; |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
172 } |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
173 |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
174 faim_export float aim_userinfo_warnlevel(aim_userinfo_t *ui) |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
175 { |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
176 |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
177 if (!ui) |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
178 return 0.00; |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
179 |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
180 return (ui->warnlevel / 10); |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
181 } |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
182 |
3459 | 183 faim_export time_t aim_userinfo_createtime(aim_userinfo_t *ui) |
184 { | |
185 | |
186 if (!ui) | |
187 return 0; | |
188 | |
189 return (time_t)ui->createtime; | |
190 } | |
191 | |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
192 faim_export time_t aim_userinfo_membersince(aim_userinfo_t *ui) |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
193 { |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
194 |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
195 if (!ui) |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
196 return 0; |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
197 |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
198 return (time_t)ui->membersince; |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
199 } |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
200 |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
201 faim_export time_t aim_userinfo_onlinesince(aim_userinfo_t *ui) |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
202 { |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
203 |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
204 if (!ui) |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
205 return 0; |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
206 |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
207 return (time_t)ui->onlinesince; |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
208 } |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
209 |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
210 faim_export fu32_t aim_userinfo_sessionlen(aim_userinfo_t *ui) |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
211 { |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
212 |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
213 if (!ui) |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
214 return 0; |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
215 |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
216 return ui->sessionlen; |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
217 } |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
218 |
2866
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
219 faim_export int aim_userinfo_hascap(aim_userinfo_t *ui, fu32_t cap) |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
220 { |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
221 |
2993 | 222 if (!ui || !(ui->present & AIM_USERINFO_PRESENT_CAPABILITIES)) |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
223 return -1; |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
224 |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
225 return !!(ui->capabilities & cap); |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
226 } |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
227 |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
228 |
2086 | 229 /* |
2866
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
230 * Capability blocks. |
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
231 * |
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
232 * These are CLSIDs. They should actually be of the form: |
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
233 * |
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
234 * {0x0946134b, 0x4c7f, 0x11d1, |
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
235 * {0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}}, |
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
236 * |
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
237 * But, eh. |
2086 | 238 */ |
239 static const struct { | |
2866
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
240 fu32_t flag; |
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
241 fu8_t data[16]; |
2086 | 242 } aim_caps[] = { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
243 |
2669 | 244 /* |
5927 | 245 * These are in ascending numerical order. |
2669 | 246 */ |
5917 | 247 {AIM_CAPS_ICHAT, |
248 {0x09, 0x46, 0x00, 0x00, 0x4c, 0x7f, 0x11, 0xd1, | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
249 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
250 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
251 {AIM_CAPS_VOICE, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
252 {0x09, 0x46, 0x13, 0x41, 0x4c, 0x7f, 0x11, 0xd1, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
253 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, |
2086 | 254 |
2669 | 255 {AIM_CAPS_SENDFILE, |
256 {0x09, 0x46, 0x13, 0x43, 0x4c, 0x7f, 0x11, 0xd1, | |
257 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, | |
258 | |
259 /* | |
260 * Advertised by the EveryBuddy client. | |
261 */ | |
2734
9fc65bb80596
[gaim-migrate @ 2747]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
262 {AIM_CAPS_ICQ, |
2669 | 263 {0x09, 0x46, 0x13, 0x44, 0x4c, 0x7f, 0x11, 0xd1, |
264 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, | |
265 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
266 {AIM_CAPS_IMIMAGE, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
267 {0x09, 0x46, 0x13, 0x45, 0x4c, 0x7f, 0x11, 0xd1, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
268 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
269 |
2669 | 270 {AIM_CAPS_BUDDYICON, |
271 {0x09, 0x46, 0x13, 0x46, 0x4c, 0x7f, 0x11, 0xd1, | |
272 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, | |
273 | |
4870 | 274 /* |
275 * Windows AIM calls this "Add-ins," which is probably more accurate | |
276 */ | |
2669 | 277 {AIM_CAPS_SAVESTOCKS, |
278 {0x09, 0x46, 0x13, 0x47, 0x4c, 0x7f, 0x11, 0xd1, | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
279 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
280 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
281 {AIM_CAPS_GETFILE, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
282 {0x09, 0x46, 0x13, 0x48, 0x4c, 0x7f, 0x11, 0xd1, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
283 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, |
2086 | 284 |
2866
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
285 {AIM_CAPS_ICQSERVERRELAY, |
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
286 {0x09, 0x46, 0x13, 0x49, 0x4c, 0x7f, 0x11, 0xd1, |
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
287 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, |
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
288 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
289 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
290 * Indeed, there are two of these. The former appears to be correct, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
291 * but in some versions of winaim, the second one is set. Either they |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
292 * forgot to fix endianness, or they made a typo. It really doesn't |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
293 * matter which. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
294 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
295 {AIM_CAPS_GAMES, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
296 {0x09, 0x46, 0x13, 0x4a, 0x4c, 0x7f, 0x11, 0xd1, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
297 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
298 {AIM_CAPS_GAMES2, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
299 {0x09, 0x46, 0x13, 0x4a, 0x4c, 0x7f, 0x11, 0xd1, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
300 0x22, 0x82, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, |
2086 | 301 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
302 {AIM_CAPS_SENDBUDDYLIST, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
303 {0x09, 0x46, 0x13, 0x4b, 0x4c, 0x7f, 0x11, 0xd1, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
304 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, |
2086 | 305 |
4811 | 306 /* |
4898 | 307 * Setting this lets AIM users receive messages from ICQ users, and ICQ |
308 * users receive messages from AIM users. It also lets ICQ users show | |
309 * up in buddy lists for AIM users, and AIM users show up in buddy lists | |
310 * for ICQ users. And ICQ privacy/invisibility acts like AIM privacy, | |
311 * in that if you add a user to your deny list, you will not be able to | |
312 * see them as online (previous you could still see them, but they | |
313 * couldn't see you. | |
4811 | 314 */ |
315 {AIM_CAPS_INTEROPERATE, | |
316 {0x09, 0x46, 0x13, 0x4d, 0x4c, 0x7f, 0x11, 0xd1, | |
317 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, | |
318 | |
4650 | 319 {AIM_CAPS_ICQUTF8, |
3952 | 320 {0x09, 0x46, 0x13, 0x4e, 0x4c, 0x7f, 0x11, 0xd1, |
4650 | 321 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, |
322 | |
323 {AIM_CAPS_ICQUNKNOWN, | |
324 {0x2e, 0x7a, 0x64, 0x75, 0xfa, 0xdf, 0x4d, 0xc8, | |
325 0x88, 0x6f, 0xea, 0x35, 0x95, 0xfd, 0xb6, 0xdf}}, | |
326 | |
327 /* | |
5917 | 328 * Chat is oddball. |
329 */ | |
330 {AIM_CAPS_CHAT, | |
331 {0x74, 0x8f, 0x24, 0x20, 0x62, 0x87, 0x11, 0xd1, | |
332 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, | |
333 | |
334 /* | |
4650 | 335 {AIM_CAPS_ICQ2GO, |
336 {0x56, 0x3f, 0xc8, 0x09, 0x0b, 0x6f, 0x41, 0xbd, | |
337 0x9f, 0x79, 0x42, 0x26, 0x09, 0xdf, 0xa2, 0xf3}}, | |
338 */ | |
3952 | 339 |
2866
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
340 {AIM_CAPS_ICQRTF, |
4650 | 341 {0x97, 0xb1, 0x27, 0x51, 0x24, 0x3c, 0x43, 0x34, |
2866
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
342 0xad, 0x22, 0xd6, 0xab, 0xf7, 0x3f, 0x14, 0x92}}, |
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
343 |
3952 | 344 /* supposed to be ICQRTF? |
345 {AIM_CAPS_TRILLUNKNOWN, | |
346 {0x97, 0xb1, 0x27, 0x51, 0x24, 0x3c, 0x43, 0x34, | |
347 0xad, 0x22, 0xd6, 0xab, 0xf7, 0x3f, 0x14, 0x09}}, */ | |
348 | |
4650 | 349 {AIM_CAPS_APINFO, |
5917 | 350 {0xaa, 0x4a, 0x32, 0xb5, 0xf8, 0x84, 0x48, 0xc6, |
4650 | 351 0xa3, 0xd7, 0x8c, 0x50, 0x97, 0x19, 0xfd, 0x5b}}, |
2866
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
352 |
2920 | 353 {AIM_CAPS_TRILLIANCRYPT, |
354 {0xf2, 0xe7, 0xc7, 0xf4, 0xfe, 0xad, 0x4d, 0xfb, | |
355 0xb2, 0x35, 0x36, 0x79, 0x8b, 0xdf, 0x00, 0x00}}, | |
356 | |
4650 | 357 {AIM_CAPS_EMPTY, |
358 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
359 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}, | |
2979 | 360 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
361 {AIM_CAPS_LAST} |
2086 | 362 }; |
363 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
364 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
365 * This still takes a length parameter even with a bstream because capabilities |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
366 * are not naturally bounded. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
367 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
368 */ |
2866
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
369 faim_internal fu32_t aim_getcap(aim_session_t *sess, aim_bstream_t *bs, int len) |
2086 | 370 { |
2866
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
371 fu32_t flags = 0; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
372 int offset; |
2086 | 373 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
374 for (offset = 0; aim_bstream_empty(bs) && (offset < len); offset += 0x10) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
375 fu8_t *cap; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
376 int i, identified; |
2086 | 377 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
378 cap = aimbs_getraw(bs, 0x10); |
2086 | 379 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
380 for (i = 0, identified = 0; !(aim_caps[i].flag & AIM_CAPS_LAST); i++) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
381 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
382 if (memcmp(&aim_caps[i].data, cap, 0x10) == 0) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
383 flags |= aim_caps[i].flag; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
384 identified++; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
385 break; /* should only match once... */ |
2086 | 386 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
387 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
388 } |
2086 | 389 |
2920 | 390 if (!identified) { |
391 faimdprintf(sess, 0, "unknown capability: {%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n", | |
392 cap[0], cap[1], cap[2], cap[3], | |
393 cap[4], cap[5], | |
394 cap[6], cap[7], | |
395 cap[8], cap[9], | |
396 cap[10], cap[11], cap[12], cap[13], | |
397 cap[14], cap[15]); | |
398 } | |
2086 | 399 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
400 free(cap); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
401 } |
2086 | 402 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
403 return flags; |
2086 | 404 } |
405 | |
2866
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
406 faim_internal int aim_putcap(aim_bstream_t *bs, fu32_t caps) |
2086 | 407 { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
408 int i; |
2086 | 409 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
410 if (!bs) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
411 return -EINVAL; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
412 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
413 for (i = 0; aim_bstream_empty(bs); i++) { |
2086 | 414 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
415 if (aim_caps[i].flag == AIM_CAPS_LAST) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
416 break; |
2086 | 417 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
418 if (caps & aim_caps[i].flag) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
419 aimbs_putraw(bs, aim_caps[i].data, 0x10); |
2086 | 420 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
421 } |
2086 | 422 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
423 return 0; |
2086 | 424 } |
425 | |
3459 | 426 static void dumptlv(aim_session_t *sess, fu16_t type, aim_bstream_t *bs, fu8_t len) |
427 { | |
428 int i; | |
429 | |
430 if (!sess || !bs || !len) | |
431 return; | |
432 | |
433 faimdprintf(sess, 0, "userinfo: type =0x%04x\n", type); | |
434 faimdprintf(sess, 0, "userinfo: length=0x%04x\n", len); | |
435 | |
436 faimdprintf(sess, 0, "userinfo: value:\n"); | |
437 | |
438 for (i = 0; i < len; i++) { | |
439 if ((i % 8) == 0) | |
440 faimdprintf(sess, 0, "\nuserinfo: "); | |
441 | |
442 faimdprintf(sess, 0, "0x%2x ", aimbs_get8(bs)); | |
443 } | |
444 | |
445 faimdprintf(sess, 0, "\n"); | |
446 | |
447 return; | |
448 } | |
449 | |
5836 | 450 faim_internal void aim_info_free(aim_userinfo_t *info) |
451 { | |
452 free(info->iconcsum); | |
453 free(info->availablemsg); | |
454 } | |
455 | |
2086 | 456 /* |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
457 * AIM is fairly regular about providing user info. This is a generic |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
458 * routine to extract it in its standard form. |
2086 | 459 */ |
5836 | 460 faim_internal int aim_info_extract(aim_session_t *sess, aim_bstream_t *bs, aim_userinfo_t *outinfo) |
2086 | 461 { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
462 int curtlv, tlvcnt; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
463 fu8_t snlen; |
2086 | 464 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
465 if (!bs || !outinfo) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
466 return -EINVAL; |
2086 | 467 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
468 /* Clear out old data first */ |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
469 memset(outinfo, 0x00, sizeof(aim_userinfo_t)); |
2086 | 470 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
471 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
472 * Screen name. Stored as an unterminated string prepended with a |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
473 * byte containing its length. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
474 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
475 snlen = aimbs_get8(bs); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
476 aimbs_getrawbuf(bs, outinfo->sn, snlen); |
2086 | 477 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
478 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
479 * Warning Level. Stored as an unsigned short. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
480 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
481 outinfo->warnlevel = aimbs_get16(bs); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
482 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
483 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
484 * TLV Count. Unsigned short representing the number of |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
485 * Type-Length-Value triples that follow. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
486 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
487 tlvcnt = aimbs_get16(bs); |
2086 | 488 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
489 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
490 * Parse out the Type-Length-Value triples as they're found. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
491 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
492 for (curtlv = 0; curtlv < tlvcnt; curtlv++) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
493 int endpos; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
494 fu16_t type, length; |
2086 | 495 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
496 type = aimbs_get16(bs); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
497 length = aimbs_get16(bs); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
498 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
499 endpos = aim_bstream_curpos(bs) + length; |
2086 | 500 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
501 if (type == 0x0001) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
502 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
503 * Type = 0x0001: User flags |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
504 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
505 * Specified as any of the following ORed together: |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
506 * 0x0001 Trial (user less than 60days) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
507 * 0x0002 Unknown bit 2 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
508 * 0x0004 AOL Main Service user |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
509 * 0x0008 Unknown bit 4 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
510 * 0x0010 Free (AIM) user |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
511 * 0x0020 Away |
2315
7ec21662ffc2
[gaim-migrate @ 2325]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
512 * 0x0400 ActiveBuddy |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
513 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
514 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
515 outinfo->flags = aimbs_get16(bs); |
2993 | 516 outinfo->present |= AIM_USERINFO_PRESENT_FLAGS; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
517 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
518 } else if (type == 0x0002) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
519 /* |
3459 | 520 * Type = 0x0002: Account creation time. |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
521 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
522 * The time/date that the user originally registered for |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
523 * the service, stored in time_t format. |
3459 | 524 * |
525 * I'm not sure how this differs from type 5 ("member | |
526 * since"). | |
527 * | |
528 * Note: This is the field formerly known as "member | |
529 * since". All these years and I finally found out | |
530 * that I got the name wrong. | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
531 */ |
3459 | 532 outinfo->createtime = aimbs_get32(bs); |
533 outinfo->present |= AIM_USERINFO_PRESENT_CREATETIME; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
534 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
535 } else if (type == 0x0003) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
536 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
537 * Type = 0x0003: On-Since date. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
538 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
539 * The time/date that the user started their current |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
540 * session, stored in time_t format. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
541 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
542 outinfo->onlinesince = aimbs_get32(bs); |
2993 | 543 outinfo->present |= AIM_USERINFO_PRESENT_ONLINESINCE; |
2086 | 544 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
545 } else if (type == 0x0004) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
546 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
547 * Type = 0x0004: Idle time. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
548 * |
4443 | 549 * Number of minutes since the user actively used the |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
550 * service. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
551 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
552 * Note that the client tells the server when to start |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
553 * counting idle times, so this may or may not be |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
554 * related to reality. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
555 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
556 outinfo->idletime = aimbs_get16(bs); |
2993 | 557 outinfo->present |= AIM_USERINFO_PRESENT_IDLE; |
3952 | 558 |
3459 | 559 } else if (type == 0x0005) { |
560 /* | |
561 * Type = 0x0005: Member since date. | |
562 * | |
563 * The time/date that the user originally registered for | |
564 * the service, stored in time_t format. | |
565 * | |
566 * This is sometimes sent instead of type 2 ("account | |
567 * creation time"), particularly in the self-info. | |
3952 | 568 * And particularly for ICQ? |
3459 | 569 */ |
570 outinfo->membersince = aimbs_get32(bs); | |
571 outinfo->present |= AIM_USERINFO_PRESENT_MEMBERSINCE; | |
2086 | 572 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
573 } else if (type == 0x0006) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
574 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
575 * Type = 0x0006: ICQ Online Status |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
576 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
577 * ICQ's Away/DND/etc "enriched" status. Some decoding |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
578 * of values done by Scott <darkagl@pcnet.com> |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
579 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
580 aimbs_get16(bs); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
581 outinfo->icqinfo.status = aimbs_get16(bs); |
2993 | 582 outinfo->present |= AIM_USERINFO_PRESENT_ICQEXTSTATUS; |
2086 | 583 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
584 } else if (type == 0x000a) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
585 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
586 * Type = 0x000a |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
587 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
588 * ICQ User IP Address. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
589 * Ahh, the joy of ICQ security. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
590 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
591 outinfo->icqinfo.ipaddr = aimbs_get32(bs); |
2993 | 592 outinfo->present |= AIM_USERINFO_PRESENT_ICQIPADDR; |
2086 | 593 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
594 } else if (type == 0x000c) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
595 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
596 * Type = 0x000c |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
597 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
598 * random crap containing the IP address, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
599 * apparently a port number, and some Other Stuff. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
600 * |
4342 | 601 * Format is: |
602 * 4 bytes - Our IP address, 0xc0 a8 01 2b for 192.168.1.43 | |
603 * | |
604 * | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
605 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
606 aimbs_getrawbuf(bs, outinfo->icqinfo.crap, 0x25); |
2993 | 607 outinfo->present |= AIM_USERINFO_PRESENT_ICQDATA; |
2086 | 608 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
609 } else if (type == 0x000d) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
610 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
611 * Type = 0x000d |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
612 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
613 * Capability information. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
614 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
615 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
616 outinfo->capabilities = aim_getcap(sess, bs, length); |
2993 | 617 outinfo->present |= AIM_USERINFO_PRESENT_CAPABILITIES; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
618 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
619 } else if (type == 0x000e) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
620 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
621 * Type = 0x000e |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
622 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
623 * Unknown. Always of zero length, and always only |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
624 * on AOL users. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
625 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
626 * Ignore. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
627 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
628 */ |
2086 | 629 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
630 } else if ((type == 0x000f) || (type == 0x0010)) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
631 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
632 * Type = 0x000f: Session Length. (AIM) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
633 * Type = 0x0010: Session Length. (AOL) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
634 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
635 * The duration, in seconds, of the user's current |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
636 * session. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
637 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
638 * Which TLV type this comes in depends on the |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
639 * service the user is using (AIM or AOL). |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
640 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
641 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
642 outinfo->sessionlen = aimbs_get32(bs); |
2993 | 643 outinfo->present |= AIM_USERINFO_PRESENT_SESSIONLEN; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
644 |
5917 | 645 } else if (type == 0x0019) { |
646 faimdprintf(sess, 0, "userinfo: **warning: unexpected TLV type 0x0019: from %s\n", outinfo->sn); | |
647 | |
3459 | 648 } else if (type == 0x001d) { |
649 /* | |
4804 | 650 * Type = 0x001d |
3459 | 651 * |
5836 | 652 * Buddy icon information and available messages. |
653 * | |
654 * This almost seems like the AIM protocol guys gave | |
655 * the iChat guys a Type, and the iChat guys tried to | |
656 * cram as much cool shit into it as possible. Then | |
657 * the Windows AIM guys were like, "hey, that's | |
658 * pretty neat, let's copy those prawns." | |
659 * | |
660 * In that spirit, this can contain a custom message, | |
661 * kind of like an away message, but you're not away | |
662 * (it's called an "available" message). Or it can | |
663 * contain information about the buddy icon the user | |
664 * has stored on the server. | |
3459 | 665 */ |
5836 | 666 int type2, number, length2; |
4853 | 667 |
4826 | 668 while (aim_bstream_curpos(bs) < endpos) { |
5836 | 669 type2 = aimbs_get16(bs); |
4853 | 670 number = aimbs_get8(bs); |
5836 | 671 length2 = aimbs_get8(bs); |
672 | |
673 switch (type2) { | |
674 case 0x0000: { /* This is an official buddy icon? */ | |
675 /* This is always 5 bytes? */ | |
676 aim_bstream_advance(bs, length2); | |
677 } break; | |
678 | |
679 case 0x0001: { /* A buddy icon checksum */ | |
680 if ((length2 > 0) && (number == 0x01)) { | |
681 free(outinfo->iconcsum); | |
682 outinfo->iconcsum = aimbs_getraw(bs, length2); | |
683 outinfo->iconcsumlen = length2; | |
684 } else | |
685 aim_bstream_advance(bs, length2); | |
686 } break; | |
687 | |
688 case 0x0002: { /* An available message */ | |
689 if (length2 > 4) { | |
690 free(outinfo->availablemsg); | |
691 outinfo->availablemsg = aimbs_getstr(bs, aimbs_get16(bs)); | |
692 } else | |
693 aim_bstream_advance(bs, length2); | |
694 } break; | |
695 | |
696 default: { | |
697 aim_bstream_advance(bs, length2); | |
698 } break; | |
699 } | |
4809 | 700 } |
3459 | 701 |
702 } else if (type == 0x001e) { | |
703 /* | |
704 * Type 30: Unknown. | |
705 * | |
706 * Always four bytes, but it doesn't look like an int. | |
707 */ | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
708 } else { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
709 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
710 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
711 * Reaching here indicates that either AOL has |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
712 * added yet another TLV for us to deal with, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
713 * or the parsing has gone Terribly Wrong. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
714 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
715 * Either way, inform the owner and attempt |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
716 * recovery. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
717 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
718 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
719 faimdprintf(sess, 0, "userinfo: **warning: unexpected TLV:\n"); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
720 faimdprintf(sess, 0, "userinfo: sn =%s\n", outinfo->sn); |
3459 | 721 dumptlv(sess, type, bs, length); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
722 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
723 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
724 /* Save ourselves. */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
725 aim_bstream_setpos(bs, endpos); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
726 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
727 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
728 return 0; |
2086 | 729 } |
730 | |
731 /* | |
5836 | 732 * Inverse of aim_info_extract() |
2086 | 733 */ |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
734 faim_internal int aim_putuserinfo(aim_bstream_t *bs, aim_userinfo_t *info) |
2086 | 735 { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
736 aim_tlvlist_t *tlvlist = NULL; |
2086 | 737 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
738 if (!bs || !info) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
739 return -EINVAL; |
2086 | 740 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
741 aimbs_put8(bs, strlen(info->sn)); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
742 aimbs_putraw(bs, info->sn, strlen(info->sn)); |
2086 | 743 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
744 aimbs_put16(bs, info->warnlevel); |
2086 | 745 |
746 | |
3459 | 747 if (info->present & AIM_USERINFO_PRESENT_FLAGS) |
748 aim_addtlvtochain16(&tlvlist, 0x0001, info->flags); | |
749 if (info->present & AIM_USERINFO_PRESENT_MEMBERSINCE) | |
750 aim_addtlvtochain32(&tlvlist, 0x0002, info->membersince); | |
751 if (info->present & AIM_USERINFO_PRESENT_ONLINESINCE) | |
752 aim_addtlvtochain32(&tlvlist, 0x0003, info->onlinesince); | |
753 if (info->present & AIM_USERINFO_PRESENT_IDLE) | |
754 aim_addtlvtochain16(&tlvlist, 0x0004, info->idletime); | |
2086 | 755 |
3952 | 756 /* XXX - So, ICQ_OSCAR_SUPPORT is never defined anywhere... */ |
2086 | 757 #if ICQ_OSCAR_SUPPORT |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
758 if (atoi(info->sn) != 0) { |
3459 | 759 if (info->present & AIM_USERINFO_PRESENT_ICQEXTSTATUS) |
760 aim_addtlvtochain16(&tlvlist, 0x0006, info->icqinfo.status); | |
761 if (info->present & AIM_USERINFO_PRESENT_ICQIPADDR) | |
762 aim_addtlvtochain32(&tlvlist, 0x000a, info->icqinfo.ipaddr); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
763 } |
2086 | 764 #endif |
765 | |
3459 | 766 if (info->present & AIM_USERINFO_PRESENT_CAPABILITIES) |
767 aim_addtlvtochain_caps(&tlvlist, 0x000d, info->capabilities); | |
768 | |
769 if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN) | |
770 aim_addtlvtochain32(&tlvlist, (fu16_t)((info->flags & AIM_FLAG_AOL) ? 0x0010 : 0x000f), info->sessionlen); | |
2086 | 771 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
772 aimbs_put16(bs, aim_counttlvchain(&tlvlist)); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
773 aim_writetlvchain(bs, &tlvlist); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
774 aim_freetlvchain(&tlvlist); |
2086 | 775 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
776 return 0; |
2086 | 777 } |
778 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
779 /* |
3952 | 780 * Subtype 0x000b - Huh? What is this? |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
781 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
782 faim_export int aim_0002_000b(aim_session_t *sess, aim_conn_t *conn, const char *sn) |
2086 | 783 { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
784 aim_frame_t *fr; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
785 aim_snacid_t snacid; |
2086 | 786 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
787 if (!sess || !conn || !sn) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
788 return -EINVAL; |
2086 | 789 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
790 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+1+strlen(sn)))) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
791 return -ENOMEM; |
2086 | 792 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
793 snacid = aim_cachesnac(sess, 0x0002, 0x000b, 0x0000, NULL, 0); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
794 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
795 aim_putsnac(&fr->data, 0x0002, 0x000b, 0x0000, snacid); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
796 aimbs_put8(&fr->data, strlen(sn)); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
797 aimbs_putraw(&fr->data, sn, strlen(sn)); |
2086 | 798 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
799 aim_tx_enqueue(sess, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
800 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
801 return 0; |
2086 | 802 } |
803 | |
2122 | 804 /* |
3952 | 805 * Subtype 0x0003 |
806 * | |
2122 | 807 * Normally contains: |
808 * t(0001) - short containing max profile length (value = 1024) | |
809 * t(0002) - short - unknown (value = 16) [max MIME type length?] | |
2315
7ec21662ffc2
[gaim-migrate @ 2325]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
810 * t(0003) - short - unknown (value = 10) |
3213 | 811 * t(0004) - short - unknown (value = 2048) [ICQ only?] |
2122 | 812 */ |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
813 static int rights(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) |
2086 | 814 { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
815 aim_tlvlist_t *tlvlist; |
2122 | 816 aim_rxcallback_t userfunc; |
817 int ret = 0; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
818 fu16_t maxsiglen = 0; |
2086 | 819 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
820 tlvlist = aim_readtlvchain(bs); |
2086 | 821 |
2122 | 822 if (aim_gettlv(tlvlist, 0x0001, 1)) |
823 maxsiglen = aim_gettlv16(tlvlist, 0x0001, 1); | |
2086 | 824 |
2122 | 825 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) |
826 ret = userfunc(sess, rx, maxsiglen); | |
2086 | 827 |
2122 | 828 aim_freetlvchain(&tlvlist); |
829 | |
830 return ret; | |
2086 | 831 } |
832 | |
3952 | 833 /* Subtype 0x0006 */ |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
834 static int userinfo(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) |
2086 | 835 { |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
836 aim_userinfo_t userinfo; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
837 char *text_encoding = NULL, *text = NULL; |
4151 | 838 int textlen = 0; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
839 aim_rxcallback_t userfunc; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
840 aim_tlvlist_t *tlvlist; |
4151 | 841 aim_tlv_t *text_tlv = NULL; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
842 aim_snac_t *origsnac = NULL; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
843 struct aim_priv_inforeq *inforeq; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
844 int ret = 0; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
845 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
846 origsnac = aim_remsnac(sess, snac->id); |
2086 | 847 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
848 if (!origsnac || !origsnac->data) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
849 faimdprintf(sess, 0, "parse_userinfo_middle: major problem: no snac stored!\n"); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
850 return 0; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
851 } |
2086 | 852 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
853 inforeq = (struct aim_priv_inforeq *)origsnac->data; |
2086 | 854 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
855 if ((inforeq->infotype != AIM_GETINFO_GENERALINFO) && |
2920 | 856 (inforeq->infotype != AIM_GETINFO_AWAYMESSAGE) && |
857 (inforeq->infotype != AIM_GETINFO_CAPABILITIES)) { | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
858 faimdprintf(sess, 0, "parse_userinfo_middle: unknown infotype in request! (0x%04x)\n", inforeq->infotype); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
859 return 0; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
860 } |
2086 | 861 |
5836 | 862 aim_info_extract(sess, bs, &userinfo); |
2086 | 863 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
864 tlvlist = aim_readtlvchain(bs); |
2086 | 865 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
866 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
867 * Depending on what informational text was requested, different |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
868 * TLVs will appear here. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
869 * |
2920 | 870 * Profile will be 1 and 2, away message will be 3 and 4, caps |
871 * will be 5. | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
872 */ |
2920 | 873 if (inforeq->infotype == AIM_GETINFO_GENERALINFO) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
874 text_encoding = aim_gettlv_str(tlvlist, 0x0001, 1); |
4151 | 875 text_tlv = aim_gettlv(tlvlist, 0x0002, 1); |
2920 | 876 } else if (inforeq->infotype == AIM_GETINFO_AWAYMESSAGE) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
877 text_encoding = aim_gettlv_str(tlvlist, 0x0003, 1); |
4151 | 878 text_tlv = aim_gettlv(tlvlist, 0x0004, 1); |
2920 | 879 } else if (inforeq->infotype == AIM_GETINFO_CAPABILITIES) { |
880 aim_tlv_t *ct; | |
881 | |
882 if ((ct = aim_gettlv(tlvlist, 0x0005, 1))) { | |
883 aim_bstream_t cbs; | |
884 | |
885 aim_bstream_init(&cbs, ct->value, ct->length); | |
886 | |
887 userinfo.capabilities = aim_getcap(sess, &cbs, ct->length); | |
2993 | 888 userinfo.present = AIM_USERINFO_PRESENT_CAPABILITIES; |
2920 | 889 } |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
890 } |
2086 | 891 |
4151 | 892 if (text_tlv) { |
893 text = text_tlv->value; | |
894 textlen = text_tlv->length; | |
895 } | |
896 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
897 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) |
4151 | 898 ret = userfunc(sess, rx, &userinfo, inforeq->infotype, text_encoding, text, textlen); |
2086 | 899 |
5836 | 900 aim_info_free(&userinfo); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
901 free(text_encoding); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
902 aim_freetlvchain(&tlvlist); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
903 if (origsnac) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
904 free(origsnac->data); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
905 free(origsnac); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
906 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
907 return ret; |
2086 | 908 } |
909 | |
3952 | 910 /* |
911 * Subtype 0x0009 - Set directory profile data. | |
912 * | |
913 * This is not the same as aim_bos_setprofile! | |
914 * privacy: 1 to allow searching, 0 to disallow. | |
915 * | |
916 */ | |
917 faim_export int aim_setdirectoryinfo(aim_session_t *sess, aim_conn_t *conn, const char *first, const char *middle, const char *last, const char *maiden, const char *nickname, const char *street, const char *city, const char *state, const char *zip, int country, fu16_t privacy) | |
918 { | |
919 aim_frame_t *fr; | |
920 aim_snacid_t snacid; | |
921 aim_tlvlist_t *tl = NULL; | |
922 | |
923 aim_addtlvtochain16(&tl, 0x000a, privacy); | |
924 | |
925 if (first) | |
926 aim_addtlvtochain_raw(&tl, 0x0001, strlen(first), first); | |
927 if (last) | |
928 aim_addtlvtochain_raw(&tl, 0x0002, strlen(last), last); | |
929 if (middle) | |
930 aim_addtlvtochain_raw(&tl, 0x0003, strlen(middle), middle); | |
931 if (maiden) | |
932 aim_addtlvtochain_raw(&tl, 0x0004, strlen(maiden), maiden); | |
933 | |
934 if (state) | |
935 aim_addtlvtochain_raw(&tl, 0x0007, strlen(state), state); | |
936 if (city) | |
937 aim_addtlvtochain_raw(&tl, 0x0008, strlen(city), city); | |
938 | |
939 if (nickname) | |
940 aim_addtlvtochain_raw(&tl, 0x000c, strlen(nickname), nickname); | |
941 if (zip) | |
942 aim_addtlvtochain_raw(&tl, 0x000d, strlen(zip), zip); | |
943 | |
944 if (street) | |
945 aim_addtlvtochain_raw(&tl, 0x0021, strlen(street), street); | |
946 | |
947 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+aim_sizetlvchain(&tl)))) | |
948 return -ENOMEM; | |
949 | |
950 snacid = aim_cachesnac(sess, 0x0002, 0x0009, 0x0000, NULL, 0); | |
951 | |
952 aim_putsnac(&fr->data, 0x0002, 0x0009, 0x0000, snacid); | |
953 aim_writetlvchain(&fr->data, &tl); | |
954 aim_freetlvchain(&tl); | |
955 | |
956 aim_tx_enqueue(sess, fr); | |
957 | |
958 return 0; | |
959 } | |
960 | |
961 /* | |
962 * Subtype 0x000f | |
963 * | |
964 * XXX pass these in better | |
965 * | |
966 */ | |
967 faim_export int aim_setuserinterests(aim_session_t *sess, aim_conn_t *conn, const char *interest1, const char *interest2, const char *interest3, const char *interest4, const char *interest5, fu16_t privacy) | |
968 { | |
969 aim_frame_t *fr; | |
970 aim_snacid_t snacid; | |
971 aim_tlvlist_t *tl = NULL; | |
972 | |
973 /* ?? privacy ?? */ | |
974 aim_addtlvtochain16(&tl, 0x000a, privacy); | |
975 | |
976 if (interest1) | |
977 aim_addtlvtochain_raw(&tl, 0x0000b, strlen(interest1), interest1); | |
978 if (interest2) | |
979 aim_addtlvtochain_raw(&tl, 0x0000b, strlen(interest2), interest2); | |
980 if (interest3) | |
981 aim_addtlvtochain_raw(&tl, 0x0000b, strlen(interest3), interest3); | |
982 if (interest4) | |
983 aim_addtlvtochain_raw(&tl, 0x0000b, strlen(interest4), interest4); | |
984 if (interest5) | |
985 aim_addtlvtochain_raw(&tl, 0x0000b, strlen(interest5), interest5); | |
986 | |
987 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+aim_sizetlvchain(&tl)))) | |
988 return -ENOMEM; | |
989 | |
990 snacid = aim_cachesnac(sess, 0x0002, 0x000f, 0x0000, NULL, 0); | |
991 | |
992 aim_putsnac(&fr->data, 0x0002, 0x000f, 0x0000, 0); | |
993 aim_writetlvchain(&fr->data, &tl); | |
994 aim_freetlvchain(&tl); | |
995 | |
996 aim_tx_enqueue(sess, fr); | |
997 | |
998 return 0; | |
999 } | |
1000 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
1001 static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) |
2086 | 1002 { |
1003 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
1004 if (snac->subtype == 0x0003) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
1005 return rights(sess, mod, rx, snac, bs); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
1006 else if (snac->subtype == 0x0006) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
1007 return userinfo(sess, mod, rx, snac, bs); |
2086 | 1008 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
1009 return 0; |
2086 | 1010 } |
1011 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
1012 faim_internal int locate_modfirst(aim_session_t *sess, aim_module_t *mod) |
2086 | 1013 { |
1014 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
1015 mod->family = 0x0002; |
2672 | 1016 mod->version = 0x0001; |
4071 | 1017 mod->toolid = 0x0110; |
1018 mod->toolversion = 0x0629; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
1019 mod->flags = 0; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
1020 strncpy(mod->name, "locate", sizeof(mod->name)); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
1021 mod->snachandler = snachandler; |
2086 | 1022 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
1023 return 0; |
2086 | 1024 } |