annotate src/protocols/oscar/info.c @ 6572:4f097c1069b0

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