annotate src/protocols/oscar/locate.c @ 13226:51dd24fd8290

[gaim-migrate @ 15591] Whitespace. I remember when this file was ~5000 lines. It's almost 9000 now. I should really do something about that. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sat, 11 Feb 2006 18:12:06 +0000
parents 46ba853a76b5
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
2 * Family 0x0002 - Locate.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
3 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
4 * The functions here are responsible for requesting and parsing information-
11253
7d31d61e6438 [gaim-migrate @ 13422]
Mark Doliner <mark@kingant.net>
parents: 11159
diff changeset
5 * gathering SNACs. Or something like that. This family contains the SNACs
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
6 * for getting and setting info, away messages, directory profile thingy, etc.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
7 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
8
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
9 #define FAIM_INTERNAL
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
10 #include <aim.h>
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
11 #ifdef _WIN32
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
12 #include "win32dep.h"
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
13 #endif
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
14
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
15 /*
11253
7d31d61e6438 [gaim-migrate @ 13422]
Mark Doliner <mark@kingant.net>
parents: 11159
diff changeset
16 * Capability blocks.
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
17 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
18 * These are CLSIDs. They should actually be of the form:
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
19 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
20 * {0x0946134b, 0x4c7f, 0x11d1,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
21 * {0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
22 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
23 * But, eh.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
24 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
25 static const struct {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
26 fu32_t flag;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
27 fu8_t data[16];
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
28 } aim_caps[] = {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
29
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
30 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
31 * These are in ascending numerical order.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
32 */
7253
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7235
diff changeset
33
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7235
diff changeset
34 /*
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7235
diff changeset
35 * Perhaps better called AIM_CAPS_SHORTCAPS
0ed4d53c46f9 [gaim-migrate @ 7830]
Mark Doliner <mark@kingant.net>
parents: 7235
diff changeset
36 */
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
37 {AIM_CAPS_ICHAT,
10436
08c8a18fb557 [gaim-migrate @ 11693]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
38 {0x09, 0x46, 0x00, 0x00, 0x4c, 0x7f, 0x11, 0xd1,
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
39 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
40
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
41 {AIM_CAPS_SECUREIM,
10436
08c8a18fb557 [gaim-migrate @ 11693]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
42 {0x09, 0x46, 0x00, 0x01, 0x4c, 0x7f, 0x11, 0xd1,
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
43 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
44
7582
3e0404393761 [gaim-migrate @ 8200]
Mark Doliner <mark@kingant.net>
parents: 7510
diff changeset
45 {AIM_CAPS_VIDEO,
10436
08c8a18fb557 [gaim-migrate @ 11693]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
46 {0x09, 0x46, 0x01, 0x00, 0x4c, 0x7f, 0x11, 0xd1,
7582
3e0404393761 [gaim-migrate @ 8200]
Mark Doliner <mark@kingant.net>
parents: 7510
diff changeset
47 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
3e0404393761 [gaim-migrate @ 8200]
Mark Doliner <mark@kingant.net>
parents: 7510
diff changeset
48
8092
697221d5d0ff [gaim-migrate @ 8791]
Mark Doliner <mark@kingant.net>
parents: 7945
diff changeset
49 /* "Live Video" support in Windows AIM 5.5.3501 and newer */
697221d5d0ff [gaim-migrate @ 8791]
Mark Doliner <mark@kingant.net>
parents: 7945
diff changeset
50 {AIM_CAPS_LIVEVIDEO,
10436
08c8a18fb557 [gaim-migrate @ 11693]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
51 {0x09, 0x46, 0x01, 0x01, 0x4c, 0x7f, 0x11, 0xd1,
8092
697221d5d0ff [gaim-migrate @ 8791]
Mark Doliner <mark@kingant.net>
parents: 7945
diff changeset
52 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
697221d5d0ff [gaim-migrate @ 8791]
Mark Doliner <mark@kingant.net>
parents: 7945
diff changeset
53
697221d5d0ff [gaim-migrate @ 8791]
Mark Doliner <mark@kingant.net>
parents: 7945
diff changeset
54 /* "Camera" support in Windows AIM 5.5.3501 and newer */
697221d5d0ff [gaim-migrate @ 8791]
Mark Doliner <mark@kingant.net>
parents: 7945
diff changeset
55 {AIM_CAPS_CAMERA,
10436
08c8a18fb557 [gaim-migrate @ 11693]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
56 {0x09, 0x46, 0x01, 0x02, 0x4c, 0x7f, 0x11, 0xd1,
8092
697221d5d0ff [gaim-migrate @ 8791]
Mark Doliner <mark@kingant.net>
parents: 7945
diff changeset
57 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
697221d5d0ff [gaim-migrate @ 8791]
Mark Doliner <mark@kingant.net>
parents: 7945
diff changeset
58
697221d5d0ff [gaim-migrate @ 8791]
Mark Doliner <mark@kingant.net>
parents: 7945
diff changeset
59 /* In Windows AIM 5.5.3501 and newer */
697221d5d0ff [gaim-migrate @ 8791]
Mark Doliner <mark@kingant.net>
parents: 7945
diff changeset
60 {AIM_CAPS_GENERICUNKNOWN,
10436
08c8a18fb557 [gaim-migrate @ 11693]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
61 {0x09, 0x46, 0x01, 0x03, 0x4c, 0x7f, 0x11, 0xd1,
8092
697221d5d0ff [gaim-migrate @ 8791]
Mark Doliner <mark@kingant.net>
parents: 7945
diff changeset
62 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
697221d5d0ff [gaim-migrate @ 8791]
Mark Doliner <mark@kingant.net>
parents: 7945
diff changeset
63
697221d5d0ff [gaim-migrate @ 8791]
Mark Doliner <mark@kingant.net>
parents: 7945
diff changeset
64 /* In iChatAV (version numbers...?) */
7945
0a0be07f066a [gaim-migrate @ 8619]
Mark Doliner <mark@kingant.net>
parents: 7582
diff changeset
65 {AIM_CAPS_ICHATAV,
10436
08c8a18fb557 [gaim-migrate @ 11693]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
66 {0x09, 0x46, 0x01, 0x05, 0x4c, 0x7f, 0x11, 0xd1,
7945
0a0be07f066a [gaim-migrate @ 8619]
Mark Doliner <mark@kingant.net>
parents: 7582
diff changeset
67 0x82, 0x22, 0x44, 0x45, 0x45, 0x53, 0x54, 0x00}},
0a0be07f066a [gaim-migrate @ 8619]
Mark Doliner <mark@kingant.net>
parents: 7582
diff changeset
68
7025
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
69 /*
11255
1b1d63602d77 [gaim-migrate @ 13429]
Mark Doliner <mark@kingant.net>
parents: 11253
diff changeset
70 * Not really sure about this one. In an email from
1b1d63602d77 [gaim-migrate @ 13429]
Mark Doliner <mark@kingant.net>
parents: 11253
diff changeset
71 * 26 Sep 2003, Matthew Sachs suggested that, "this
7025
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
72 * is probably the capability for the SMS features."
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
73 */
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
74 {AIM_CAPS_SMS,
10436
08c8a18fb557 [gaim-migrate @ 11693]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
75 {0x09, 0x46, 0x01, 0xff, 0x4c, 0x7f, 0x11, 0xd1,
7025
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
76 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
77
7091
7b31e3e22f59 [gaim-migrate @ 7656]
Mark Doliner <mark@kingant.net>
parents: 7046
diff changeset
78 {AIM_CAPS_GENERICUNKNOWN,
10436
08c8a18fb557 [gaim-migrate @ 11693]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
79 {0x09, 0x46, 0xf0, 0x03, 0x4c, 0x7f, 0x11, 0xd1,
7025
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
80 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
81
7091
7b31e3e22f59 [gaim-migrate @ 7656]
Mark Doliner <mark@kingant.net>
parents: 7046
diff changeset
82 {AIM_CAPS_GENERICUNKNOWN,
10436
08c8a18fb557 [gaim-migrate @ 11693]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
83 {0x09, 0x46, 0xf0, 0x04, 0x4c, 0x7f, 0x11, 0xd1,
7025
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
84 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
85
7091
7b31e3e22f59 [gaim-migrate @ 7656]
Mark Doliner <mark@kingant.net>
parents: 7046
diff changeset
86 {AIM_CAPS_GENERICUNKNOWN,
10436
08c8a18fb557 [gaim-migrate @ 11693]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
87 {0x09, 0x46, 0xf0, 0x05, 0x4c, 0x7f, 0x11, 0xd1,
7025
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
88 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
89
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
90 {AIM_CAPS_HIPTOP,
10436
08c8a18fb557 [gaim-migrate @ 11693]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
91 {0x09, 0x46, 0x13, 0x23, 0x4c, 0x7f, 0x11, 0xd1,
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
92 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
93
8092
697221d5d0ff [gaim-migrate @ 8791]
Mark Doliner <mark@kingant.net>
parents: 7945
diff changeset
94 {AIM_CAPS_TALK,
10436
08c8a18fb557 [gaim-migrate @ 11693]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
95 {0x09, 0x46, 0x13, 0x41, 0x4c, 0x7f, 0x11, 0xd1,
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
96 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
97
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
98 {AIM_CAPS_SENDFILE,
10436
08c8a18fb557 [gaim-migrate @ 11693]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
99 {0x09, 0x46, 0x13, 0x43, 0x4c, 0x7f, 0x11, 0xd1,
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
100 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
101
7141
af8ac078d4c2 [gaim-migrate @ 7708]
Mark Doliner <mark@kingant.net>
parents: 7091
diff changeset
102 {AIM_CAPS_ICQ_DIRECT,
10436
08c8a18fb557 [gaim-migrate @ 11693]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
103 {0x09, 0x46, 0x13, 0x44, 0x4c, 0x7f, 0x11, 0xd1,
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
104 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
105
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
106 {AIM_CAPS_DIRECTIM,
10436
08c8a18fb557 [gaim-migrate @ 11693]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
107 {0x09, 0x46, 0x13, 0x45, 0x4c, 0x7f, 0x11, 0xd1,
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
108 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
109
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
110 {AIM_CAPS_BUDDYICON,
10436
08c8a18fb557 [gaim-migrate @ 11693]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
111 {0x09, 0x46, 0x13, 0x46, 0x4c, 0x7f, 0x11, 0xd1,
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
112 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
113
8092
697221d5d0ff [gaim-migrate @ 8791]
Mark Doliner <mark@kingant.net>
parents: 7945
diff changeset
114 {AIM_CAPS_ADDINS,
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
115 {0x09, 0x46, 0x13, 0x47, 0x4c, 0x7f, 0x11, 0xd1,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
116 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
117
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
118 {AIM_CAPS_GETFILE,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
119 {0x09, 0x46, 0x13, 0x48, 0x4c, 0x7f, 0x11, 0xd1,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
120 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
121
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
122 {AIM_CAPS_ICQSERVERRELAY,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
123 {0x09, 0x46, 0x13, 0x49, 0x4c, 0x7f, 0x11, 0xd1,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
124 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
125
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
126 /*
11255
1b1d63602d77 [gaim-migrate @ 13429]
Mark Doliner <mark@kingant.net>
parents: 11253
diff changeset
127 * Indeed, there are two of these. The former appears to be correct,
1b1d63602d77 [gaim-migrate @ 13429]
Mark Doliner <mark@kingant.net>
parents: 11253
diff changeset
128 * but in some versions of winaim, the second one is set. Either they
1b1d63602d77 [gaim-migrate @ 13429]
Mark Doliner <mark@kingant.net>
parents: 11253
diff changeset
129 * forgot to fix endianness, or they made a typo. It really doesn't
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
130 * matter which.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
131 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
132 {AIM_CAPS_GAMES,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
133 {0x09, 0x46, 0x13, 0x4a, 0x4c, 0x7f, 0x11, 0xd1,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
134 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
135 {AIM_CAPS_GAMES2,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
136 {0x09, 0x46, 0x13, 0x4a, 0x4c, 0x7f, 0x11, 0xd1,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
137 0x22, 0x82, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
138
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
139 {AIM_CAPS_SENDBUDDYLIST,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
140 {0x09, 0x46, 0x13, 0x4b, 0x4c, 0x7f, 0x11, 0xd1,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
141 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
142
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
143 /*
11255
1b1d63602d77 [gaim-migrate @ 13429]
Mark Doliner <mark@kingant.net>
parents: 11253
diff changeset
144 * Setting this lets AIM users receive messages from ICQ users, and ICQ
1b1d63602d77 [gaim-migrate @ 13429]
Mark Doliner <mark@kingant.net>
parents: 11253
diff changeset
145 * users receive messages from AIM users. It also lets ICQ users show
1b1d63602d77 [gaim-migrate @ 13429]
Mark Doliner <mark@kingant.net>
parents: 11253
diff changeset
146 * up in buddy lists for AIM users, and AIM users show up in buddy lists
1b1d63602d77 [gaim-migrate @ 13429]
Mark Doliner <mark@kingant.net>
parents: 11253
diff changeset
147 * for ICQ users. And ICQ privacy/invisibility acts like AIM privacy,
1b1d63602d77 [gaim-migrate @ 13429]
Mark Doliner <mark@kingant.net>
parents: 11253
diff changeset
148 * in that if you add a user to your deny list, you will not be able to
1b1d63602d77 [gaim-migrate @ 13429]
Mark Doliner <mark@kingant.net>
parents: 11253
diff changeset
149 * see them as online (previous you could still see them, but they
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
150 * couldn't see you.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
151 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
152 {AIM_CAPS_INTEROPERATE,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
153 {0x09, 0x46, 0x13, 0x4d, 0x4c, 0x7f, 0x11, 0xd1,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
154 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
155
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
156 {AIM_CAPS_ICQUTF8,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
157 {0x09, 0x46, 0x13, 0x4e, 0x4c, 0x7f, 0x11, 0xd1,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
158 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
159
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
160 {AIM_CAPS_ICQUTF8OLD,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
161 {0x2e, 0x7a, 0x64, 0x75, 0xfa, 0xdf, 0x4d, 0xc8,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
162 0x88, 0x6f, 0xea, 0x35, 0x95, 0xfd, 0xb6, 0xdf}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
163
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
164 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
165 * Chat is oddball.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
166 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
167 {AIM_CAPS_CHAT,
10436
08c8a18fb557 [gaim-migrate @ 11693]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
168 {0x74, 0x8f, 0x24, 0x20, 0x62, 0x87, 0x11, 0xd1,
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
169 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
170
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
171 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
172 {AIM_CAPS_ICQ2GO,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
173 {0x56, 0x3f, 0xc8, 0x09, 0x0b, 0x6f, 0x41, 0xbd,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
174 0x9f, 0x79, 0x42, 0x26, 0x09, 0xdf, 0xa2, 0xf3}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
175 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
176
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
177 {AIM_CAPS_ICQRTF,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
178 {0x97, 0xb1, 0x27, 0x51, 0x24, 0x3c, 0x43, 0x34,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
179 0xad, 0x22, 0xd6, 0xab, 0xf7, 0x3f, 0x14, 0x92}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
180
7091
7b31e3e22f59 [gaim-migrate @ 7656]
Mark Doliner <mark@kingant.net>
parents: 7046
diff changeset
181 /* This is added by the servers and it only shows up for ourselves... */
7b31e3e22f59 [gaim-migrate @ 7656]
Mark Doliner <mark@kingant.net>
parents: 7046
diff changeset
182 {AIM_CAPS_GENERICUNKNOWN,
10436
08c8a18fb557 [gaim-migrate @ 11693]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
183 {0x97, 0xb1, 0x27, 0x51, 0x24, 0x3c, 0x43, 0x34,
7091
7b31e3e22f59 [gaim-migrate @ 7656]
Mark Doliner <mark@kingant.net>
parents: 7046
diff changeset
184 0xad, 0x22, 0xd6, 0xab, 0xf7, 0x3f, 0x14, 0x09}},
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
185
11255
1b1d63602d77 [gaim-migrate @ 13429]
Mark Doliner <mark@kingant.net>
parents: 11253
diff changeset
186 {AIM_CAPS_APINFO,
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
187 {0xaa, 0x4a, 0x32, 0xb5, 0xf8, 0x84, 0x48, 0xc6,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
188 0xa3, 0xd7, 0x8c, 0x50, 0x97, 0x19, 0xfd, 0x5b}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
189
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
190 {AIM_CAPS_TRILLIANCRYPT,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
191 {0xf2, 0xe7, 0xc7, 0xf4, 0xfe, 0xad, 0x4d, 0xfb,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
192 0xb2, 0x35, 0x36, 0x79, 0x8b, 0xdf, 0x00, 0x00}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
193
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
194 {AIM_CAPS_EMPTY,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
195 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
196 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
197
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12407
diff changeset
198 {AIM_CAPS_LAST,
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12407
diff changeset
199 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12407
diff changeset
200 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
201 };
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
202
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
203 /*
11255
1b1d63602d77 [gaim-migrate @ 13429]
Mark Doliner <mark@kingant.net>
parents: 11253
diff changeset
204 * Add the userinfo to our linked list. If we already have userinfo
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
205 * for this buddy, then just overwrite parts of the old data.
10436
08c8a18fb557 [gaim-migrate @ 11693]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
206 *
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
207 * @param userinfo Contains the new information for the buddy.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
208 */
7045
237ad253dd34 [gaim-migrate @ 7608]
Mark Doliner <mark@kingant.net>
parents: 7025
diff changeset
209 static void aim_locate_adduserinfo(aim_session_t *sess, aim_userinfo_t *userinfo) {
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
210 aim_userinfo_t *cur;
10436
08c8a18fb557 [gaim-migrate @ 11693]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
211 aim_conn_t *conn;
08c8a18fb557 [gaim-migrate @ 11693]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
212 aim_rxcallback_t userfunc;
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
213
7045
237ad253dd34 [gaim-migrate @ 7608]
Mark Doliner <mark@kingant.net>
parents: 7025
diff changeset
214 cur = aim_locate_finduserinfo(sess, userinfo->sn);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
215
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
216 if (cur == NULL) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
217 cur = (aim_userinfo_t *)calloc(1, sizeof(aim_userinfo_t));
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
218 cur->sn = strdup(userinfo->sn);
7045
237ad253dd34 [gaim-migrate @ 7608]
Mark Doliner <mark@kingant.net>
parents: 7025
diff changeset
219 cur->next = sess->locate.userinfo;
237ad253dd34 [gaim-migrate @ 7608]
Mark Doliner <mark@kingant.net>
parents: 7025
diff changeset
220 sess->locate.userinfo = cur;
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
221 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
222
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
223 cur->warnlevel = userinfo->warnlevel;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
224 cur->idletime = userinfo->idletime;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
225 if (userinfo->flags != 0)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
226 cur->flags = userinfo->flags;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
227 if (userinfo->createtime != 0)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
228 cur->createtime = userinfo->createtime;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
229 if (userinfo->membersince != 0)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
230 cur->membersince = userinfo->membersince;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
231 if (userinfo->onlinesince != 0)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
232 cur->onlinesince = userinfo->onlinesince;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
233 if (userinfo->sessionlen != 0)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
234 cur->sessionlen = userinfo->sessionlen;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
235 if (userinfo->capabilities != 0)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
236 cur->capabilities = userinfo->capabilities;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
237 cur->present |= userinfo->present;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
238
7046
4003419d753b [gaim-migrate @ 7609]
Mark Doliner <mark@kingant.net>
parents: 7045
diff changeset
239 if (userinfo->iconcsumlen > 0) {
4003419d753b [gaim-migrate @ 7609]
Mark Doliner <mark@kingant.net>
parents: 7045
diff changeset
240 free(cur->iconcsum);
4003419d753b [gaim-migrate @ 7609]
Mark Doliner <mark@kingant.net>
parents: 7045
diff changeset
241 cur->iconcsum = (fu8_t *)malloc(userinfo->iconcsumlen);
4003419d753b [gaim-migrate @ 7609]
Mark Doliner <mark@kingant.net>
parents: 7045
diff changeset
242 memcpy(cur->iconcsum, userinfo->iconcsum, userinfo->iconcsumlen);
4003419d753b [gaim-migrate @ 7609]
Mark Doliner <mark@kingant.net>
parents: 7045
diff changeset
243 cur->iconcsumlen = userinfo->iconcsumlen;
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
244 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
245
7301
0ed0ac132b1b [gaim-migrate @ 7885]
Mark Doliner <mark@kingant.net>
parents: 7282
diff changeset
246 if (userinfo->info != NULL) {
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
247 free(cur->info);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
248 free(cur->info_encoding);
8393
8deb49dea682 [gaim-migrate @ 9122]
Mark Doliner <mark@kingant.net>
parents: 8342
diff changeset
249 if (userinfo->info_len > 0) {
8deb49dea682 [gaim-migrate @ 9122]
Mark Doliner <mark@kingant.net>
parents: 8342
diff changeset
250 cur->info = (char *)malloc(userinfo->info_len);
8deb49dea682 [gaim-migrate @ 9122]
Mark Doliner <mark@kingant.net>
parents: 8342
diff changeset
251 memcpy(cur->info, userinfo->info, userinfo->info_len);
8394
a41efeb3a9ee [gaim-migrate @ 9123]
Mark Doliner <mark@kingant.net>
parents: 8393
diff changeset
252 } else
a41efeb3a9ee [gaim-migrate @ 9123]
Mark Doliner <mark@kingant.net>
parents: 8393
diff changeset
253 cur->info = NULL;
7235
03f22e564311 [gaim-migrate @ 7810]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
254 cur->info_encoding = strdup(userinfo->info_encoding);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
255 cur->info_len = userinfo->info_len;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
256 }
7046
4003419d753b [gaim-migrate @ 7609]
Mark Doliner <mark@kingant.net>
parents: 7045
diff changeset
257
13007
46ba853a76b5 [gaim-migrate @ 15360]
Mark Doliner <mark@kingant.net>
parents: 12600
diff changeset
258 if (userinfo->status != NULL) {
46ba853a76b5 [gaim-migrate @ 15360]
Mark Doliner <mark@kingant.net>
parents: 12600
diff changeset
259 free(cur->status);
46ba853a76b5 [gaim-migrate @ 15360]
Mark Doliner <mark@kingant.net>
parents: 12600
diff changeset
260 free(cur->status_encoding);
46ba853a76b5 [gaim-migrate @ 15360]
Mark Doliner <mark@kingant.net>
parents: 12600
diff changeset
261 if (userinfo->status_len > 0) {
46ba853a76b5 [gaim-migrate @ 15360]
Mark Doliner <mark@kingant.net>
parents: 12600
diff changeset
262 cur->status = (char *)malloc(userinfo->status_len);
46ba853a76b5 [gaim-migrate @ 15360]
Mark Doliner <mark@kingant.net>
parents: 12600
diff changeset
263 memcpy(cur->status, userinfo->status, userinfo->status_len);
46ba853a76b5 [gaim-migrate @ 15360]
Mark Doliner <mark@kingant.net>
parents: 12600
diff changeset
264 } else
46ba853a76b5 [gaim-migrate @ 15360]
Mark Doliner <mark@kingant.net>
parents: 12600
diff changeset
265 cur->status = NULL;
46ba853a76b5 [gaim-migrate @ 15360]
Mark Doliner <mark@kingant.net>
parents: 12600
diff changeset
266 if (userinfo->status_encoding != NULL)
46ba853a76b5 [gaim-migrate @ 15360]
Mark Doliner <mark@kingant.net>
parents: 12600
diff changeset
267 cur->status_encoding = strdup(userinfo->status_encoding);
46ba853a76b5 [gaim-migrate @ 15360]
Mark Doliner <mark@kingant.net>
parents: 12600
diff changeset
268 else
46ba853a76b5 [gaim-migrate @ 15360]
Mark Doliner <mark@kingant.net>
parents: 12600
diff changeset
269 cur->status_encoding = NULL;
46ba853a76b5 [gaim-migrate @ 15360]
Mark Doliner <mark@kingant.net>
parents: 12600
diff changeset
270 cur->status_len = userinfo->status_len;
46ba853a76b5 [gaim-migrate @ 15360]
Mark Doliner <mark@kingant.net>
parents: 12600
diff changeset
271 }
46ba853a76b5 [gaim-migrate @ 15360]
Mark Doliner <mark@kingant.net>
parents: 12600
diff changeset
272
7301
0ed0ac132b1b [gaim-migrate @ 7885]
Mark Doliner <mark@kingant.net>
parents: 7282
diff changeset
273 if (userinfo->away != NULL) {
7046
4003419d753b [gaim-migrate @ 7609]
Mark Doliner <mark@kingant.net>
parents: 7045
diff changeset
274 free(cur->away);
4003419d753b [gaim-migrate @ 7609]
Mark Doliner <mark@kingant.net>
parents: 7045
diff changeset
275 free(cur->away_encoding);
8393
8deb49dea682 [gaim-migrate @ 9122]
Mark Doliner <mark@kingant.net>
parents: 8342
diff changeset
276 if (userinfo->away_len > 0) {
8deb49dea682 [gaim-migrate @ 9122]
Mark Doliner <mark@kingant.net>
parents: 8342
diff changeset
277 cur->away = (char *)malloc(userinfo->away_len);
8deb49dea682 [gaim-migrate @ 9122]
Mark Doliner <mark@kingant.net>
parents: 8342
diff changeset
278 memcpy(cur->away, userinfo->away, userinfo->away_len);
8394
a41efeb3a9ee [gaim-migrate @ 9123]
Mark Doliner <mark@kingant.net>
parents: 8393
diff changeset
279 } else
a41efeb3a9ee [gaim-migrate @ 9123]
Mark Doliner <mark@kingant.net>
parents: 8393
diff changeset
280 cur->away = NULL;
7235
03f22e564311 [gaim-migrate @ 7810]
Mark Doliner <mark@kingant.net>
parents: 7167
diff changeset
281 cur->away_encoding = strdup(userinfo->away_encoding);
7046
4003419d753b [gaim-migrate @ 7609]
Mark Doliner <mark@kingant.net>
parents: 7045
diff changeset
282 cur->away_len = userinfo->away_len;
4003419d753b [gaim-migrate @ 7609]
Mark Doliner <mark@kingant.net>
parents: 7045
diff changeset
283 }
10436
08c8a18fb557 [gaim-migrate @ 11693]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
284
08c8a18fb557 [gaim-migrate @ 11693]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
285 /*
08c8a18fb557 [gaim-migrate @ 11693]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
286 * This callback can be used by a client if they want to know whenever
08c8a18fb557 [gaim-migrate @ 11693]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
287 * info for a buddy is updated. For example, if a client shows away
08c8a18fb557 [gaim-migrate @ 11693]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
288 * messages in its buddy list, then it would need to know if a user's
08c8a18fb557 [gaim-migrate @ 11693]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
289 * away message changes.
08c8a18fb557 [gaim-migrate @ 11693]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
290 */
08c8a18fb557 [gaim-migrate @ 11693]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
291 conn = aim_conn_findbygroup(sess, AIM_CB_FAM_LOC);
08c8a18fb557 [gaim-migrate @ 11693]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
292 if ((userfunc = aim_callhandler(sess, conn, AIM_CB_FAM_LOC, AIM_CB_LOC_GOTINFOBLOCK)))
08c8a18fb557 [gaim-migrate @ 11693]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
293 userfunc(sess, NULL, cur);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
294 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
295
8341
fec4c1fb2ac8 [gaim-migrate @ 9065]
Mark Doliner <mark@kingant.net>
parents: 8092
diff changeset
296 faim_export void aim_locate_dorequest(aim_session_t *sess) {
7466
fa0324675ed9 [gaim-migrate @ 8079]
Mark Doliner <mark@kingant.net>
parents: 7447
diff changeset
297 struct userinfo_node *cur = sess->locate.torequest;
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
298
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
299 if (cur == NULL)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
300 return;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
301
7045
237ad253dd34 [gaim-migrate @ 7608]
Mark Doliner <mark@kingant.net>
parents: 7025
diff changeset
302 if (sess->locate.waiting_for_response == TRUE)
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
303 return;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
304
7045
237ad253dd34 [gaim-migrate @ 7608]
Mark Doliner <mark@kingant.net>
parents: 7025
diff changeset
305 sess->locate.waiting_for_response = TRUE;
7166
e6b01bd8d6cd [gaim-migrate @ 7733]
Mark Doliner <mark@kingant.net>
parents: 7141
diff changeset
306 aim_locate_getinfoshort(sess, cur->sn, 0x00000003);
7466
fa0324675ed9 [gaim-migrate @ 8079]
Mark Doliner <mark@kingant.net>
parents: 7447
diff changeset
307
fa0324675ed9 [gaim-migrate @ 8079]
Mark Doliner <mark@kingant.net>
parents: 7447
diff changeset
308 /* Move this node to the "requested" queue */
fa0324675ed9 [gaim-migrate @ 8079]
Mark Doliner <mark@kingant.net>
parents: 7447
diff changeset
309 sess->locate.torequest = cur->next;
fa0324675ed9 [gaim-migrate @ 8079]
Mark Doliner <mark@kingant.net>
parents: 7447
diff changeset
310 cur->next = sess->locate.requested;
fa0324675ed9 [gaim-migrate @ 8079]
Mark Doliner <mark@kingant.net>
parents: 7447
diff changeset
311 sess->locate.requested = cur;
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
312 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
313
7447
0e7a835e2433 [gaim-migrate @ 8058]
Mark Doliner <mark@kingant.net>
parents: 7334
diff changeset
314 /**
11255
1b1d63602d77 [gaim-migrate @ 13429]
Mark Doliner <mark@kingant.net>
parents: 11253
diff changeset
315 * Remove this screen name from our queue. If this info was requested
7447
0e7a835e2433 [gaim-migrate @ 8058]
Mark Doliner <mark@kingant.net>
parents: 7334
diff changeset
316 * by our info request queue, then pop the next element off of the queue.
7259
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
317 *
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
318 * @param sess The aim session.
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
319 * @param sn Screen name of the info we just received.
11255
1b1d63602d77 [gaim-migrate @ 13429]
Mark Doliner <mark@kingant.net>
parents: 11253
diff changeset
320 * @return True if the request was explicit (client requested the info),
7259
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
321 * false if the request was implicit (libfaim request the info).
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
322 */
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
323 static int aim_locate_gotuserinfo(aim_session_t *sess, const char *sn) {
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
324 struct userinfo_node *cur, *del;
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
325 int was_explicit = TRUE;
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
326
7466
fa0324675ed9 [gaim-migrate @ 8079]
Mark Doliner <mark@kingant.net>
parents: 7447
diff changeset
327 while ((sess->locate.requested != NULL) && (aim_sncmp(sn, sess->locate.requested->sn) == 0)) {
fa0324675ed9 [gaim-migrate @ 8079]
Mark Doliner <mark@kingant.net>
parents: 7447
diff changeset
328 del = sess->locate.requested;
fa0324675ed9 [gaim-migrate @ 8079]
Mark Doliner <mark@kingant.net>
parents: 7447
diff changeset
329 sess->locate.requested = del->next;
7259
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
330 was_explicit = FALSE;
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
331 free(del->sn);
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
332 free(del);
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
333 }
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
334
7466
fa0324675ed9 [gaim-migrate @ 8079]
Mark Doliner <mark@kingant.net>
parents: 7447
diff changeset
335 cur = sess->locate.requested;
7259
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
336 while ((cur != NULL) && (cur->next != NULL)) {
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
337 if (aim_sncmp(sn, cur->next->sn) == 0) {
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
338 del = cur->next;
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
339 cur->next = del->next;
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
340 was_explicit = FALSE;
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
341 free(del->sn);
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
342 free(del);
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
343 } else
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
344 cur = cur->next;
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
345 }
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
346
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
347 if (!was_explicit) {
8341
fec4c1fb2ac8 [gaim-migrate @ 9065]
Mark Doliner <mark@kingant.net>
parents: 8092
diff changeset
348 aim_conn_t *conn = aim_conn_findbygroup(sess, AIM_CB_FAM_LOC);
fec4c1fb2ac8 [gaim-migrate @ 9065]
Mark Doliner <mark@kingant.net>
parents: 8092
diff changeset
349 aim_rxcallback_t userfunc;
fec4c1fb2ac8 [gaim-migrate @ 9065]
Mark Doliner <mark@kingant.net>
parents: 8092
diff changeset
350
7259
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
351 sess->locate.waiting_for_response = FALSE;
8341
fec4c1fb2ac8 [gaim-migrate @ 9065]
Mark Doliner <mark@kingant.net>
parents: 8092
diff changeset
352
fec4c1fb2ac8 [gaim-migrate @ 9065]
Mark Doliner <mark@kingant.net>
parents: 8092
diff changeset
353 if ((userfunc = aim_callhandler(sess, conn, AIM_CB_FAM_LOC, AIM_CB_LOC_REQUESTINFOTIMEOUT)))
fec4c1fb2ac8 [gaim-migrate @ 9065]
Mark Doliner <mark@kingant.net>
parents: 8092
diff changeset
354 userfunc(sess, NULL);
8342
59e83fdb753e [gaim-migrate @ 9066]
Mark Doliner <mark@kingant.net>
parents: 8341
diff changeset
355 else
59e83fdb753e [gaim-migrate @ 9066]
Mark Doliner <mark@kingant.net>
parents: 8341
diff changeset
356 aim_locate_dorequest(sess);
7259
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
357 }
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
358
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
359 return was_explicit;
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
360 }
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
361
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
362 faim_internal void aim_locate_requestuserinfo(aim_session_t *sess, const char *sn) {
7045
237ad253dd34 [gaim-migrate @ 7608]
Mark Doliner <mark@kingant.net>
parents: 7025
diff changeset
363 struct userinfo_node *cur;
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
364
7266
dc3918a729e8 [gaim-migrate @ 7843]
Mark Doliner <mark@kingant.net>
parents: 7259
diff changeset
365 /* Make sure we aren't already requesting info for this buddy */
7466
fa0324675ed9 [gaim-migrate @ 8079]
Mark Doliner <mark@kingant.net>
parents: 7447
diff changeset
366 cur = sess->locate.torequest;
7266
dc3918a729e8 [gaim-migrate @ 7843]
Mark Doliner <mark@kingant.net>
parents: 7259
diff changeset
367 while (cur != NULL) {
dc3918a729e8 [gaim-migrate @ 7843]
Mark Doliner <mark@kingant.net>
parents: 7259
diff changeset
368 if (aim_sncmp(sn, cur->sn) == 0)
dc3918a729e8 [gaim-migrate @ 7843]
Mark Doliner <mark@kingant.net>
parents: 7259
diff changeset
369 return;
dc3918a729e8 [gaim-migrate @ 7843]
Mark Doliner <mark@kingant.net>
parents: 7259
diff changeset
370 cur = cur->next;
dc3918a729e8 [gaim-migrate @ 7843]
Mark Doliner <mark@kingant.net>
parents: 7259
diff changeset
371 }
dc3918a729e8 [gaim-migrate @ 7843]
Mark Doliner <mark@kingant.net>
parents: 7259
diff changeset
372
dc3918a729e8 [gaim-migrate @ 7843]
Mark Doliner <mark@kingant.net>
parents: 7259
diff changeset
373 /* Add a new node to our request queue */
7045
237ad253dd34 [gaim-migrate @ 7608]
Mark Doliner <mark@kingant.net>
parents: 7025
diff changeset
374 cur = (struct userinfo_node *)malloc(sizeof(struct userinfo_node));
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
375 cur->sn = strdup(sn);
7466
fa0324675ed9 [gaim-migrate @ 8079]
Mark Doliner <mark@kingant.net>
parents: 7447
diff changeset
376 cur->next = sess->locate.torequest;
fa0324675ed9 [gaim-migrate @ 8079]
Mark Doliner <mark@kingant.net>
parents: 7447
diff changeset
377 sess->locate.torequest = cur;
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
378
7266
dc3918a729e8 [gaim-migrate @ 7843]
Mark Doliner <mark@kingant.net>
parents: 7259
diff changeset
379 /* Actually request some info up in this piece */
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
380 aim_locate_dorequest(sess);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
381 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
382
7045
237ad253dd34 [gaim-migrate @ 7608]
Mark Doliner <mark@kingant.net>
parents: 7025
diff changeset
383 faim_export aim_userinfo_t *aim_locate_finduserinfo(aim_session_t *sess, const char *sn) {
10116
9f358a718f38 [gaim-migrate @ 11153]
Stu Tomlinson <stu@nosnilmot.com>
parents: 8735
diff changeset
384 aim_userinfo_t *cur = NULL;
9f358a718f38 [gaim-migrate @ 11153]
Stu Tomlinson <stu@nosnilmot.com>
parents: 8735
diff changeset
385
9f358a718f38 [gaim-migrate @ 11153]
Stu Tomlinson <stu@nosnilmot.com>
parents: 8735
diff changeset
386 if (sn == NULL)
9f358a718f38 [gaim-migrate @ 11153]
Stu Tomlinson <stu@nosnilmot.com>
parents: 8735
diff changeset
387 return NULL;
9f358a718f38 [gaim-migrate @ 11153]
Stu Tomlinson <stu@nosnilmot.com>
parents: 8735
diff changeset
388
9f358a718f38 [gaim-migrate @ 11153]
Stu Tomlinson <stu@nosnilmot.com>
parents: 8735
diff changeset
389 cur = sess->locate.userinfo;
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
390
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
391 while (cur != NULL) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
392 if (aim_sncmp(cur->sn, sn) == 0)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
393 return cur;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
394 cur = cur->next;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
395 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
396
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
397 return NULL;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
398 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
399
7334
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
400 faim_internal fu32_t aim_locate_getcaps(aim_session_t *sess, aim_bstream_t *bs, int len)
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
401 {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
402 fu32_t flags = 0;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
403 int offset;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
404
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
405 for (offset = 0; aim_bstream_empty(bs) && (offset < len); offset += 0x10) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
406 fu8_t *cap;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
407 int i, identified;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
408
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
409 cap = aimbs_getraw(bs, 0x10);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
410
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
411 for (i = 0, identified = 0; !(aim_caps[i].flag & AIM_CAPS_LAST); i++) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
412 if (memcmp(&aim_caps[i].data, cap, 0x10) == 0) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
413 flags |= aim_caps[i].flag;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
414 identified++;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
415 break; /* should only match once... */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
416 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
417 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
418
7334
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
419 if (!identified)
11253
7d31d61e6438 [gaim-migrate @ 13422]
Mark Doliner <mark@kingant.net>
parents: 11159
diff changeset
420 gaim_debug_misc("oscar", "unknown capability: {%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n",
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
421 cap[0], cap[1], cap[2], cap[3],
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
422 cap[4], cap[5],
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
423 cap[6], cap[7],
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
424 cap[8], cap[9],
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
425 cap[10], cap[11], cap[12], cap[13],
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
426 cap[14], cap[15]);
7334
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
427
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
428 free(cap);
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
429 }
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
430
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
431 return flags;
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
432 }
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
433
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
434 faim_internal fu32_t aim_locate_getcaps_short(aim_session_t *sess, aim_bstream_t *bs, int len)
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
435 {
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
436 fu32_t flags = 0;
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
437 int offset;
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
438
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
439 for (offset = 0; aim_bstream_empty(bs) && (offset < len); offset += 0x02) {
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
440 fu8_t *cap;
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
441 int i, identified;
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
442
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
443 cap = aimbs_getraw(bs, 0x02);
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
444
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
445 for (i = 0, identified = 0; !(aim_caps[i].flag & AIM_CAPS_LAST); i++) {
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
446 if (memcmp(&aim_caps[i].data[2], cap, 0x02) == 0) {
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
447 flags |= aim_caps[i].flag;
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
448 identified++;
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
449 break; /* should only match once... */
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
450 }
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
451 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
452
7334
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
453 if (!identified)
11253
7d31d61e6438 [gaim-migrate @ 13422]
Mark Doliner <mark@kingant.net>
parents: 11159
diff changeset
454 gaim_debug_misc("oscar", "unknown short capability: {%02x%02x}\n", cap[0], cap[1]);
7334
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
455
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
456 free(cap);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
457 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
458
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
459 return flags;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
460 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
461
11285
bcd7bd6a42dd [gaim-migrate @ 13482]
Mark Doliner <mark@kingant.net>
parents: 11263
diff changeset
462 faim_internal int aimbs_putcaps(aim_bstream_t *bs, fu32_t caps)
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
463 {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
464 int i;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
465
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
466 if (!bs)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
467 return -EINVAL;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
468
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
469 for (i = 0; aim_bstream_empty(bs); i++) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
470
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
471 if (aim_caps[i].flag == AIM_CAPS_LAST)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
472 break;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
473
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
474 if (caps & aim_caps[i].flag)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
475 aimbs_putraw(bs, aim_caps[i].data, 0x10);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
476
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
477 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
478
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
479 return 0;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
480 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
481
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
482 static void dumptlv(aim_session_t *sess, fu16_t type, aim_bstream_t *bs, fu8_t len)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
483 {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
484 int i;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
485
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
486 if (!sess || !bs || !len)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
487 return;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
488
11253
7d31d61e6438 [gaim-migrate @ 13422]
Mark Doliner <mark@kingant.net>
parents: 11159
diff changeset
489 gaim_debug_misc("oscar", "userinfo: type =0x%04x\n", type);
7d31d61e6438 [gaim-migrate @ 13422]
Mark Doliner <mark@kingant.net>
parents: 11159
diff changeset
490 gaim_debug_misc("oscar", "userinfo: length=0x%04x\n", len);
7d31d61e6438 [gaim-migrate @ 13422]
Mark Doliner <mark@kingant.net>
parents: 11159
diff changeset
491 gaim_debug_misc("oscar", "userinfo: value:\n");
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
492
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
493 for (i = 0; i < len; i++) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
494 if ((i % 8) == 0)
11253
7d31d61e6438 [gaim-migrate @ 13422]
Mark Doliner <mark@kingant.net>
parents: 11159
diff changeset
495 gaim_debug_misc("oscar", "\nuserinfo: ");
7d31d61e6438 [gaim-migrate @ 13422]
Mark Doliner <mark@kingant.net>
parents: 11159
diff changeset
496 gaim_debug_misc("oscar", "0x%2x ", aimbs_get8(bs));
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
497 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
498
11253
7d31d61e6438 [gaim-migrate @ 13422]
Mark Doliner <mark@kingant.net>
parents: 11159
diff changeset
499 gaim_debug_misc("oscar", "\n");
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
500
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
501 return;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
502 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
503
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
504 faim_internal void aim_info_free(aim_userinfo_t *info)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
505 {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
506 free(info->sn);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
507 free(info->iconcsum);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
508 free(info->info);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
509 free(info->info_encoding);
12349
2a1961c1a345 [gaim-migrate @ 14653]
Mark Doliner <mark@kingant.net>
parents: 12307
diff changeset
510 free(info->status);
2a1961c1a345 [gaim-migrate @ 14653]
Mark Doliner <mark@kingant.net>
parents: 12307
diff changeset
511 free(info->status_encoding);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
512 free(info->away);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
513 free(info->away_encoding);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
514 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
515
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
516 /*
11255
1b1d63602d77 [gaim-migrate @ 13429]
Mark Doliner <mark@kingant.net>
parents: 11253
diff changeset
517 * AIM is fairly regular about providing user info. This is a generic
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
518 * routine to extract it in its standard form.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
519 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
520 faim_internal int aim_info_extract(aim_session_t *sess, aim_bstream_t *bs, aim_userinfo_t *outinfo)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
521 {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
522 int curtlv, tlvcnt;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
523 fu8_t snlen;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
524
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
525 if (!bs || !outinfo)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
526 return -EINVAL;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
527
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
528 /* Clear out old data first */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
529 memset(outinfo, 0x00, sizeof(aim_userinfo_t));
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
530
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
531 /*
11255
1b1d63602d77 [gaim-migrate @ 13429]
Mark Doliner <mark@kingant.net>
parents: 11253
diff changeset
532 * Screen name. Stored as an unterminated string prepended with a
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
533 * byte containing its length.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
534 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
535 snlen = aimbs_get8(bs);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
536 outinfo->sn = aimbs_getstr(bs, snlen);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
537
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
538 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
539 * Warning Level. Stored as an unsigned short.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
540 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
541 outinfo->warnlevel = aimbs_get16(bs);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
542
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
543 /*
11255
1b1d63602d77 [gaim-migrate @ 13429]
Mark Doliner <mark@kingant.net>
parents: 11253
diff changeset
544 * TLV Count. Unsigned short representing the number of
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
545 * Type-Length-Value triples that follow.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
546 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
547 tlvcnt = aimbs_get16(bs);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
548
11255
1b1d63602d77 [gaim-migrate @ 13429]
Mark Doliner <mark@kingant.net>
parents: 11253
diff changeset
549 /*
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
550 * Parse out the Type-Length-Value triples as they're found.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
551 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
552 for (curtlv = 0; curtlv < tlvcnt; curtlv++) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
553 int endpos;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
554 fu16_t type, length;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
555
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
556 type = aimbs_get16(bs);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
557 length = aimbs_get16(bs);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
558
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
559 endpos = aim_bstream_curpos(bs) + length;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
560
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
561 if (type == 0x0001) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
562 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
563 * Type = 0x0001: User flags
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
564 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
565 * Specified as any of the following ORed together:
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
566 * 0x0001 Trial (user less than 60days)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
567 * 0x0002 Unknown bit 2
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
568 * 0x0004 AOL Main Service user
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
569 * 0x0008 Unknown bit 4
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
570 * 0x0010 Free (AIM) user
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
571 * 0x0020 Away
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
572 * 0x0400 ActiveBuddy
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
573 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
574 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
575 outinfo->flags = aimbs_get16(bs);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
576 outinfo->present |= AIM_USERINFO_PRESENT_FLAGS;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
577
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
578 } else if (type == 0x0002) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
579 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
580 * Type = 0x0002: Account creation time.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
581 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
582 * The time/date that the user originally registered for
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
583 * the service, stored in time_t format.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
584 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
585 * I'm not sure how this differs from type 5 ("member
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
586 * since").
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
587 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
588 * Note: This is the field formerly known as "member
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
589 * since". All these years and I finally found out
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
590 * that I got the name wrong.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
591 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
592 outinfo->createtime = aimbs_get32(bs);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
593 outinfo->present |= AIM_USERINFO_PRESENT_CREATETIME;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
594
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
595 } else if (type == 0x0003) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
596 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
597 * Type = 0x0003: On-Since date.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
598 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
599 * The time/date that the user started their current
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
600 * session, stored in time_t format.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
601 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
602 outinfo->onlinesince = aimbs_get32(bs);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
603 outinfo->present |= AIM_USERINFO_PRESENT_ONLINESINCE;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
604
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
605 } else if (type == 0x0004) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
606 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
607 * Type = 0x0004: Idle time.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
608 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
609 * Number of minutes since the user actively used the
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
610 * service.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
611 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
612 * Note that the client tells the server when to start
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
613 * counting idle times, so this may or may not be
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
614 * related to reality.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
615 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
616 outinfo->idletime = aimbs_get16(bs);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
617 outinfo->present |= AIM_USERINFO_PRESENT_IDLE;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
618
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
619 } else if (type == 0x0005) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
620 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
621 * Type = 0x0005: Member since date.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
622 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
623 * The time/date that the user originally registered for
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
624 * the service, stored in time_t format.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
625 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
626 * This is sometimes sent instead of type 2 ("account
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
627 * creation time"), particularly in the self-info.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
628 * And particularly for ICQ?
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
629 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
630 outinfo->membersince = aimbs_get32(bs);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
631 outinfo->present |= AIM_USERINFO_PRESENT_MEMBERSINCE;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
632
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
633 } else if (type == 0x0006) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
634 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
635 * Type = 0x0006: ICQ Online Status
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
636 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
637 * ICQ's Away/DND/etc "enriched" status. Some decoding
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
638 * of values done by Scott <darkagl@pcnet.com>
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
639 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
640 aimbs_get16(bs);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
641 outinfo->icqinfo.status = aimbs_get16(bs);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
642 outinfo->present |= AIM_USERINFO_PRESENT_ICQEXTSTATUS;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
643
7141
af8ac078d4c2 [gaim-migrate @ 7708]
Mark Doliner <mark@kingant.net>
parents: 7091
diff changeset
644 } else if (type == 0x0008) {
af8ac078d4c2 [gaim-migrate @ 7708]
Mark Doliner <mark@kingant.net>
parents: 7091
diff changeset
645 /*
af8ac078d4c2 [gaim-migrate @ 7708]
Mark Doliner <mark@kingant.net>
parents: 7091
diff changeset
646 * Type = 0x0008
af8ac078d4c2 [gaim-migrate @ 7708]
Mark Doliner <mark@kingant.net>
parents: 7091
diff changeset
647 *
af8ac078d4c2 [gaim-migrate @ 7708]
Mark Doliner <mark@kingant.net>
parents: 7091
diff changeset
648 * Client type, or some such.
af8ac078d4c2 [gaim-migrate @ 7708]
Mark Doliner <mark@kingant.net>
parents: 7091
diff changeset
649 */
af8ac078d4c2 [gaim-migrate @ 7708]
Mark Doliner <mark@kingant.net>
parents: 7091
diff changeset
650
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
651 } else if (type == 0x000a) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
652 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
653 * Type = 0x000a
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
654 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
655 * ICQ User IP Address.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
656 * Ahh, the joy of ICQ security.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
657 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
658 outinfo->icqinfo.ipaddr = aimbs_get32(bs);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
659 outinfo->present |= AIM_USERINFO_PRESENT_ICQIPADDR;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
660
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
661 } else if (type == 0x000c) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
662 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
663 * Type = 0x000c
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
664 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
665 * random crap containing the IP address,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
666 * apparently a port number, and some Other Stuff.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
667 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
668 * Format is:
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
669 * 4 bytes - Our IP address, 0xc0 a8 01 2b for 192.168.1.43
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
670 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
671 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
672 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
673 aimbs_getrawbuf(bs, outinfo->icqinfo.crap, 0x25);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
674 outinfo->present |= AIM_USERINFO_PRESENT_ICQDATA;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
675
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
676 } else if (type == 0x000d) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
677 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
678 * Type = 0x000d
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
679 *
7141
af8ac078d4c2 [gaim-migrate @ 7708]
Mark Doliner <mark@kingant.net>
parents: 7091
diff changeset
680 * OSCAR Capability information.
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
681 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
682 */
7334
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
683 outinfo->capabilities |= aim_locate_getcaps(sess, bs, length);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
684 outinfo->present |= AIM_USERINFO_PRESENT_CAPABILITIES;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
685
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
686 } else if (type == 0x000e) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
687 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
688 * Type = 0x000e
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
689 *
7141
af8ac078d4c2 [gaim-migrate @ 7708]
Mark Doliner <mark@kingant.net>
parents: 7091
diff changeset
690 * AOL capability information.
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
691 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
692 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
693
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
694 } else if ((type == 0x000f) || (type == 0x0010)) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
695 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
696 * Type = 0x000f: Session Length. (AIM)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
697 * Type = 0x0010: Session Length. (AOL)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
698 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
699 * The duration, in seconds, of the user's current
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
700 * session.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
701 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
702 * Which TLV type this comes in depends on the
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
703 * service the user is using (AIM or AOL).
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
704 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
705 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
706 outinfo->sessionlen = aimbs_get32(bs);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
707 outinfo->present |= AIM_USERINFO_PRESENT_SESSIONLEN;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
708
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
709 } else if (type == 0x0019) {
7141
af8ac078d4c2 [gaim-migrate @ 7708]
Mark Doliner <mark@kingant.net>
parents: 7091
diff changeset
710 /*
af8ac078d4c2 [gaim-migrate @ 7708]
Mark Doliner <mark@kingant.net>
parents: 7091
diff changeset
711 * Type = 0x0019
af8ac078d4c2 [gaim-migrate @ 7708]
Mark Doliner <mark@kingant.net>
parents: 7091
diff changeset
712 *
af8ac078d4c2 [gaim-migrate @ 7708]
Mark Doliner <mark@kingant.net>
parents: 7091
diff changeset
713 * OSCAR short capability information. A shortened
af8ac078d4c2 [gaim-migrate @ 7708]
Mark Doliner <mark@kingant.net>
parents: 7091
diff changeset
714 * form of the normal capabilities.
af8ac078d4c2 [gaim-migrate @ 7708]
Mark Doliner <mark@kingant.net>
parents: 7091
diff changeset
715 */
7334
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
716 outinfo->capabilities |= aim_locate_getcaps_short(sess, bs, length);
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
717 outinfo->present |= AIM_USERINFO_PRESENT_CAPABILITIES;
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
718
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
719 } else if (type == 0x001b) {
7141
af8ac078d4c2 [gaim-migrate @ 7708]
Mark Doliner <mark@kingant.net>
parents: 7091
diff changeset
720 /*
af8ac078d4c2 [gaim-migrate @ 7708]
Mark Doliner <mark@kingant.net>
parents: 7091
diff changeset
721 * Type = 0x001a
af8ac078d4c2 [gaim-migrate @ 7708]
Mark Doliner <mark@kingant.net>
parents: 7091
diff changeset
722 *
af8ac078d4c2 [gaim-migrate @ 7708]
Mark Doliner <mark@kingant.net>
parents: 7091
diff changeset
723 * AOL short capability information. A shortened
af8ac078d4c2 [gaim-migrate @ 7708]
Mark Doliner <mark@kingant.net>
parents: 7091
diff changeset
724 * form of the normal capabilities.
af8ac078d4c2 [gaim-migrate @ 7708]
Mark Doliner <mark@kingant.net>
parents: 7091
diff changeset
725 */
af8ac078d4c2 [gaim-migrate @ 7708]
Mark Doliner <mark@kingant.net>
parents: 7091
diff changeset
726
af8ac078d4c2 [gaim-migrate @ 7708]
Mark Doliner <mark@kingant.net>
parents: 7091
diff changeset
727 } else if (type == 0x001b) {
af8ac078d4c2 [gaim-migrate @ 7708]
Mark Doliner <mark@kingant.net>
parents: 7091
diff changeset
728 /*
af8ac078d4c2 [gaim-migrate @ 7708]
Mark Doliner <mark@kingant.net>
parents: 7091
diff changeset
729 * Type = 0x0019
af8ac078d4c2 [gaim-migrate @ 7708]
Mark Doliner <mark@kingant.net>
parents: 7091
diff changeset
730 *
af8ac078d4c2 [gaim-migrate @ 7708]
Mark Doliner <mark@kingant.net>
parents: 7091
diff changeset
731 * Encryption certification MD5 checksum.
af8ac078d4c2 [gaim-migrate @ 7708]
Mark Doliner <mark@kingant.net>
parents: 7091
diff changeset
732 */
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
733
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
734 } else if (type == 0x001d) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
735 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
736 * Type = 0x001d
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
737 *
12349
2a1961c1a345 [gaim-migrate @ 14653]
Mark Doliner <mark@kingant.net>
parents: 12307
diff changeset
738 * Buddy icon information and status/available messages.
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
739 *
12349
2a1961c1a345 [gaim-migrate @ 14653]
Mark Doliner <mark@kingant.net>
parents: 12307
diff changeset
740 * This almost seems like the AIM protocol guys gave
2a1961c1a345 [gaim-migrate @ 14653]
Mark Doliner <mark@kingant.net>
parents: 12307
diff changeset
741 * the iChat guys a Type, and the iChat guys tried to
2a1961c1a345 [gaim-migrate @ 14653]
Mark Doliner <mark@kingant.net>
parents: 12307
diff changeset
742 * cram as much cool shit into it as possible. Then
2a1961c1a345 [gaim-migrate @ 14653]
Mark Doliner <mark@kingant.net>
parents: 12307
diff changeset
743 * the Windows AIM guys were like, "hey, that's
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
744 * pretty neat, let's copy those prawns."
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
745 *
12349
2a1961c1a345 [gaim-migrate @ 14653]
Mark Doliner <mark@kingant.net>
parents: 12307
diff changeset
746 * In that spirit, this can contain a custom message,
2a1961c1a345 [gaim-migrate @ 14653]
Mark Doliner <mark@kingant.net>
parents: 12307
diff changeset
747 * kind of like an away message, but you're not away
2a1961c1a345 [gaim-migrate @ 14653]
Mark Doliner <mark@kingant.net>
parents: 12307
diff changeset
748 * (it's called an "available" message). Or it can
2a1961c1a345 [gaim-migrate @ 14653]
Mark Doliner <mark@kingant.net>
parents: 12307
diff changeset
749 * contain information about the buddy icon the user
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
750 * has stored on the server.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
751 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
752 int type2, number, length2;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
753
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
754 while (aim_bstream_curpos(bs) < endpos) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
755 type2 = aimbs_get16(bs);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
756 number = aimbs_get8(bs);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
757 length2 = aimbs_get8(bs);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
758
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
759 switch (type2) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
760 case 0x0000: { /* This is an official buddy icon? */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
761 /* This is always 5 bytes of "0x02 01 d2 04 72"? */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
762 aim_bstream_advance(bs, length2);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
763 } break;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
764
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
765 case 0x0001: { /* A buddy icon checksum */
11024
1d58cc6c4552 [gaim-migrate @ 12897]
Mark Doliner <mark@kingant.net>
parents: 10998
diff changeset
766 if ((length2 > 0) && ((number == 0x00) || (number == 0x01))) {
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
767 free(outinfo->iconcsum);
11024
1d58cc6c4552 [gaim-migrate @ 12897]
Mark Doliner <mark@kingant.net>
parents: 10998
diff changeset
768 outinfo->iconcsumtype = number;
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
769 outinfo->iconcsum = aimbs_getraw(bs, length2);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
770 outinfo->iconcsumlen = length2;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
771 } else
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
772 aim_bstream_advance(bs, length2);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
773 } break;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
774
13007
46ba853a76b5 [gaim-migrate @ 15360]
Mark Doliner <mark@kingant.net>
parents: 12600
diff changeset
775 case 0x0002: { /* A status/available message */
12349
2a1961c1a345 [gaim-migrate @ 14653]
Mark Doliner <mark@kingant.net>
parents: 12307
diff changeset
776 free(outinfo->status);
2a1961c1a345 [gaim-migrate @ 14653]
Mark Doliner <mark@kingant.net>
parents: 12307
diff changeset
777 free(outinfo->status_encoding);
10563
3e2cd3fe8897 [gaim-migrate @ 11944]
Mark Doliner <mark@kingant.net>
parents: 10436
diff changeset
778 if (length2 >= 4) {
12349
2a1961c1a345 [gaim-migrate @ 14653]
Mark Doliner <mark@kingant.net>
parents: 12307
diff changeset
779 outinfo->status_len = aimbs_get16(bs);
2a1961c1a345 [gaim-migrate @ 14653]
Mark Doliner <mark@kingant.net>
parents: 12307
diff changeset
780 outinfo->status = aimbs_getstr(bs, outinfo->status_len);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
781 if (aimbs_get16(bs) == 0x0001) { /* We have an encoding */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
782 aimbs_get16(bs);
12349
2a1961c1a345 [gaim-migrate @ 14653]
Mark Doliner <mark@kingant.net>
parents: 12307
diff changeset
783 outinfo->status_encoding = aimbs_getstr(bs, aimbs_get16(bs));
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
784 } else {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
785 /* No explicit encoding, client should use UTF-8 */
12349
2a1961c1a345 [gaim-migrate @ 14653]
Mark Doliner <mark@kingant.net>
parents: 12307
diff changeset
786 outinfo->status_encoding = NULL;
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
787 }
12307
cfffd6fdb073 [gaim-migrate @ 14611]
Mark Doliner <mark@kingant.net>
parents: 11285
diff changeset
788 } else {
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
789 aim_bstream_advance(bs, length2);
12349
2a1961c1a345 [gaim-migrate @ 14653]
Mark Doliner <mark@kingant.net>
parents: 12307
diff changeset
790 outinfo->status_len = 0;
2a1961c1a345 [gaim-migrate @ 14653]
Mark Doliner <mark@kingant.net>
parents: 12307
diff changeset
791 outinfo->status = g_strdup("");
2a1961c1a345 [gaim-migrate @ 14653]
Mark Doliner <mark@kingant.net>
parents: 12307
diff changeset
792 outinfo->status_encoding = NULL;
12307
cfffd6fdb073 [gaim-migrate @ 14611]
Mark Doliner <mark@kingant.net>
parents: 11285
diff changeset
793 }
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
794 } break;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
795
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
796 default: {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
797 aim_bstream_advance(bs, length2);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
798 } break;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
799 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
800 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
801
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
802 } else if (type == 0x001e) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
803 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
804 * Type 30: Unknown.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
805 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
806 * Always four bytes, but it doesn't look like an int.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
807 */
7025
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
808
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
809 } else if (type == 0x001f) {
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
810 /*
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
811 * Type 31: Unknown.
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
812 *
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
813 * Seen on a buddy using DeadAIM. Data was 4 bytes:
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
814 * 0x00 00 00 10
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
815 */
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
816
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
817 } else {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
818
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
819 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
820 * Reaching here indicates that either AOL has
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
821 * added yet another TLV for us to deal with,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
822 * or the parsing has gone Terribly Wrong.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
823 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
824 * Either way, inform the owner and attempt
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
825 * recovery.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
826 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
827 */
11253
7d31d61e6438 [gaim-migrate @ 13422]
Mark Doliner <mark@kingant.net>
parents: 11159
diff changeset
828 gaim_debug_misc("oscar", "userinfo: **warning: unexpected TLV:\n");
7d31d61e6438 [gaim-migrate @ 13422]
Mark Doliner <mark@kingant.net>
parents: 11159
diff changeset
829 gaim_debug_misc("oscar", "userinfo: sn =%s\n", outinfo->sn);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
830 dumptlv(sess, type, bs, length);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
831 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
832
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
833 /* Save ourselves. */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
834 aim_bstream_setpos(bs, endpos);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
835 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
836
7045
237ad253dd34 [gaim-migrate @ 7608]
Mark Doliner <mark@kingant.net>
parents: 7025
diff changeset
837 aim_locate_adduserinfo(sess, outinfo);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
838
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
839 return 0;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
840 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
841
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
842 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
843 * Inverse of aim_info_extract()
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
844 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
845 faim_internal int aim_putuserinfo(aim_bstream_t *bs, aim_userinfo_t *info)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
846 {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
847 aim_tlvlist_t *tlvlist = NULL;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
848
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
849 if (!bs || !info)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
850 return -EINVAL;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
851
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
852 aimbs_put8(bs, strlen(info->sn));
10990
8d74ae785a46 [gaim-migrate @ 12828]
Mark Doliner <mark@kingant.net>
parents: 10986
diff changeset
853 aimbs_putstr(bs, info->sn);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
854
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
855 aimbs_put16(bs, info->warnlevel);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
856
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
857 if (info->present & AIM_USERINFO_PRESENT_FLAGS)
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7166
diff changeset
858 aim_tlvlist_add_16(&tlvlist, 0x0001, info->flags);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
859 if (info->present & AIM_USERINFO_PRESENT_MEMBERSINCE)
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7166
diff changeset
860 aim_tlvlist_add_32(&tlvlist, 0x0002, info->membersince);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
861 if (info->present & AIM_USERINFO_PRESENT_ONLINESINCE)
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7166
diff changeset
862 aim_tlvlist_add_32(&tlvlist, 0x0003, info->onlinesince);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
863 if (info->present & AIM_USERINFO_PRESENT_IDLE)
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7166
diff changeset
864 aim_tlvlist_add_16(&tlvlist, 0x0004, info->idletime);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
865
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
866 /* XXX - So, ICQ_OSCAR_SUPPORT is never defined anywhere... */
12407
b33b4e326c90 [gaim-migrate @ 14714]
Richard Laager <rlaager@wiktel.com>
parents: 12349
diff changeset
867 #ifdef ICQ_OSCAR_SUPPORT
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
868 if (atoi(info->sn) != 0) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
869 if (info->present & AIM_USERINFO_PRESENT_ICQEXTSTATUS)
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7166
diff changeset
870 aim_tlvlist_add_16(&tlvlist, 0x0006, info->icqinfo.status);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
871 if (info->present & AIM_USERINFO_PRESENT_ICQIPADDR)
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7166
diff changeset
872 aim_tlvlist_add_32(&tlvlist, 0x000a, info->icqinfo.ipaddr);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
873 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
874 #endif
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
875
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
876 if (info->present & AIM_USERINFO_PRESENT_CAPABILITIES)
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7166
diff changeset
877 aim_tlvlist_add_caps(&tlvlist, 0x000d, info->capabilities);
10436
08c8a18fb557 [gaim-migrate @ 11693]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
878
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
879 if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN)
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7166
diff changeset
880 aim_tlvlist_add_32(&tlvlist, (fu16_t)((info->flags & AIM_FLAG_AOL) ? 0x0010 : 0x000f), info->sessionlen);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
881
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7166
diff changeset
882 aimbs_put16(bs, aim_tlvlist_count(&tlvlist));
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7166
diff changeset
883 aim_tlvlist_write(bs, &tlvlist);
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7166
diff changeset
884 aim_tlvlist_free(&tlvlist);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
885
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
886 return 0;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
887 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
888
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
889 /*
7259
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
890 * Subtype 0x0001
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
891 */
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
892 static int error(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
893 {
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
894 int ret = 0;
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
895 aim_rxcallback_t userfunc;
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
896 aim_snac_t *snac2;
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
897 fu16_t reason;
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
898 char *sn;
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
899 int was_explicit;
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
900
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
901 if (!(snac2 = aim_remsnac(sess, snac->id))) {
11253
7d31d61e6438 [gaim-migrate @ 13422]
Mark Doliner <mark@kingant.net>
parents: 11159
diff changeset
902 gaim_debug_misc("oscar", "faim: locate.c, error(): received response from unknown request!\n");
7259
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
903 return 0;
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
904 }
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
905
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
906 if ((snac2->family != 0x0002) && (snac2->type != 0x0015)) {
11253
7d31d61e6438 [gaim-migrate @ 13422]
Mark Doliner <mark@kingant.net>
parents: 11159
diff changeset
907 gaim_debug_misc("oscar", "faim: locate.c, error(): received response from invalid request! %d\n", snac2->family);
7259
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
908 return 0;
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
909 }
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
910
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
911 if (!(sn = snac2->data)) {
11253
7d31d61e6438 [gaim-migrate @ 13422]
Mark Doliner <mark@kingant.net>
parents: 11159
diff changeset
912 gaim_debug_misc("oscar", "faim: locate.c, error(): received response from request without a screen name!\n");
7259
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
913 return 0;
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
914 }
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
915
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
916 reason = aimbs_get16(bs);
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
917
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
918 /*
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
919 * Remove this screen name from our queue. If the client requested
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
920 * this buddy's info explicitly, then notify them that we do not have
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
921 * info for this buddy.
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
922 */
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
923 was_explicit = aim_locate_gotuserinfo(sess, sn);
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
924 if (was_explicit == TRUE)
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
925 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
926 ret = userfunc(sess, rx, reason, sn);
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
927
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
928 if (snac2)
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
929 free(snac2->data);
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
930 free(snac2);
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
931
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
932 return ret;
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
933 }
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
934
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
935 /*
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
936 * Subtype 0x0002
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
937 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
938 * Request Location services rights.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
939 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
940 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
941 faim_export int aim_locate_reqrights(aim_session_t *sess)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
942 {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
943 aim_conn_t *conn;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
944
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
945 if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_LOC)))
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
946 return -EINVAL;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
947
7282
ad243bc63184 [gaim-migrate @ 7861]
Mark Doliner <mark@kingant.net>
parents: 7266
diff changeset
948 return aim_genericreq_n_snacid(sess, conn, AIM_CB_FAM_LOC, AIM_CB_LOC_REQRIGHTS);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
949 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
950
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
951 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
952 * Subtype 0x0003
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
953 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
954 * Normally contains:
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
955 * t(0001) - short containing max profile length (value = 1024)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
956 * t(0002) - short - unknown (value = 16) [max MIME type length?]
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
957 * t(0003) - short - unknown (value = 10)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
958 * t(0004) - short - unknown (value = 2048) [ICQ only?]
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
959 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
960 static int rights(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
961 {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
962 aim_tlvlist_t *tlvlist;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
963 aim_rxcallback_t userfunc;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
964 int ret = 0;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
965 fu16_t maxsiglen = 0;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
966
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7166
diff changeset
967 tlvlist = aim_tlvlist_read(bs);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
968
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7166
diff changeset
969 if (aim_tlv_gettlv(tlvlist, 0x0001, 1))
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7166
diff changeset
970 maxsiglen = aim_tlv_get16(tlvlist, 0x0001, 1);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
971
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
972 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
973 ret = userfunc(sess, rx, maxsiglen);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
974
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7166
diff changeset
975 aim_tlvlist_free(&tlvlist);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
976
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
977 return ret;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
978 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
979
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
980 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
981 * Subtype 0x0004
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
982 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
983 * Gives BOS your profile.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
984 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
985 * profile_encoding and awaymsg_encoding MUST be set if profile or
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
986 * away are set, respectively, and their value may or may not be
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
987 * restricted to a few choices. I am currently aware of:
11159
bd8ac1d4b2f2 [gaim-migrate @ 13246]
Mark Doliner <mark@kingant.net>
parents: 11024
diff changeset
988 *
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
989 * us-ascii Just that
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
990 * unicode-2-0 UCS2-BE
11159
bd8ac1d4b2f2 [gaim-migrate @ 13246]
Mark Doliner <mark@kingant.net>
parents: 11024
diff changeset
991 *
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
992 * profile_len and awaymsg_len MUST be set similarly, and they MUST
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
993 * be the length of their respective strings in bytes.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
994 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
995 * To get the previous behavior of awaymsg == "" un-setting the away
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
996 * message, set awaymsg non-NULL and awaymsg_len to 0 (this is the
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
997 * obvious equivalent).
11159
bd8ac1d4b2f2 [gaim-migrate @ 13246]
Mark Doliner <mark@kingant.net>
parents: 11024
diff changeset
998 *
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
999 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1000 faim_export int aim_locate_setprofile(aim_session_t *sess,
11159
bd8ac1d4b2f2 [gaim-migrate @ 13246]
Mark Doliner <mark@kingant.net>
parents: 11024
diff changeset
1001 const char *profile_encoding, const gchar *profile, const int profile_len,
bd8ac1d4b2f2 [gaim-migrate @ 13246]
Mark Doliner <mark@kingant.net>
parents: 11024
diff changeset
1002 const char *awaymsg_encoding, const gchar *awaymsg, const int awaymsg_len)
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1003 {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1004 aim_conn_t *conn;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1005 aim_frame_t *fr;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1006 aim_snacid_t snacid;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1007 aim_tlvlist_t *tl = NULL;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1008 char *encoding;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1009 static const char defencoding[] = {"text/aolrtf; charset=\"%s\""};
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1010
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1011 if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_LOC)))
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1012 return -EINVAL;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1013
7510
ef3e646152a1 [gaim-migrate @ 8123]
Mark Doliner <mark@kingant.net>
parents: 7466
diff changeset
1014 if (!profile && !awaymsg)
ef3e646152a1 [gaim-migrate @ 8123]
Mark Doliner <mark@kingant.net>
parents: 7466
diff changeset
1015 return -EINVAL;
ef3e646152a1 [gaim-migrate @ 8123]
Mark Doliner <mark@kingant.net>
parents: 7466
diff changeset
1016
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1017 if ((profile && profile_encoding == NULL) || (awaymsg && awaymsg_len && awaymsg_encoding == NULL)) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1018 return -EINVAL;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1019 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1020
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1021 /* Build the packet first to get real length */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1022 if (profile) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1023 /* no + 1 here because of %s */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1024 encoding = malloc(strlen(defencoding) + strlen(profile_encoding));
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1025 if (encoding == NULL) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1026 return -ENOMEM;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1027 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1028 snprintf(encoding, strlen(defencoding) + strlen(profile_encoding), defencoding, profile_encoding);
10991
1798ad0be460 [gaim-migrate @ 12829]
Mark Doliner <mark@kingant.net>
parents: 10990
diff changeset
1029 aim_tlvlist_add_str(&tl, 0x0001, encoding);
11159
bd8ac1d4b2f2 [gaim-migrate @ 13246]
Mark Doliner <mark@kingant.net>
parents: 11024
diff changeset
1030 aim_tlvlist_add_raw(&tl, 0x0002, profile_len, (const guchar *)profile);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1031 free(encoding);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1032 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1033
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1034 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1035 * So here's how this works:
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1036 * - You are away when you have a non-zero-length type 4 TLV stored.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1037 * - You become unaway when you clear the TLV with a zero-length
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1038 * type 4 TLV.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1039 * - If you do not send the type 4 TLV, your status does not change
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1040 * (that is, if you were away, you'll remain away).
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1041 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1042 if (awaymsg) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1043 if (awaymsg_len) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1044 encoding = malloc(strlen(defencoding) + strlen(awaymsg_encoding));
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1045 if (encoding == NULL) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1046 return -ENOMEM;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1047 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1048 snprintf(encoding, strlen(defencoding) + strlen(awaymsg_encoding), defencoding, awaymsg_encoding);
10991
1798ad0be460 [gaim-migrate @ 12829]
Mark Doliner <mark@kingant.net>
parents: 10990
diff changeset
1049 aim_tlvlist_add_str(&tl, 0x0003, encoding);
11159
bd8ac1d4b2f2 [gaim-migrate @ 13246]
Mark Doliner <mark@kingant.net>
parents: 11024
diff changeset
1050 aim_tlvlist_add_raw(&tl, 0x0004, awaymsg_len, (const guchar *)awaymsg);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1051 free(encoding);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1052 } else
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7166
diff changeset
1053 aim_tlvlist_add_noval(&tl, 0x0004);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1054 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1055
7334
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
1056 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + aim_tlvlist_size(&tl))))
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
1057 return -ENOMEM;
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
1058
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
1059 snacid = aim_cachesnac(sess, 0x0002, 0x0004, 0x0000, NULL, 0);
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
1060 aim_putsnac(&fr->data, 0x0002, 0x004, 0x0000, snacid);
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
1061
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
1062 aim_tlvlist_write(&fr->data, &tl);
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
1063 aim_tlvlist_free(&tl);
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
1064
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
1065 aim_tx_enqueue(sess, fr);
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
1066
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
1067 return 0;
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
1068 }
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
1069
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
1070 /*
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
1071 * Subtype 0x0004 - Set your client's capabilities.
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
1072 */
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
1073 faim_export int aim_locate_setcaps(aim_session_t *sess, fu32_t caps)
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
1074 {
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
1075 aim_conn_t *conn;
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
1076 aim_frame_t *fr;
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
1077 aim_snacid_t snacid;
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
1078 aim_tlvlist_t *tl = NULL;
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
1079
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
1080 if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_LOC)))
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
1081 return -EINVAL;
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
1082
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
1083 aim_tlvlist_add_caps(&tl, 0x0005, caps);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1084
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7166
diff changeset
1085 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + aim_tlvlist_size(&tl))))
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1086 return -ENOMEM;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1087
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1088 snacid = aim_cachesnac(sess, 0x0002, 0x0004, 0x0000, NULL, 0);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1089 aim_putsnac(&fr->data, 0x0002, 0x004, 0x0000, snacid);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1090
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7166
diff changeset
1091 aim_tlvlist_write(&fr->data, &tl);
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7166
diff changeset
1092 aim_tlvlist_free(&tl);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1093
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1094 aim_tx_enqueue(sess, fr);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1095
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1096 return 0;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1097 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1098
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1099 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1100 * Subtype 0x0005 - Request info of another AIM user.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1101 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1102 * @param sn The screenname whose info you wish to request.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1103 * @param infotype The type of info you wish to request.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1104 * 0x0001 - Info/profile
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1105 * 0x0003 - Away message
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1106 * 0x0004 - Capabilities
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1107 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1108 faim_export int aim_locate_getinfo(aim_session_t *sess, const char *sn, fu16_t infotype)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1109 {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1110 aim_conn_t *conn;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1111 aim_frame_t *fr;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1112 aim_snacid_t snacid;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1113
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1114 if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_LOC)) || !sn)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1115 return -EINVAL;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1116
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1117 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 12+1+strlen(sn))))
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1118 return -ENOMEM;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1119
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1120 snacid = aim_cachesnac(sess, 0x0002, 0x0005, 0x0000, NULL, 0);
10436
08c8a18fb557 [gaim-migrate @ 11693]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
1121
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1122 aim_putsnac(&fr->data, 0x0002, 0x0005, 0x0000, snacid);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1123 aimbs_put16(&fr->data, infotype);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1124 aimbs_put8(&fr->data, strlen(sn));
10998
9a397c858639 [gaim-migrate @ 12840]
Mark Doliner <mark@kingant.net>
parents: 10991
diff changeset
1125 aimbs_putstr(&fr->data, sn);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1126
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1127 aim_tx_enqueue(sess, fr);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1128
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1129 return 0;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1130 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1131
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1132 /* Subtype 0x0006 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1133 static int userinfo(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1134 {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1135 int ret = 0;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1136 aim_rxcallback_t userfunc;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1137 aim_userinfo_t *userinfo, *userinfo2;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1138 aim_tlvlist_t *tlvlist;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1139 aim_tlv_t *tlv = NULL;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1140 int was_explicit;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1141
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1142 userinfo = (aim_userinfo_t *)malloc(sizeof(aim_userinfo_t));
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1143 aim_info_extract(sess, bs, userinfo);
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7166
diff changeset
1144 tlvlist = aim_tlvlist_read(bs);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1145
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1146 /* Profile will be 1 and 2 */
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7166
diff changeset
1147 userinfo->info_encoding = aim_tlv_getstr(tlvlist, 0x0001, 1);
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7166
diff changeset
1148 if ((tlv = aim_tlv_gettlv(tlvlist, 0x0002, 1))) {
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1149 userinfo->info = (char *)malloc(tlv->length);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1150 memcpy(userinfo->info, tlv->value, tlv->length);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1151 userinfo->info_len = tlv->length;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1152 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1153
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1154 /* Away message will be 3 and 4 */
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7166
diff changeset
1155 userinfo->away_encoding = aim_tlv_getstr(tlvlist, 0x0003, 1);
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7166
diff changeset
1156 if ((tlv = aim_tlv_gettlv(tlvlist, 0x0004, 1))) {
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1157 userinfo->away = (char *)malloc(tlv->length);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1158 memcpy(userinfo->away, tlv->value, tlv->length);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1159 userinfo->away_len = tlv->length;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1160 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1161
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1162 /* Caps will be 5 */
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7166
diff changeset
1163 if ((tlv = aim_tlv_gettlv(tlvlist, 0x0005, 1))) {
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1164 aim_bstream_t cbs;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1165 aim_bstream_init(&cbs, tlv->value, tlv->length);
7334
83e8faa7f6d5 [gaim-migrate @ 7922]
Mark Doliner <mark@kingant.net>
parents: 7313
diff changeset
1166 userinfo->capabilities = aim_locate_getcaps(sess, &cbs, tlv->length);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1167 userinfo->present = AIM_USERINFO_PRESENT_CAPABILITIES;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1168 }
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7166
diff changeset
1169 aim_tlvlist_free(&tlvlist);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1170
7045
237ad253dd34 [gaim-migrate @ 7608]
Mark Doliner <mark@kingant.net>
parents: 7025
diff changeset
1171 aim_locate_adduserinfo(sess, userinfo);
237ad253dd34 [gaim-migrate @ 7608]
Mark Doliner <mark@kingant.net>
parents: 7025
diff changeset
1172 userinfo2 = aim_locate_finduserinfo(sess, userinfo->sn);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1173 aim_info_free(userinfo);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1174 free(userinfo);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1175
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1176 /*
11255
1b1d63602d77 [gaim-migrate @ 13429]
Mark Doliner <mark@kingant.net>
parents: 11253
diff changeset
1177 * Remove this screen name from our queue. If the client requested
1b1d63602d77 [gaim-migrate @ 13429]
Mark Doliner <mark@kingant.net>
parents: 11253
diff changeset
1178 * this buddy's info explicitly, then notify them that we have info
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1179 * for this buddy.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1180 */
7259
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
1181 was_explicit = aim_locate_gotuserinfo(sess, userinfo2->sn);
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
1182 if (was_explicit == TRUE)
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1183 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1184 ret = userfunc(sess, rx, userinfo2);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1185
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1186 return ret;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1187 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1188
11255
1b1d63602d77 [gaim-migrate @ 13429]
Mark Doliner <mark@kingant.net>
parents: 11253
diff changeset
1189 /*
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1190 * Subtype 0x0009 - Set directory profile data.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1191 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1192 * This is not the same as aim_location_setprofile!
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1193 * privacy: 1 to allow searching, 0 to disallow.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1194 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1195 */
11255
1b1d63602d77 [gaim-migrate @ 13429]
Mark Doliner <mark@kingant.net>
parents: 11253
diff changeset
1196 faim_export int aim_locate_setdirinfo(aim_session_t *sess, const char *first, const char *middle, const char *last, const char *maiden, const char *nickname, const char *street, const char *city, const char *state, const char *zip, int country, fu16_t privacy)
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1197 {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1198 aim_conn_t *conn;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1199 aim_frame_t *fr;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1200 aim_snacid_t snacid;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1201 aim_tlvlist_t *tl = NULL;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1202
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1203 if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_LOC)))
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1204 return -EINVAL;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1205
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7166
diff changeset
1206 aim_tlvlist_add_16(&tl, 0x000a, privacy);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1207
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1208 if (first)
10991
1798ad0be460 [gaim-migrate @ 12829]
Mark Doliner <mark@kingant.net>
parents: 10990
diff changeset
1209 aim_tlvlist_add_str(&tl, 0x0001, first);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1210 if (last)
10991
1798ad0be460 [gaim-migrate @ 12829]
Mark Doliner <mark@kingant.net>
parents: 10990
diff changeset
1211 aim_tlvlist_add_str(&tl, 0x0002, last);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1212 if (middle)
10991
1798ad0be460 [gaim-migrate @ 12829]
Mark Doliner <mark@kingant.net>
parents: 10990
diff changeset
1213 aim_tlvlist_add_str(&tl, 0x0003, middle);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1214 if (maiden)
10991
1798ad0be460 [gaim-migrate @ 12829]
Mark Doliner <mark@kingant.net>
parents: 10990
diff changeset
1215 aim_tlvlist_add_str(&tl, 0x0004, maiden);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1216
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1217 if (state)
10991
1798ad0be460 [gaim-migrate @ 12829]
Mark Doliner <mark@kingant.net>
parents: 10990
diff changeset
1218 aim_tlvlist_add_str(&tl, 0x0007, state);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1219 if (city)
10991
1798ad0be460 [gaim-migrate @ 12829]
Mark Doliner <mark@kingant.net>
parents: 10990
diff changeset
1220 aim_tlvlist_add_str(&tl, 0x0008, city);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1221
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1222 if (nickname)
10991
1798ad0be460 [gaim-migrate @ 12829]
Mark Doliner <mark@kingant.net>
parents: 10990
diff changeset
1223 aim_tlvlist_add_str(&tl, 0x000c, nickname);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1224 if (zip)
10991
1798ad0be460 [gaim-migrate @ 12829]
Mark Doliner <mark@kingant.net>
parents: 10990
diff changeset
1225 aim_tlvlist_add_str(&tl, 0x000d, zip);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1226
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1227 if (street)
10991
1798ad0be460 [gaim-migrate @ 12829]
Mark Doliner <mark@kingant.net>
parents: 10990
diff changeset
1228 aim_tlvlist_add_str(&tl, 0x0021, street);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1229
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7166
diff changeset
1230 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+aim_tlvlist_size(&tl))))
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1231 return -ENOMEM;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1232
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1233 snacid = aim_cachesnac(sess, 0x0002, 0x0009, 0x0000, NULL, 0);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1234
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1235 aim_putsnac(&fr->data, 0x0002, 0x0009, 0x0000, snacid);
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7166
diff changeset
1236 aim_tlvlist_write(&fr->data, &tl);
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7166
diff changeset
1237 aim_tlvlist_free(&tl);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1238
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1239 aim_tx_enqueue(sess, fr);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1240
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1241 return 0;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1242 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1243
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1244 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1245 * Subtype 0x000b - Huh? What is this?
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1246 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1247 faim_export int aim_locate_000b(aim_session_t *sess, const char *sn)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1248 {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1249 aim_conn_t *conn;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1250 aim_frame_t *fr;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1251 aim_snacid_t snacid;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1252
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1253 return -EINVAL;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1254
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1255 if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_LOC)) || !sn)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1256 return -EINVAL;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1257
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1258 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+1+strlen(sn))))
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1259 return -ENOMEM;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1260
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1261 snacid = aim_cachesnac(sess, 0x0002, 0x000b, 0x0000, NULL, 0);
11255
1b1d63602d77 [gaim-migrate @ 13429]
Mark Doliner <mark@kingant.net>
parents: 11253
diff changeset
1262
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1263 aim_putsnac(&fr->data, 0x0002, 0x000b, 0x0000, snacid);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1264 aimbs_put8(&fr->data, strlen(sn));
10990
8d74ae785a46 [gaim-migrate @ 12828]
Mark Doliner <mark@kingant.net>
parents: 10986
diff changeset
1265 aimbs_putstr(&fr->data, sn);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1266
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1267 aim_tx_enqueue(sess, fr);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1268
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1269 return 0;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1270 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1271
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1272 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1273 * Subtype 0x000f
11255
1b1d63602d77 [gaim-migrate @ 13429]
Mark Doliner <mark@kingant.net>
parents: 11253
diff changeset
1274 *
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1275 * XXX pass these in better
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1276 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1277 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1278 faim_export int aim_locate_setinterests(aim_session_t *sess, const char *interest1, const char *interest2, const char *interest3, const char *interest4, const char *interest5, fu16_t privacy)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1279 {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1280 aim_conn_t *conn;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1281 aim_frame_t *fr;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1282 aim_snacid_t snacid;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1283 aim_tlvlist_t *tl = NULL;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1284
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1285 if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_LOC)))
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1286 return -EINVAL;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1287
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1288 /* ?? privacy ?? */
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7166
diff changeset
1289 aim_tlvlist_add_16(&tl, 0x000a, privacy);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1290
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1291 if (interest1)
10991
1798ad0be460 [gaim-migrate @ 12829]
Mark Doliner <mark@kingant.net>
parents: 10990
diff changeset
1292 aim_tlvlist_add_str(&tl, 0x0000b, interest1);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1293 if (interest2)
10991
1798ad0be460 [gaim-migrate @ 12829]
Mark Doliner <mark@kingant.net>
parents: 10990
diff changeset
1294 aim_tlvlist_add_str(&tl, 0x0000b, interest2);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1295 if (interest3)
10991
1798ad0be460 [gaim-migrate @ 12829]
Mark Doliner <mark@kingant.net>
parents: 10990
diff changeset
1296 aim_tlvlist_add_str(&tl, 0x0000b, interest3);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1297 if (interest4)
10991
1798ad0be460 [gaim-migrate @ 12829]
Mark Doliner <mark@kingant.net>
parents: 10990
diff changeset
1298 aim_tlvlist_add_str(&tl, 0x0000b, interest4);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1299 if (interest5)
10991
1798ad0be460 [gaim-migrate @ 12829]
Mark Doliner <mark@kingant.net>
parents: 10990
diff changeset
1300 aim_tlvlist_add_str(&tl, 0x0000b, interest5);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1301
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7166
diff changeset
1302 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+aim_tlvlist_size(&tl))))
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1303 return -ENOMEM;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1304
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1305 snacid = aim_cachesnac(sess, 0x0002, 0x000f, 0x0000, NULL, 0);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1306
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1307 aim_putsnac(&fr->data, 0x0002, 0x000f, 0x0000, 0);
7167
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7166
diff changeset
1308 aim_tlvlist_write(&fr->data, &tl);
6d3d8f11e765 [gaim-migrate @ 7734]
Mark Doliner <mark@kingant.net>
parents: 7166
diff changeset
1309 aim_tlvlist_free(&tl);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1310
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1311 aim_tx_enqueue(sess, fr);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1312
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1313 return 0;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1314 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1315
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1316 /*
11255
1b1d63602d77 [gaim-migrate @ 13429]
Mark Doliner <mark@kingant.net>
parents: 11253
diff changeset
1317 * Subtype 0x0015 - Request the info a user using the short method. This is
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1318 * what iChat uses. It normally is VERY leniently rate limited.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1319 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1320 * @param sn The screen name whose info you wish to request.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1321 * @param flags The bitmask which specifies the type of info you wish to request.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1322 * 0x00000001 - Info/profile.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1323 * 0x00000002 - Away message.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1324 * 0x00000004 - Capabilities.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1325 * 0x00000008 - Certification.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1326 * @return Return 0 if no errors, otherwise return the error number.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1327 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1328 faim_export int aim_locate_getinfoshort(aim_session_t *sess, const char *sn, fu32_t flags)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1329 {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1330 aim_conn_t *conn;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1331 aim_frame_t *fr;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1332 aim_snacid_t snacid;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1333
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1334 if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_LOC)) || !sn)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1335 return -EINVAL;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1336
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1337 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+4+1+strlen(sn))))
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1338 return -ENOMEM;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1339
7259
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
1340 snacid = aim_cachesnac(sess, 0x0002, 0x0015, 0x0000, sn, strlen(sn)+1);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1341
7259
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
1342 aim_putsnac(&fr->data, 0x0002, 0x0015, 0x0000, snacid);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1343 aimbs_put32(&fr->data, flags);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1344 aimbs_put8(&fr->data, strlen(sn));
10990
8d74ae785a46 [gaim-migrate @ 12828]
Mark Doliner <mark@kingant.net>
parents: 10986
diff changeset
1345 aimbs_putstr(&fr->data, sn);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1346
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1347 aim_tx_enqueue(sess, fr);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1348
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1349 return 0;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1350 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1351
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1352 static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1353 {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1354
7259
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
1355 if (snac->subtype == 0x0001)
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
1356 return error(sess, mod, rx, snac, bs);
22b5b81ca7e0 [gaim-migrate @ 7836]
Mark Doliner <mark@kingant.net>
parents: 7253
diff changeset
1357 else if (snac->subtype == 0x0003)
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1358 return rights(sess, mod, rx, snac, bs);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1359 else if (snac->subtype == 0x0006)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1360 return userinfo(sess, mod, rx, snac, bs);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1361
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1362 return 0;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1363 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1364
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1365 static void locate_shutdown(aim_session_t *sess, aim_module_t *mod)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1366 {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1367 aim_userinfo_t *del;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1368
7045
237ad253dd34 [gaim-migrate @ 7608]
Mark Doliner <mark@kingant.net>
parents: 7025
diff changeset
1369 while (sess->locate.userinfo) {
237ad253dd34 [gaim-migrate @ 7608]
Mark Doliner <mark@kingant.net>
parents: 7025
diff changeset
1370 del = sess->locate.userinfo;
237ad253dd34 [gaim-migrate @ 7608]
Mark Doliner <mark@kingant.net>
parents: 7025
diff changeset
1371 sess->locate.userinfo = sess->locate.userinfo->next;
7046
4003419d753b [gaim-migrate @ 7609]
Mark Doliner <mark@kingant.net>
parents: 7045
diff changeset
1372 aim_info_free(del);
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1373 free(del);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1374 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1375 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1376
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1377 faim_internal int locate_modfirst(aim_session_t *sess, aim_module_t *mod)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1378 {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1379
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1380 mod->family = AIM_CB_FAM_LOC;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1381 mod->version = 0x0001;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1382 mod->toolid = 0x0110;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1383 mod->toolversion = 0x0629;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1384 mod->flags = 0;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1385 strncpy(mod->name, "locate", sizeof(mod->name));
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1386 mod->snachandler = snachandler;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1387 mod->shutdown = locate_shutdown;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1388
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1389 return 0;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1390 }