annotate src/protocols/oscar/info.c @ 3717:988485669631

[gaim-migrate @ 3850] Warning fixes and WIN32 ifdef removals committer: Tailor Script <tailor@pidgin.im>
author Herman Bloggs <hermanator12002@yahoo.com>
date Wed, 16 Oct 2002 19:57:03 +0000
parents d82f53194f09
children 07283934dedd
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 /*
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2 * aim_info.c
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>
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
11
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
12 struct aim_priv_inforeq {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
13 char sn[MAXSNLEN+1];
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
14 fu16_t infotype;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
15 };
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
16
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
17 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
18 {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
19 struct aim_priv_inforeq privdata;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
20 aim_frame_t *fr;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
21 aim_snacid_t snacid;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
22
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
23 if (!sess || !conn || !sn)
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
24 return -EINVAL;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
25
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
26 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
27 return -ENOMEM;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
28
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
29 strncpy(privdata.sn, sn, sizeof(privdata.sn));
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
30 privdata.infotype = infotype;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
31 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
32
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
33 aim_putsnac(&fr->data, 0x0002, 0x0005, 0x0000, snacid);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
34 aimbs_put16(&fr->data, infotype);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
35 aimbs_put8(&fr->data, strlen(sn));
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
36 aimbs_putraw(&fr->data, sn, strlen(sn));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
37
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
38 aim_tx_enqueue(sess, fr);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
39
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
40 return 0;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
41 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
42
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
43 faim_export const char *aim_userinfo_sn(aim_userinfo_t *ui)
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
44 {
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
45
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
46 if (!ui)
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
47 return NULL;
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
48
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
49 return ui->sn;
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
50 }
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
51
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
52 faim_export fu16_t aim_userinfo_flags(aim_userinfo_t *ui)
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
53 {
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
54
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
55 if (!ui)
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
56 return 0;
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
57
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
58 return ui->flags;
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
59 }
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
60
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
61 faim_export fu16_t aim_userinfo_idle(aim_userinfo_t *ui)
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
62 {
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
63
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
64 if (!ui)
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
65 return 0;
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
66
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
67 return ui->idletime;
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
68 }
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
69
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
70 faim_export float aim_userinfo_warnlevel(aim_userinfo_t *ui)
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
71 {
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
72
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
73 if (!ui)
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
74 return 0.00;
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
75
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
76 return (ui->warnlevel / 10);
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
77 }
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
78
3459
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
79 faim_export time_t aim_userinfo_createtime(aim_userinfo_t *ui)
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
80 {
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
81
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
82 if (!ui)
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
83 return 0;
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
84
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
85 return (time_t)ui->createtime;
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
86 }
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
87
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
88 faim_export time_t aim_userinfo_membersince(aim_userinfo_t *ui)
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
89 {
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
90
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
91 if (!ui)
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
92 return 0;
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
93
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
94 return (time_t)ui->membersince;
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
95 }
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
96
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
97 faim_export time_t aim_userinfo_onlinesince(aim_userinfo_t *ui)
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
98 {
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
99
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
100 if (!ui)
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
101 return 0;
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
102
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
103 return (time_t)ui->onlinesince;
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
104 }
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
105
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
106 faim_export fu32_t aim_userinfo_sessionlen(aim_userinfo_t *ui)
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
107 {
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
108
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
109 if (!ui)
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
110 return 0;
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
111
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
112 return ui->sessionlen;
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
113 }
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
114
2866
6d62d4520460 [gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
115 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
116 {
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
117
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
118 if (!ui || !(ui->present & AIM_USERINFO_PRESENT_CAPABILITIES))
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
119 return -1;
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
120
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
121 return !!(ui->capabilities & cap);
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
122 }
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
123
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
124
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
125 /*
2866
6d62d4520460 [gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
126 * Capability blocks.
6d62d4520460 [gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
127 *
6d62d4520460 [gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
128 * These are CLSIDs. They should actually be of the form:
6d62d4520460 [gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
129 *
6d62d4520460 [gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
130 * {0x0946134b, 0x4c7f, 0x11d1,
6d62d4520460 [gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
131 * {0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}},
6d62d4520460 [gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
132 *
6d62d4520460 [gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
133 * But, eh.
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
134 */
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
135 static const struct {
2866
6d62d4520460 [gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
136 fu32_t flag;
6d62d4520460 [gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
137 fu8_t data[16];
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
138 } aim_caps[] = {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
139
2669
44773c4b0f16 [gaim-migrate @ 2682]
Adam Fritzler <mid@auk.cx>
parents: 2421
diff changeset
140 /*
44773c4b0f16 [gaim-migrate @ 2682]
Adam Fritzler <mid@auk.cx>
parents: 2421
diff changeset
141 * Chat is oddball.
44773c4b0f16 [gaim-migrate @ 2682]
Adam Fritzler <mid@auk.cx>
parents: 2421
diff changeset
142 */
44773c4b0f16 [gaim-migrate @ 2682]
Adam Fritzler <mid@auk.cx>
parents: 2421
diff changeset
143 {AIM_CAPS_CHAT,
44773c4b0f16 [gaim-migrate @ 2682]
Adam Fritzler <mid@auk.cx>
parents: 2421
diff changeset
144 {0x74, 0x8f, 0x24, 0x20, 0x62, 0x87, 0x11, 0xd1,
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
145 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
146
2669
44773c4b0f16 [gaim-migrate @ 2682]
Adam Fritzler <mid@auk.cx>
parents: 2421
diff changeset
147 /*
44773c4b0f16 [gaim-migrate @ 2682]
Adam Fritzler <mid@auk.cx>
parents: 2421
diff changeset
148 * These are mostly in order.
44773c4b0f16 [gaim-migrate @ 2682]
Adam Fritzler <mid@auk.cx>
parents: 2421
diff changeset
149 */
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
150 {AIM_CAPS_VOICE,
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
151 {0x09, 0x46, 0x13, 0x41, 0x4c, 0x7f, 0x11, 0xd1,
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
152 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
153
2669
44773c4b0f16 [gaim-migrate @ 2682]
Adam Fritzler <mid@auk.cx>
parents: 2421
diff changeset
154 {AIM_CAPS_SENDFILE,
44773c4b0f16 [gaim-migrate @ 2682]
Adam Fritzler <mid@auk.cx>
parents: 2421
diff changeset
155 {0x09, 0x46, 0x13, 0x43, 0x4c, 0x7f, 0x11, 0xd1,
44773c4b0f16 [gaim-migrate @ 2682]
Adam Fritzler <mid@auk.cx>
parents: 2421
diff changeset
156 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
44773c4b0f16 [gaim-migrate @ 2682]
Adam Fritzler <mid@auk.cx>
parents: 2421
diff changeset
157
44773c4b0f16 [gaim-migrate @ 2682]
Adam Fritzler <mid@auk.cx>
parents: 2421
diff changeset
158 /*
44773c4b0f16 [gaim-migrate @ 2682]
Adam Fritzler <mid@auk.cx>
parents: 2421
diff changeset
159 * Advertised by the EveryBuddy client.
44773c4b0f16 [gaim-migrate @ 2682]
Adam Fritzler <mid@auk.cx>
parents: 2421
diff changeset
160 */
2734
9fc65bb80596 [gaim-migrate @ 2747]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2672
diff changeset
161 {AIM_CAPS_ICQ,
2669
44773c4b0f16 [gaim-migrate @ 2682]
Adam Fritzler <mid@auk.cx>
parents: 2421
diff changeset
162 {0x09, 0x46, 0x13, 0x44, 0x4c, 0x7f, 0x11, 0xd1,
44773c4b0f16 [gaim-migrate @ 2682]
Adam Fritzler <mid@auk.cx>
parents: 2421
diff changeset
163 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
44773c4b0f16 [gaim-migrate @ 2682]
Adam Fritzler <mid@auk.cx>
parents: 2421
diff changeset
164
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
165 {AIM_CAPS_IMIMAGE,
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
166 {0x09, 0x46, 0x13, 0x45, 0x4c, 0x7f, 0x11, 0xd1,
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
167 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
168
2669
44773c4b0f16 [gaim-migrate @ 2682]
Adam Fritzler <mid@auk.cx>
parents: 2421
diff changeset
169 {AIM_CAPS_BUDDYICON,
44773c4b0f16 [gaim-migrate @ 2682]
Adam Fritzler <mid@auk.cx>
parents: 2421
diff changeset
170 {0x09, 0x46, 0x13, 0x46, 0x4c, 0x7f, 0x11, 0xd1,
44773c4b0f16 [gaim-migrate @ 2682]
Adam Fritzler <mid@auk.cx>
parents: 2421
diff changeset
171 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
44773c4b0f16 [gaim-migrate @ 2682]
Adam Fritzler <mid@auk.cx>
parents: 2421
diff changeset
172
44773c4b0f16 [gaim-migrate @ 2682]
Adam Fritzler <mid@auk.cx>
parents: 2421
diff changeset
173 {AIM_CAPS_SAVESTOCKS,
44773c4b0f16 [gaim-migrate @ 2682]
Adam Fritzler <mid@auk.cx>
parents: 2421
diff changeset
174 {0x09, 0x46, 0x13, 0x47, 0x4c, 0x7f, 0x11, 0xd1,
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
175 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
176
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
177 {AIM_CAPS_GETFILE,
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
178 {0x09, 0x46, 0x13, 0x48, 0x4c, 0x7f, 0x11, 0xd1,
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
179 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
180
2866
6d62d4520460 [gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
181 {AIM_CAPS_ICQSERVERRELAY,
6d62d4520460 [gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
182 {0x09, 0x46, 0x13, 0x49, 0x4c, 0x7f, 0x11, 0xd1,
6d62d4520460 [gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
183 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
6d62d4520460 [gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
184
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
185 /*
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
186 * 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
187 * 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
188 * 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
189 * matter which.
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
190 */
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
191 {AIM_CAPS_GAMES,
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
192 {0x09, 0x46, 0x13, 0x4a, 0x4c, 0x7f, 0x11, 0xd1,
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
193 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
194 {AIM_CAPS_GAMES2,
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
195 {0x09, 0x46, 0x13, 0x4a, 0x4c, 0x7f, 0x11, 0xd1,
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
196 0x22, 0x82, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
197
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
198 {AIM_CAPS_SENDBUDDYLIST,
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
199 {0x09, 0x46, 0x13, 0x4b, 0x4c, 0x7f, 0x11, 0xd1,
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
200 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
201
2866
6d62d4520460 [gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
202 {AIM_CAPS_ICQRTF,
6d62d4520460 [gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
203 {0x97, 0xb1, 0x27, 0x51, 0x24, 0x3c, 0x43, 0x34,
6d62d4520460 [gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
204 0xad, 0x22, 0xd6, 0xab, 0xf7, 0x3f, 0x14, 0x92}},
6d62d4520460 [gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
205
6d62d4520460 [gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
206 {AIM_CAPS_ICQUNKNOWN,
6d62d4520460 [gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
207 {0x2e, 0x7a, 0x64, 0x75, 0xfa, 0xdf, 0x4d, 0xc8,
6d62d4520460 [gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
208 0x88, 0x6f, 0xea, 0x35, 0x95, 0xfd, 0xb6, 0xdf}},
6d62d4520460 [gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
209
6d62d4520460 [gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
210 {AIM_CAPS_EMPTY,
6d62d4520460 [gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
211 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
6d62d4520460 [gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
212 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},
6d62d4520460 [gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
213
2920
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2919
diff changeset
214 {AIM_CAPS_TRILLIANCRYPT,
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2919
diff changeset
215 {0xf2, 0xe7, 0xc7, 0xf4, 0xfe, 0xad, 0x4d, 0xfb,
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2919
diff changeset
216 0xb2, 0x35, 0x36, 0x79, 0x8b, 0xdf, 0x00, 0x00}},
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2919
diff changeset
217
2979
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2920
diff changeset
218 {AIM_CAPS_APINFO,
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2920
diff changeset
219 {0xAA, 0x4A, 0x32, 0xB5,
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2920
diff changeset
220 0xF8, 0x84,
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2920
diff changeset
221 0x48, 0xc6,
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2920
diff changeset
222 0xA3, 0xD7,
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2920
diff changeset
223 0x8C, 0x50, 0x97, 0x19, 0xFD, 0x5B}},
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2920
diff changeset
224
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
225 {AIM_CAPS_LAST}
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
226 };
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
227
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
228 /*
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
229 * 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
230 * are not naturally bounded.
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
231 *
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
232 */
2866
6d62d4520460 [gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
233 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
234 {
2866
6d62d4520460 [gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
235 fu32_t flags = 0;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
236 int offset;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
237
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
238 for (offset = 0; aim_bstream_empty(bs) && (offset < len); offset += 0x10) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
239 fu8_t *cap;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
240 int i, identified;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
241
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
242 cap = aimbs_getraw(bs, 0x10);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
243
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
244 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
245
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
246 if (memcmp(&aim_caps[i].data, cap, 0x10) == 0) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
247 flags |= aim_caps[i].flag;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
248 identified++;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
249 break; /* should only match once... */
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
250
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
251 }
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
252 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
253
2920
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2919
diff changeset
254 if (!identified) {
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2919
diff changeset
255 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
256 cap[0], cap[1], cap[2], cap[3],
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2919
diff changeset
257 cap[4], cap[5],
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2919
diff changeset
258 cap[6], cap[7],
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2919
diff changeset
259 cap[8], cap[9],
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2919
diff changeset
260 cap[10], cap[11], cap[12], cap[13],
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2919
diff changeset
261 cap[14], cap[15]);
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2919
diff changeset
262 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
263
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
264 free(cap);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
265 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
266
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
267 return flags;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
268 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
269
2866
6d62d4520460 [gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2734
diff changeset
270 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
271 {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
272 int i;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
273
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
274 if (!bs)
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
275 return -EINVAL;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
276
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
277 for (i = 0; aim_bstream_empty(bs); i++) {
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
278
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
279 if (aim_caps[i].flag == AIM_CAPS_LAST)
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
280 break;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
281
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
282 if (caps & aim_caps[i].flag)
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
283 aimbs_putraw(bs, aim_caps[i].data, 0x10);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
284
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
285 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
286
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
287 return 0;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
288 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
289
3459
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
290 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
291 {
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
292 int i;
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
293
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
294 if (!sess || !bs || !len)
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
295 return;
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
296
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
297 faimdprintf(sess, 0, "userinfo: type =0x%04x\n", type);
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
298 faimdprintf(sess, 0, "userinfo: length=0x%04x\n", len);
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
299
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
300 faimdprintf(sess, 0, "userinfo: value:\n");
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
301
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
302 for (i = 0; i < len; i++) {
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
303 if ((i % 8) == 0)
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
304 faimdprintf(sess, 0, "\nuserinfo: ");
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
305
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
306 faimdprintf(sess, 0, "0x%2x ", aimbs_get8(bs));
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
307 }
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
308
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
309 faimdprintf(sess, 0, "\n");
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
310
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
311 return;
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
312 }
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
313
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
314 /*
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
315 * 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
316 * routine to extract it in its standard form.
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
317 */
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
318 faim_internal int aim_extractuserinfo(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
319 {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
320 int curtlv, tlvcnt;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
321 fu8_t snlen;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
322
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
323 if (!bs || !outinfo)
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
324 return -EINVAL;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
325
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
326 /* Clear out old data first */
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
327 memset(outinfo, 0x00, sizeof(aim_userinfo_t));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
328
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
329 /*
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
330 * Screen name. Stored as an unterminated string prepended with a
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
331 * byte containing its length.
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
332 */
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
333 snlen = aimbs_get8(bs);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
334 aimbs_getrawbuf(bs, outinfo->sn, snlen);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
335
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
336 /*
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
337 * Warning Level. Stored as an unsigned short.
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
338 */
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
339 outinfo->warnlevel = aimbs_get16(bs);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
340
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
341 /*
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
342 * TLV Count. Unsigned short representing the number of
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
343 * Type-Length-Value triples that follow.
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
344 */
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
345 tlvcnt = aimbs_get16(bs);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
346
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
347 /*
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
348 * Parse out the Type-Length-Value triples as they're found.
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
349 */
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
350 for (curtlv = 0; curtlv < tlvcnt; curtlv++) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
351 int endpos;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
352 fu16_t type, length;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
353
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
354 type = aimbs_get16(bs);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
355 length = aimbs_get16(bs);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
356
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
357 endpos = aim_bstream_curpos(bs) + length;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
358
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
359 if (type == 0x0001) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
360 /*
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
361 * Type = 0x0001: User flags
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
362 *
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
363 * Specified as any of the following ORed together:
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
364 * 0x0001 Trial (user less than 60days)
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
365 * 0x0002 Unknown bit 2
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
366 * 0x0004 AOL Main Service user
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
367 * 0x0008 Unknown bit 4
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
368 * 0x0010 Free (AIM) user
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
369 * 0x0020 Away
2315
7ec21662ffc2 [gaim-migrate @ 2325]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
370 * 0x0400 ActiveBuddy
2246
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 */
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
373 outinfo->flags = aimbs_get16(bs);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
374 outinfo->present |= AIM_USERINFO_PRESENT_FLAGS;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
375
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
376 } else if (type == 0x0002) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
377 /*
3459
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
378 * Type = 0x0002: Account creation time.
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
379 *
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
380 * The time/date that the user originally registered for
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
381 * the service, stored in time_t format.
3459
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
382 *
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
383 * I'm not sure how this differs from type 5 ("member
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
384 * since").
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
385 *
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
386 * Note: This is the field formerly known as "member
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
387 * since". All these years and I finally found out
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
388 * that I got the name wrong.
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
389 */
3459
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
390 outinfo->createtime = aimbs_get32(bs);
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
391 outinfo->present |= AIM_USERINFO_PRESENT_CREATETIME;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
392
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
393 } else if (type == 0x0003) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
394 /*
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
395 * Type = 0x0003: On-Since date.
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
396 *
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
397 * The time/date that the user started their current
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
398 * session, stored in time_t format.
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
399 */
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
400 outinfo->onlinesince = aimbs_get32(bs);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
401 outinfo->present |= AIM_USERINFO_PRESENT_ONLINESINCE;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
402
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
403 } else if (type == 0x0004) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
404 /*
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
405 * Type = 0x0004: Idle time.
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
406 *
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
407 * Number of seconds since the user actively used the
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
408 * service.
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
409 *
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
410 * Note that the client tells the server when to start
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
411 * counting idle times, so this may or may not be
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
412 * related to reality.
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
413 */
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
414 outinfo->idletime = aimbs_get16(bs);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
415 outinfo->present |= AIM_USERINFO_PRESENT_IDLE;
3459
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
416 } else if (type == 0x0005) {
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
417 /*
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
418 * Type = 0x0005: Member since date.
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
419 *
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
420 * The time/date that the user originally registered for
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
421 * the service, stored in time_t format.
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
422 *
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
423 * This is sometimes sent instead of type 2 ("account
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
424 * creation time"), particularly in the self-info.
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
425 */
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
426 outinfo->membersince = aimbs_get32(bs);
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
427 outinfo->present |= AIM_USERINFO_PRESENT_MEMBERSINCE;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
428
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
429 } else if (type == 0x0006) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
430 /*
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
431 * Type = 0x0006: ICQ Online Status
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
432 *
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
433 * ICQ's Away/DND/etc "enriched" status. Some decoding
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
434 * of values done by Scott <darkagl@pcnet.com>
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
435 */
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
436 aimbs_get16(bs);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
437 outinfo->icqinfo.status = aimbs_get16(bs);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
438 outinfo->present |= AIM_USERINFO_PRESENT_ICQEXTSTATUS;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
439
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
440 } else if (type == 0x000a) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
441 /*
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
442 * Type = 0x000a
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
443 *
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
444 * ICQ User IP Address.
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
445 * Ahh, the joy of ICQ security.
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
446 */
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
447 outinfo->icqinfo.ipaddr = aimbs_get32(bs);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
448 outinfo->present |= AIM_USERINFO_PRESENT_ICQIPADDR;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
449
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
450 } else if (type == 0x000c) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
451 /*
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
452 * Type = 0x000c
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
453 *
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
454 * random crap containing the IP address,
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
455 * apparently a port number, and some Other Stuff.
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
456 *
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
457 */
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
458 aimbs_getrawbuf(bs, outinfo->icqinfo.crap, 0x25);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
459 outinfo->present |= AIM_USERINFO_PRESENT_ICQDATA;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
460
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
461 } else if (type == 0x000d) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
462 /*
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
463 * Type = 0x000d
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
464 *
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
465 * Capability information.
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
466 *
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
467 */
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
468 outinfo->capabilities = aim_getcap(sess, bs, length);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
469 outinfo->present |= AIM_USERINFO_PRESENT_CAPABILITIES;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
470
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
471 } else if (type == 0x000e) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
472 /*
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
473 * Type = 0x000e
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
474 *
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
475 * Unknown. Always of zero length, and always only
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
476 * on AOL users.
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
477 *
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
478 * Ignore.
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 */
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
481
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
482 } else if ((type == 0x000f) || (type == 0x0010)) {
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 * Type = 0x000f: Session Length. (AIM)
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
485 * Type = 0x0010: Session Length. (AOL)
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
486 *
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
487 * The duration, in seconds, of the user's current
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
488 * session.
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
489 *
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
490 * Which TLV type this comes in depends on the
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
491 * service the user is using (AIM or AOL).
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
492 *
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
493 */
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
494 outinfo->sessionlen = aimbs_get32(bs);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
495 outinfo->present |= AIM_USERINFO_PRESENT_SESSIONLEN;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
496
3459
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
497 } else if (type == 0x001d) {
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
498 /*
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
499 * Type 29: Unknown.
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
500 *
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
501 * Currently very rare. Always 18 bytes of mostly zero.
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
502 */
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
503
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
504 } else if (type == 0x001e) {
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
505 /*
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
506 * Type 30: Unknown.
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
507 *
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
508 * Always four bytes, but it doesn't look like an int.
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
509 */
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
510 } else {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
511
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
512 /*
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
513 * Reaching here indicates that either AOL has
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
514 * added yet another TLV for us to deal with,
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
515 * or the parsing has gone Terribly Wrong.
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
516 *
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
517 * Either way, inform the owner and attempt
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
518 * recovery.
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 */
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
521 faimdprintf(sess, 0, "userinfo: **warning: unexpected TLV:\n");
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
522 faimdprintf(sess, 0, "userinfo: sn =%s\n", outinfo->sn);
3459
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
523 dumptlv(sess, type, bs, length);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
524 }
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
525
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
526 /* Save ourselves. */
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
527 aim_bstream_setpos(bs, endpos);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
528 }
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
529
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
530 return 0;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
531 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
532
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
533 /*
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
534 * Inverse of aim_extractuserinfo()
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
535 */
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
536 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
537 {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
538 aim_tlvlist_t *tlvlist = NULL;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
539
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
540 if (!bs || !info)
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
541 return -EINVAL;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
542
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
543 aimbs_put8(bs, strlen(info->sn));
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
544 aimbs_putraw(bs, info->sn, strlen(info->sn));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
545
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
546 aimbs_put16(bs, info->warnlevel);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
547
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
548
3459
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
549 if (info->present & AIM_USERINFO_PRESENT_FLAGS)
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
550 aim_addtlvtochain16(&tlvlist, 0x0001, info->flags);
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
551 if (info->present & AIM_USERINFO_PRESENT_MEMBERSINCE)
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
552 aim_addtlvtochain32(&tlvlist, 0x0002, info->membersince);
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
553 if (info->present & AIM_USERINFO_PRESENT_ONLINESINCE)
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
554 aim_addtlvtochain32(&tlvlist, 0x0003, info->onlinesince);
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
555 if (info->present & AIM_USERINFO_PRESENT_IDLE)
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
556 aim_addtlvtochain16(&tlvlist, 0x0004, info->idletime);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
557
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
558 #if ICQ_OSCAR_SUPPORT
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
559 if (atoi(info->sn) != 0) {
3459
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
560 if (info->present & AIM_USERINFO_PRESENT_ICQEXTSTATUS)
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
561 aim_addtlvtochain16(&tlvlist, 0x0006, info->icqinfo.status);
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
562 if (info->present & AIM_USERINFO_PRESENT_ICQIPADDR)
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
563 aim_addtlvtochain32(&tlvlist, 0x000a, info->icqinfo.ipaddr);
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
564 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
565 #endif
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
566
3459
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
567 if (info->present & AIM_USERINFO_PRESENT_CAPABILITIES)
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
568 aim_addtlvtochain_caps(&tlvlist, 0x000d, info->capabilities);
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
569
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
570 if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN)
d82f53194f09 [gaim-migrate @ 3507]
Sean Egan <seanegan@gmail.com>
parents: 3213
diff changeset
571 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
572
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
573 aimbs_put16(bs, aim_counttlvchain(&tlvlist));
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
574 aim_writetlvchain(bs, &tlvlist);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
575 aim_freetlvchain(&tlvlist);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
576
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
577 return 0;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
578 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
579
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
580 faim_export int aim_sendbuddyoncoming(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *info)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
581 {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
582 aim_frame_t *fr;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
583 aim_snacid_t snacid;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
584
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
585 if (!sess || !conn || !info)
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
586 return -EINVAL;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
587
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
588 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 1152)))
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
589 return -ENOMEM;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
590
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
591 snacid = aim_cachesnac(sess, 0x0003, 0x000b, 0x0000, NULL, 0);
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 aim_putsnac(&fr->data, 0x0003, 0x000b, 0x0000, snacid);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
594 aim_putuserinfo(&fr->data, info);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
595
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
596 aim_tx_enqueue(sess, fr);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
597
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
598 return 0;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
599 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
600
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
601 faim_export int aim_sendbuddyoffgoing(aim_session_t *sess, aim_conn_t *conn, const char *sn)
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
602 {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
603 aim_frame_t *fr;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
604 aim_snacid_t snacid;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
605
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
606 if (!sess || !conn || !sn)
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
607 return -EINVAL;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
608
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
609 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
610 return -ENOMEM;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
611
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
612 snacid = aim_cachesnac(sess, 0x0003, 0x000c, 0x0000, NULL, 0);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
613
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
614 aim_putsnac(&fr->data, 0x0003, 0x000c, 0x0000, snacid);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
615 aimbs_put8(&fr->data, strlen(sn));
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
616 aimbs_putraw(&fr->data, sn, strlen(sn));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
617
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
618 aim_tx_enqueue(sess, fr);
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 return 0;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
621 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
622
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 * Huh? What is this?
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 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
627 {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
628 aim_frame_t *fr;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
629 aim_snacid_t snacid;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
630
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
631 if (!sess || !conn || !sn)
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
632 return -EINVAL;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
633
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
634 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
635 return -ENOMEM;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
636
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
637 snacid = aim_cachesnac(sess, 0x0002, 0x000b, 0x0000, NULL, 0);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
638
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
639 aim_putsnac(&fr->data, 0x0002, 0x000b, 0x0000, snacid);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
640 aimbs_put8(&fr->data, strlen(sn));
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
641 aimbs_putraw(&fr->data, sn, strlen(sn));
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
642
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
643 aim_tx_enqueue(sess, fr);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
644
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
645 return 0;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
646 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
647
2122
c99c781e5931 [gaim-migrate @ 2132]
Adam Fritzler <mid@auk.cx>
parents: 2086
diff changeset
648 /*
c99c781e5931 [gaim-migrate @ 2132]
Adam Fritzler <mid@auk.cx>
parents: 2086
diff changeset
649 * Normally contains:
c99c781e5931 [gaim-migrate @ 2132]
Adam Fritzler <mid@auk.cx>
parents: 2086
diff changeset
650 * t(0001) - short containing max profile length (value = 1024)
c99c781e5931 [gaim-migrate @ 2132]
Adam Fritzler <mid@auk.cx>
parents: 2086
diff changeset
651 * t(0002) - short - unknown (value = 16) [max MIME type length?]
2315
7ec21662ffc2 [gaim-migrate @ 2325]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2246
diff changeset
652 * t(0003) - short - unknown (value = 10)
3213
7ed9fa994055 [gaim-migrate @ 3230]
Sean Egan <seanegan@gmail.com>
parents: 2993
diff changeset
653 * t(0004) - short - unknown (value = 2048) [ICQ only?]
2122
c99c781e5931 [gaim-migrate @ 2132]
Adam Fritzler <mid@auk.cx>
parents: 2086
diff changeset
654 */
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
655 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
656 {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
657 aim_tlvlist_t *tlvlist;
2122
c99c781e5931 [gaim-migrate @ 2132]
Adam Fritzler <mid@auk.cx>
parents: 2086
diff changeset
658 aim_rxcallback_t userfunc;
c99c781e5931 [gaim-migrate @ 2132]
Adam Fritzler <mid@auk.cx>
parents: 2086
diff changeset
659 int ret = 0;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
660 fu16_t maxsiglen = 0;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
661
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
662 tlvlist = aim_readtlvchain(bs);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
663
2122
c99c781e5931 [gaim-migrate @ 2132]
Adam Fritzler <mid@auk.cx>
parents: 2086
diff changeset
664 if (aim_gettlv(tlvlist, 0x0001, 1))
c99c781e5931 [gaim-migrate @ 2132]
Adam Fritzler <mid@auk.cx>
parents: 2086
diff changeset
665 maxsiglen = aim_gettlv16(tlvlist, 0x0001, 1);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
666
2122
c99c781e5931 [gaim-migrate @ 2132]
Adam Fritzler <mid@auk.cx>
parents: 2086
diff changeset
667 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
c99c781e5931 [gaim-migrate @ 2132]
Adam Fritzler <mid@auk.cx>
parents: 2086
diff changeset
668 ret = userfunc(sess, rx, maxsiglen);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
669
2122
c99c781e5931 [gaim-migrate @ 2132]
Adam Fritzler <mid@auk.cx>
parents: 2086
diff changeset
670 aim_freetlvchain(&tlvlist);
c99c781e5931 [gaim-migrate @ 2132]
Adam Fritzler <mid@auk.cx>
parents: 2086
diff changeset
671
c99c781e5931 [gaim-migrate @ 2132]
Adam Fritzler <mid@auk.cx>
parents: 2086
diff changeset
672 return ret;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
673 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
674
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
675 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
676 {
2421
95b4ec08abec [gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2315
diff changeset
677 aim_userinfo_t userinfo;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
678 char *text_encoding = NULL, *text = NULL;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
679 aim_rxcallback_t userfunc;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
680 aim_tlvlist_t *tlvlist;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
681 aim_snac_t *origsnac = NULL;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
682 struct aim_priv_inforeq *inforeq;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
683 int ret = 0;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
684
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
685 origsnac = aim_remsnac(sess, snac->id);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
686
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
687 if (!origsnac || !origsnac->data) {
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
688 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
689 return 0;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
690 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
691
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
692 inforeq = (struct aim_priv_inforeq *)origsnac->data;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
693
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
694 if ((inforeq->infotype != AIM_GETINFO_GENERALINFO) &&
2920
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2919
diff changeset
695 (inforeq->infotype != AIM_GETINFO_AWAYMESSAGE) &&
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2919
diff changeset
696 (inforeq->infotype != AIM_GETINFO_CAPABILITIES)) {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
697 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
698 return 0;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
699 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
700
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
701 aim_extractuserinfo(sess, bs, &userinfo);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
702
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
703 tlvlist = aim_readtlvchain(bs);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
704
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
705 /*
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
706 * Depending on what informational text was requested, different
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
707 * TLVs will appear here.
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
708 *
2920
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2919
diff changeset
709 * 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
710 * will be 5.
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
711 */
2920
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2919
diff changeset
712 if (inforeq->infotype == AIM_GETINFO_GENERALINFO) {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
713 text_encoding = aim_gettlv_str(tlvlist, 0x0001, 1);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
714 text = aim_gettlv_str(tlvlist, 0x0002, 1);
2920
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2919
diff changeset
715 } else if (inforeq->infotype == AIM_GETINFO_AWAYMESSAGE) {
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
716 text_encoding = aim_gettlv_str(tlvlist, 0x0003, 1);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
717 text = aim_gettlv_str(tlvlist, 0x0004, 1);
2920
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2919
diff changeset
718 } else if (inforeq->infotype == AIM_GETINFO_CAPABILITIES) {
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2919
diff changeset
719 aim_tlv_t *ct;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2919
diff changeset
720
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2919
diff changeset
721 if ((ct = aim_gettlv(tlvlist, 0x0005, 1))) {
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2919
diff changeset
722 aim_bstream_t cbs;
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2919
diff changeset
723
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2919
diff changeset
724 aim_bstream_init(&cbs, ct->value, ct->length);
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2919
diff changeset
725
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2919
diff changeset
726 userinfo.capabilities = aim_getcap(sess, &cbs, ct->length);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
727 userinfo.present = AIM_USERINFO_PRESENT_CAPABILITIES;
2920
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2919
diff changeset
728 }
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
729 }
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
730
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
731 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
2920
4ed6fb39870b [gaim-migrate @ 2933]
Adam Fritzler <mid@auk.cx>
parents: 2919
diff changeset
732 ret = userfunc(sess, rx, &userinfo, inforeq->infotype, text_encoding, text);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
733
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
734 free(text_encoding);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
735 free(text);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
736
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
737 aim_freetlvchain(&tlvlist);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
738
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
739 if (origsnac)
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
740 free(origsnac->data);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
741 free(origsnac);
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 return ret;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
744 }
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
745
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
746 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
747 {
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
748
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
749 if (snac->subtype == 0x0003)
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
750 return rights(sess, mod, rx, snac, bs);
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
751 else if (snac->subtype == 0x0006)
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
752 return userinfo(sess, mod, rx, snac, bs);
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 return 0;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
755 }
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 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
758 {
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 mod->family = 0x0002;
2672
c41030cfed76 [gaim-migrate @ 2685]
Adam Fritzler <mid@auk.cx>
parents: 2669
diff changeset
761 mod->version = 0x0001;
c41030cfed76 [gaim-migrate @ 2685]
Adam Fritzler <mid@auk.cx>
parents: 2669
diff changeset
762 mod->toolid = 0x0101;
c41030cfed76 [gaim-migrate @ 2685]
Adam Fritzler <mid@auk.cx>
parents: 2669
diff changeset
763 mod->toolversion = 0x047b;
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
764 mod->flags = 0;
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
765 strncpy(mod->name, "locate", sizeof(mod->name));
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
766 mod->snachandler = snachandler;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
767
2246
933346315b9b [gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2122
diff changeset
768 return 0;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
769 }