Wed, 13 May 2009 20:29:03 +0000
Support custom smileys in MUCs (when all participants support BoB and a maximum
of 10 participants are in the chat).
Always announce support for BoB, since disable custom smileys will still turn
off fetching them, and BoB can be used for other purposes further on.
| 13235 | 1 | /* |
| 15884 | 2 | * Purple's oscar protocol plugin |
| 13235 | 3 | * This file is the legal property of its developers. |
| 4 | * Please see the AUTHORS file distributed alongside this file. | |
| 5 | * | |
| 6 | * This library is free software; you can redistribute it and/or | |
| 7 | * modify it under the terms of the GNU Lesser General Public | |
| 8 | * License as published by the Free Software Foundation; either | |
| 9 | * version 2 of the License, or (at your option) any later version. | |
| 10 | * | |
| 11 | * This library is distributed in the hope that it will be useful, | |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 14 | * Lesser General Public License for more details. | |
| 15 | * | |
| 16 | * You should have received a copy of the GNU Lesser General Public | |
| 17 | * License along with this library; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18929
diff
changeset
|
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 13235 | 19 | */ |
| 20 | ||
| 21 | /* | |
| 22 | * Family 0x0002 - Locate. | |
| 23 | * | |
| 24 | * The functions here are responsible for requesting and parsing information- | |
| 25 | * gathering SNACs. Or something like that. This family contains the SNACs | |
| 26 | * for getting and setting info, away messages, directory profile thingy, etc. | |
| 27 | */ | |
| 28 | ||
| 29 | #include "oscar.h" | |
| 30 | #ifdef _WIN32 | |
| 31 | #include "win32dep.h" | |
| 32 | #endif | |
| 33 | ||
|
15318
6cd6b50e812b
[gaim-migrate @ 18046]
Evan Schoenberg <evands@pidgin.im>
parents:
15172
diff
changeset
|
34 | /* Define to log unknown TLVs */ |
|
6cd6b50e812b
[gaim-migrate @ 18046]
Evan Schoenberg <evands@pidgin.im>
parents:
15172
diff
changeset
|
35 | /* #define LOG_UNKNOWN_TLV */ |
|
6cd6b50e812b
[gaim-migrate @ 18046]
Evan Schoenberg <evands@pidgin.im>
parents:
15172
diff
changeset
|
36 | |
| 13235 | 37 | /* |
| 38 | * Capability blocks. | |
| 39 | * | |
| 40 | * These are CLSIDs. They should actually be of the form: | |
| 41 | * | |
| 42 | * {0x0946134b, 0x4c7f, 0x11d1, | |
| 43 | * {0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}}, | |
| 44 | * | |
| 45 | * But, eh. | |
| 46 | */ | |
| 47 | static const struct { | |
| 48 | guint32 flag; | |
| 49 | guint8 data[16]; | |
| 50 | } aim_caps[] = { | |
| 51 | ||
| 52 | /* | |
| 53 | * These are in ascending numerical order. | |
| 54 | */ | |
| 55 | ||
|
23903
7e03b023079f
Some cleanup to our capabilities definitions, and added information on
Evan Schoenberg <evands@pidgin.im>
parents:
23893
diff
changeset
|
56 | /* Client understands short caps, a UUID of the form |
|
7e03b023079f
Some cleanup to our capabilities definitions, and added information on
Evan Schoenberg <evands@pidgin.im>
parents:
23893
diff
changeset
|
57 | * 0946XXYY-4C7F-11D1-8222-444553540000 where XXYY is the short cap. */ |
|
7e03b023079f
Some cleanup to our capabilities definitions, and added information on
Evan Schoenberg <evands@pidgin.im>
parents:
23893
diff
changeset
|
58 | {OSCAR_CAPABILITY_SHORTCAPS, |
| 13235 | 59 | {0x09, 0x46, 0x00, 0x00, 0x4c, 0x7f, 0x11, 0xd1, |
| 60 | 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, | |
| 61 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
62 | {OSCAR_CAPABILITY_SECUREIM, |
| 13235 | 63 | {0x09, 0x46, 0x00, 0x01, 0x4c, 0x7f, 0x11, 0xd1, |
| 64 | 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, | |
| 65 | ||
|
23942
a28e1a09745a
Undid the addition of 2 OscarCapability items I added previously, keeping the commented-out notes in family_locate. We can't let the OscarCapability bitmask get as large as 0x04000000, because if it exceeds the platforms MAX_UINT we'll end up in an infinite loop in oscar_caps_to_string() due to overflow.
Evan Schoenberg <evands@pidgin.im>
parents:
23903
diff
changeset
|
66 | /* OSCAR_CAPABILITY_XHTML_IM */ |
|
a28e1a09745a
Undid the addition of 2 OscarCapability items I added previously, keeping the commented-out notes in family_locate. We can't let the OscarCapability bitmask get as large as 0x04000000, because if it exceeds the platforms MAX_UINT we'll end up in an infinite loop in oscar_caps_to_string() due to overflow.
Evan Schoenberg <evands@pidgin.im>
parents:
23903
diff
changeset
|
67 | {OSCAR_CAPABILITY_GENERICUNKNOWN, |
|
23903
7e03b023079f
Some cleanup to our capabilities definitions, and added information on
Evan Schoenberg <evands@pidgin.im>
parents:
23893
diff
changeset
|
68 | {0x09, 0x46, 0x00, 0x02, 0x4c, 0x7f, 0x11, 0xd1, |
|
7e03b023079f
Some cleanup to our capabilities definitions, and added information on
Evan Schoenberg <evands@pidgin.im>
parents:
23893
diff
changeset
|
69 | 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, |
|
7e03b023079f
Some cleanup to our capabilities definitions, and added information on
Evan Schoenberg <evands@pidgin.im>
parents:
23893
diff
changeset
|
70 | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
71 | {OSCAR_CAPABILITY_VIDEO, |
| 13235 | 72 | {0x09, 0x46, 0x01, 0x00, 0x4c, 0x7f, 0x11, 0xd1, |
| 73 | 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, | |
| 74 | ||
|
23903
7e03b023079f
Some cleanup to our capabilities definitions, and added information on
Evan Schoenberg <evands@pidgin.im>
parents:
23893
diff
changeset
|
75 | /* "Live Video" (SIP/RTC Video) support in Windows AIM 5.5.3501 and newer */ |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
76 | {OSCAR_CAPABILITY_LIVEVIDEO, |
| 13235 | 77 | {0x09, 0x46, 0x01, 0x01, 0x4c, 0x7f, 0x11, 0xd1, |
| 78 | 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, | |
| 79 | ||
| 80 | /* "Camera" support in Windows AIM 5.5.3501 and newer */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
81 | {OSCAR_CAPABILITY_CAMERA, |
| 13235 | 82 | {0x09, 0x46, 0x01, 0x02, 0x4c, 0x7f, 0x11, 0xd1, |
| 83 | 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, | |
| 84 | ||
|
23903
7e03b023079f
Some cleanup to our capabilities definitions, and added information on
Evan Schoenberg <evands@pidgin.im>
parents:
23893
diff
changeset
|
85 | /* "Microphone" support in Windows AIM 5.5.3501 and newer */ |
|
23942
a28e1a09745a
Undid the addition of 2 OscarCapability items I added previously, keeping the commented-out notes in family_locate. We can't let the OscarCapability bitmask get as large as 0x04000000, because if it exceeds the platforms MAX_UINT we'll end up in an infinite loop in oscar_caps_to_string() due to overflow.
Evan Schoenberg <evands@pidgin.im>
parents:
23903
diff
changeset
|
86 | /* OSCAR_CAPABILITY_MICROPHONE */ |
|
a28e1a09745a
Undid the addition of 2 OscarCapability items I added previously, keeping the commented-out notes in family_locate. We can't let the OscarCapability bitmask get as large as 0x04000000, because if it exceeds the platforms MAX_UINT we'll end up in an infinite loop in oscar_caps_to_string() due to overflow.
Evan Schoenberg <evands@pidgin.im>
parents:
23903
diff
changeset
|
87 | {OSCAR_CAPABILITY_GENERICUNKNOWN, |
|
23903
7e03b023079f
Some cleanup to our capabilities definitions, and added information on
Evan Schoenberg <evands@pidgin.im>
parents:
23893
diff
changeset
|
88 | {0x09, 0x46, 0x01, 0x03, 0x4c, 0x7f, 0x11, 0xd1, |
|
7e03b023079f
Some cleanup to our capabilities definitions, and added information on
Evan Schoenberg <evands@pidgin.im>
parents:
23893
diff
changeset
|
89 | 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, |
|
7e03b023079f
Some cleanup to our capabilities definitions, and added information on
Evan Schoenberg <evands@pidgin.im>
parents:
23893
diff
changeset
|
90 | |
|
7e03b023079f
Some cleanup to our capabilities definitions, and added information on
Evan Schoenberg <evands@pidgin.im>
parents:
23893
diff
changeset
|
91 | /* Supports RTC Audio */ |
|
7e03b023079f
Some cleanup to our capabilities definitions, and added information on
Evan Schoenberg <evands@pidgin.im>
parents:
23893
diff
changeset
|
92 | /* OSCAR_CAPABILITY_RTCAUDIO */ |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
93 | {OSCAR_CAPABILITY_GENERICUNKNOWN, |
|
23903
7e03b023079f
Some cleanup to our capabilities definitions, and added information on
Evan Schoenberg <evands@pidgin.im>
parents:
23893
diff
changeset
|
94 | {0x09, 0x46, 0x01, 0x04, 0x4c, 0x7f, 0x11, 0xd1, |
| 13235 | 95 | 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, |
| 96 | ||
| 97 | /* In iChatAV (version numbers...?) */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
98 | {OSCAR_CAPABILITY_ICHATAV, |
| 13235 | 99 | {0x09, 0x46, 0x01, 0x05, 0x4c, 0x7f, 0x11, 0xd1, |
| 100 | 0x82, 0x22, 0x44, 0x45, 0x45, 0x53, 0x54, 0x00}}, | |
| 101 | ||
|
23903
7e03b023079f
Some cleanup to our capabilities definitions, and added information on
Evan Schoenberg <evands@pidgin.im>
parents:
23893
diff
changeset
|
102 | /* Supports "new status message features" (Who advertises this one?) */ |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
25111
diff
changeset
|
103 | /* OSCAR_CAPABILITY_HOST_STATUS_TEXT_AWARE */ |
|
23903
7e03b023079f
Some cleanup to our capabilities definitions, and added information on
Evan Schoenberg <evands@pidgin.im>
parents:
23893
diff
changeset
|
104 | {OSCAR_CAPABILITY_GENERICUNKNOWN, |
|
7e03b023079f
Some cleanup to our capabilities definitions, and added information on
Evan Schoenberg <evands@pidgin.im>
parents:
23893
diff
changeset
|
105 | {0x09, 0x46, 0x01, 0x0a, 0x4c, 0x7f, 0x11, 0xd1, |
|
7e03b023079f
Some cleanup to our capabilities definitions, and added information on
Evan Schoenberg <evands@pidgin.im>
parents:
23893
diff
changeset
|
106 | 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, |
|
7e03b023079f
Some cleanup to our capabilities definitions, and added information on
Evan Schoenberg <evands@pidgin.im>
parents:
23893
diff
changeset
|
107 | |
|
7e03b023079f
Some cleanup to our capabilities definitions, and added information on
Evan Schoenberg <evands@pidgin.im>
parents:
23893
diff
changeset
|
108 | /* Supports "see as I type" (Who advertises this one?) */ |
|
7e03b023079f
Some cleanup to our capabilities definitions, and added information on
Evan Schoenberg <evands@pidgin.im>
parents:
23893
diff
changeset
|
109 | /* OSCAR_CAPABILITY_SEE_AS_I_TYPE */ |
|
7e03b023079f
Some cleanup to our capabilities definitions, and added information on
Evan Schoenberg <evands@pidgin.im>
parents:
23893
diff
changeset
|
110 | {OSCAR_CAPABILITY_GENERICUNKNOWN, |
|
7e03b023079f
Some cleanup to our capabilities definitions, and added information on
Evan Schoenberg <evands@pidgin.im>
parents:
23893
diff
changeset
|
111 | {0x09, 0x46, 0x01, 0x0b, 0x4c, 0x7f, 0x11, 0xd1, |
|
7e03b023079f
Some cleanup to our capabilities definitions, and added information on
Evan Schoenberg <evands@pidgin.im>
parents:
23893
diff
changeset
|
112 | 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, |
|
7e03b023079f
Some cleanup to our capabilities definitions, and added information on
Evan Schoenberg <evands@pidgin.im>
parents:
23893
diff
changeset
|
113 | |
|
7e03b023079f
Some cleanup to our capabilities definitions, and added information on
Evan Schoenberg <evands@pidgin.im>
parents:
23893
diff
changeset
|
114 | /* Client only asserts caps for services in which it is participating */ |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
25111
diff
changeset
|
115 | /* OSCAR_CAPABILITY_SMARTCAPS */ |
|
23903
7e03b023079f
Some cleanup to our capabilities definitions, and added information on
Evan Schoenberg <evands@pidgin.im>
parents:
23893
diff
changeset
|
116 | {OSCAR_CAPABILITY_GENERICUNKNOWN, |
| 13235 | 117 | {0x09, 0x46, 0x01, 0xff, 0x4c, 0x7f, 0x11, 0xd1, |
| 118 | 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, | |
| 119 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
120 | {OSCAR_CAPABILITY_HIPTOP, |
| 13235 | 121 | {0x09, 0x46, 0x13, 0x23, 0x4c, 0x7f, 0x11, 0xd1, |
| 122 | 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, | |
| 123 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
124 | {OSCAR_CAPABILITY_TALK, |
| 13235 | 125 | {0x09, 0x46, 0x13, 0x41, 0x4c, 0x7f, 0x11, 0xd1, |
| 126 | 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, | |
| 127 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
128 | {OSCAR_CAPABILITY_SENDFILE, |
| 13235 | 129 | {0x09, 0x46, 0x13, 0x43, 0x4c, 0x7f, 0x11, 0xd1, |
| 130 | 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, | |
| 131 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
132 | {OSCAR_CAPABILITY_ICQ_DIRECT, |
| 13235 | 133 | {0x09, 0x46, 0x13, 0x44, 0x4c, 0x7f, 0x11, 0xd1, |
| 134 | 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, | |
| 135 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
136 | {OSCAR_CAPABILITY_DIRECTIM, |
| 13235 | 137 | {0x09, 0x46, 0x13, 0x45, 0x4c, 0x7f, 0x11, 0xd1, |
| 138 | 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, | |
| 139 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
140 | {OSCAR_CAPABILITY_BUDDYICON, |
| 13235 | 141 | {0x09, 0x46, 0x13, 0x46, 0x4c, 0x7f, 0x11, 0xd1, |
| 142 | 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, | |
| 143 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
144 | {OSCAR_CAPABILITY_ADDINS, |
| 13235 | 145 | {0x09, 0x46, 0x13, 0x47, 0x4c, 0x7f, 0x11, 0xd1, |
| 146 | 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, | |
| 147 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
148 | {OSCAR_CAPABILITY_GETFILE, |
| 13235 | 149 | {0x09, 0x46, 0x13, 0x48, 0x4c, 0x7f, 0x11, 0xd1, |
| 150 | 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, | |
| 151 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
152 | {OSCAR_CAPABILITY_ICQSERVERRELAY, |
| 13235 | 153 | {0x09, 0x46, 0x13, 0x49, 0x4c, 0x7f, 0x11, 0xd1, |
| 154 | 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, | |
| 155 | ||
| 156 | /* | |
| 157 | * Indeed, there are two of these. The former appears to be correct, | |
| 158 | * but in some versions of winaim, the second one is set. Either they | |
| 159 | * forgot to fix endianness, or they made a typo. It really doesn't | |
| 160 | * matter which. | |
| 161 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
162 | {OSCAR_CAPABILITY_GAMES, |
| 13235 | 163 | {0x09, 0x46, 0x13, 0x4a, 0x4c, 0x7f, 0x11, 0xd1, |
| 164 | 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
165 | {OSCAR_CAPABILITY_GAMES2, |
| 13235 | 166 | {0x09, 0x46, 0x13, 0x4a, 0x4c, 0x7f, 0x11, 0xd1, |
| 167 | 0x22, 0x82, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, | |
| 168 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
169 | {OSCAR_CAPABILITY_SENDBUDDYLIST, |
| 13235 | 170 | {0x09, 0x46, 0x13, 0x4b, 0x4c, 0x7f, 0x11, 0xd1, |
| 171 | 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, | |
| 172 | ||
| 173 | /* | |
| 174 | * Setting this lets AIM users receive messages from ICQ users, and ICQ | |
| 175 | * users receive messages from AIM users. It also lets ICQ users show | |
| 176 | * up in buddy lists for AIM users, and AIM users show up in buddy lists | |
| 177 | * for ICQ users. And ICQ privacy/invisibility acts like AIM privacy, | |
| 178 | * in that if you add a user to your deny list, you will not be able to | |
| 179 | * see them as online (previous you could still see them, but they | |
| 180 | * couldn't see you. | |
| 181 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
182 | {OSCAR_CAPABILITY_INTEROPERATE, |
| 13235 | 183 | {0x09, 0x46, 0x13, 0x4d, 0x4c, 0x7f, 0x11, 0xd1, |
| 184 | 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, | |
| 185 | ||
|
14619
e3577fb5e0f1
[gaim-migrate @ 17280]
Mark Doliner <markdoliner@pidgin.im>
parents:
14611
diff
changeset
|
186 | {OSCAR_CAPABILITY_UNICODE, |
| 13235 | 187 | {0x09, 0x46, 0x13, 0x4e, 0x4c, 0x7f, 0x11, 0xd1, |
| 188 | 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, | |
| 189 | ||
|
14874
c46b3f074268
[gaim-migrate @ 17578]
Mark Doliner <markdoliner@pidgin.im>
parents:
14619
diff
changeset
|
190 | {OSCAR_CAPABILITY_GENERICUNKNOWN, |
|
c46b3f074268
[gaim-migrate @ 17578]
Mark Doliner <markdoliner@pidgin.im>
parents:
14619
diff
changeset
|
191 | {0x09, 0x46, 0xf0, 0x03, 0x4c, 0x7f, 0x11, 0xd1, |
|
c46b3f074268
[gaim-migrate @ 17578]
Mark Doliner <markdoliner@pidgin.im>
parents:
14619
diff
changeset
|
192 | 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, |
|
c46b3f074268
[gaim-migrate @ 17578]
Mark Doliner <markdoliner@pidgin.im>
parents:
14619
diff
changeset
|
193 | |
|
23459
7223e4117d47
Specified one of the OSCAR_CAPABILITY_GENERICUNKNOWN capabilities to be
Evan Schoenberg <evands@pidgin.im>
parents:
23456
diff
changeset
|
194 | {OSCAR_CAPABILITY_ICHAT_SCREENSHARE, |
|
14874
c46b3f074268
[gaim-migrate @ 17578]
Mark Doliner <markdoliner@pidgin.im>
parents:
14619
diff
changeset
|
195 | {0x09, 0x46, 0xf0, 0x04, 0x4c, 0x7f, 0x11, 0xd1, |
|
c46b3f074268
[gaim-migrate @ 17578]
Mark Doliner <markdoliner@pidgin.im>
parents:
14619
diff
changeset
|
196 | 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, |
|
c46b3f074268
[gaim-migrate @ 17578]
Mark Doliner <markdoliner@pidgin.im>
parents:
14619
diff
changeset
|
197 | |
|
c46b3f074268
[gaim-migrate @ 17578]
Mark Doliner <markdoliner@pidgin.im>
parents:
14619
diff
changeset
|
198 | {OSCAR_CAPABILITY_GENERICUNKNOWN, |
|
c46b3f074268
[gaim-migrate @ 17578]
Mark Doliner <markdoliner@pidgin.im>
parents:
14619
diff
changeset
|
199 | {0x09, 0x46, 0xf0, 0x05, 0x4c, 0x7f, 0x11, 0xd1, |
|
c46b3f074268
[gaim-migrate @ 17578]
Mark Doliner <markdoliner@pidgin.im>
parents:
14619
diff
changeset
|
200 | 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, |
|
c46b3f074268
[gaim-migrate @ 17578]
Mark Doliner <markdoliner@pidgin.im>
parents:
14619
diff
changeset
|
201 | |
|
14619
e3577fb5e0f1
[gaim-migrate @ 17280]
Mark Doliner <markdoliner@pidgin.im>
parents:
14611
diff
changeset
|
202 | {OSCAR_CAPABILITY_UNICODEOLD, |
| 13235 | 203 | {0x2e, 0x7a, 0x64, 0x75, 0xfa, 0xdf, 0x4d, 0xc8, |
| 204 | 0x88, 0x6f, 0xea, 0x35, 0x95, 0xfd, 0xb6, 0xdf}}, | |
| 205 | ||
|
25111
7a6728df7998
Advertise the same typing capability on OSCAR that ICQ 6 does, since we claim
Jaromír Karmazín <blue.beret@seznam.cz>
parents:
23942
diff
changeset
|
206 | {OSCAR_CAPABILITY_TYPING, |
|
14611
a97a41a6f1cf
[gaim-migrate @ 17272]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
207 | {0x56, 0x3f, 0xc8, 0x09, 0x0b, 0x6f, 0x41, 0xbd, |
|
a97a41a6f1cf
[gaim-migrate @ 17272]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
208 | 0x9f, 0x79, 0x42, 0x26, 0x09, 0xdf, 0xa2, 0xf3}}, |
|
a97a41a6f1cf
[gaim-migrate @ 17272]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
209 | |
|
a97a41a6f1cf
[gaim-migrate @ 17272]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
210 | /* |
| 13235 | 211 | * Chat is oddball. |
| 212 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
213 | {OSCAR_CAPABILITY_CHAT, |
| 13235 | 214 | {0x74, 0x8f, 0x24, 0x20, 0x62, 0x87, 0x11, 0xd1, |
| 215 | 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, | |
| 216 | ||
| 217 | /* This is added by the servers and it only shows up for ourselves... */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
218 | {OSCAR_CAPABILITY_GENERICUNKNOWN, |
| 13235 | 219 | {0x97, 0xb1, 0x27, 0x51, 0x24, 0x3c, 0x43, 0x34, |
| 220 | 0xad, 0x22, 0xd6, 0xab, 0xf7, 0x3f, 0x14, 0x09}}, | |
| 221 | ||
|
14874
c46b3f074268
[gaim-migrate @ 17578]
Mark Doliner <markdoliner@pidgin.im>
parents:
14619
diff
changeset
|
222 | {OSCAR_CAPABILITY_ICQRTF, |
|
c46b3f074268
[gaim-migrate @ 17578]
Mark Doliner <markdoliner@pidgin.im>
parents:
14619
diff
changeset
|
223 | {0x97, 0xb1, 0x27, 0x51, 0x24, 0x3c, 0x43, 0x34, |
|
c46b3f074268
[gaim-migrate @ 17578]
Mark Doliner <markdoliner@pidgin.im>
parents:
14619
diff
changeset
|
224 | 0xad, 0x22, 0xd6, 0xab, 0xf7, 0x3f, 0x14, 0x92}}, |
|
c46b3f074268
[gaim-migrate @ 17578]
Mark Doliner <markdoliner@pidgin.im>
parents:
14619
diff
changeset
|
225 | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
226 | {OSCAR_CAPABILITY_APINFO, |
| 13235 | 227 | {0xaa, 0x4a, 0x32, 0xb5, 0xf8, 0x84, 0x48, 0xc6, |
| 228 | 0xa3, 0xd7, 0x8c, 0x50, 0x97, 0x19, 0xfd, 0x5b}}, | |
| 229 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
230 | {OSCAR_CAPABILITY_TRILLIANCRYPT, |
| 13235 | 231 | {0xf2, 0xe7, 0xc7, 0xf4, 0xfe, 0xad, 0x4d, 0xfb, |
| 232 | 0xb2, 0x35, 0x36, 0x79, 0x8b, 0xdf, 0x00, 0x00}}, | |
| 233 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
234 | {OSCAR_CAPABILITY_EMPTY, |
| 13235 | 235 | {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 236 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}, | |
| 237 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
238 | {OSCAR_CAPABILITY_LAST, |
| 13235 | 239 | {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 240 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}, | |
| 241 | }; | |
| 242 | ||
| 243 | /* | |
| 244 | * Add the userinfo to our linked list. If we already have userinfo | |
| 245 | * for this buddy, then just overwrite parts of the old data. | |
| 246 | * | |
| 247 | * @param userinfo Contains the new information for the buddy. | |
| 248 | */ | |
|
13598
04f6791f65e0
[gaim-migrate @ 15983]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
249 | static void |
|
04f6791f65e0
[gaim-migrate @ 15983]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
250 | aim_locate_adduserinfo(OscarData *od, aim_userinfo_t *userinfo) |
|
04f6791f65e0
[gaim-migrate @ 15983]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
251 | { |
| 13235 | 252 | aim_userinfo_t *cur; |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
253 | FlapConnection *conn; |
| 13235 | 254 | aim_rxcallback_t userfunc; |
| 255 | ||
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
256 | cur = aim_locate_finduserinfo(od, userinfo->bn); |
| 13235 | 257 | |
| 258 | if (cur == NULL) { | |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
259 | cur = (aim_userinfo_t *)g_new0(aim_userinfo_t, 1); |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
260 | cur->bn = g_strdup(userinfo->bn); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
261 | cur->next = od->locate.userinfo; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
262 | od->locate.userinfo = cur; |
| 13235 | 263 | } |
| 264 | ||
| 265 | cur->warnlevel = userinfo->warnlevel; | |
| 266 | cur->idletime = userinfo->idletime; | |
| 267 | if (userinfo->flags != 0) | |
| 268 | cur->flags = userinfo->flags; | |
| 269 | if (userinfo->createtime != 0) | |
| 270 | cur->createtime = userinfo->createtime; | |
| 271 | if (userinfo->membersince != 0) | |
| 272 | cur->membersince = userinfo->membersince; | |
| 273 | if (userinfo->onlinesince != 0) | |
| 274 | cur->onlinesince = userinfo->onlinesince; | |
| 275 | if (userinfo->sessionlen != 0) | |
| 276 | cur->sessionlen = userinfo->sessionlen; | |
| 277 | if (userinfo->capabilities != 0) | |
| 278 | cur->capabilities = userinfo->capabilities; | |
| 279 | cur->present |= userinfo->present; | |
| 280 | ||
| 281 | if (userinfo->iconcsumlen > 0) { | |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
282 | g_free(cur->iconcsum); |
|
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
283 | cur->iconcsum = (guint8 *)g_malloc(userinfo->iconcsumlen); |
| 13235 | 284 | memcpy(cur->iconcsum, userinfo->iconcsum, userinfo->iconcsumlen); |
| 285 | cur->iconcsumlen = userinfo->iconcsumlen; | |
| 286 | } | |
| 287 | ||
| 288 | if (userinfo->info != NULL) { | |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
289 | g_free(cur->info); |
|
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
290 | g_free(cur->info_encoding); |
| 13235 | 291 | if (userinfo->info_len > 0) { |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
292 | cur->info = (char *)g_malloc(userinfo->info_len); |
| 13235 | 293 | memcpy(cur->info, userinfo->info, userinfo->info_len); |
| 294 | } else | |
| 295 | cur->info = NULL; | |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
296 | cur->info_encoding = g_strdup(userinfo->info_encoding); |
| 13235 | 297 | cur->info_len = userinfo->info_len; |
| 298 | } | |
| 299 | ||
| 300 | if (userinfo->status != NULL) { | |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
301 | g_free(cur->status); |
|
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
302 | g_free(cur->status_encoding); |
| 13235 | 303 | if (userinfo->status_len > 0) { |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
304 | cur->status = (char *)g_malloc(userinfo->status_len); |
| 13235 | 305 | memcpy(cur->status, userinfo->status, userinfo->status_len); |
| 306 | } else | |
| 307 | cur->status = NULL; | |
| 308 | if (userinfo->status_encoding != NULL) | |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
309 | cur->status_encoding = g_strdup(userinfo->status_encoding); |
| 13235 | 310 | else |
| 311 | cur->status_encoding = NULL; | |
| 312 | cur->status_len = userinfo->status_len; | |
| 313 | } | |
| 314 | ||
|
16397
68d0b988e78c
Add the iTunes Music Store url to the GaimPresence for buddies onyour
Mark Doliner <markdoliner@pidgin.im>
parents:
15884
diff
changeset
|
315 | if (userinfo->itmsurl != NULL) { |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
316 | g_free(cur->itmsurl); |
|
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
317 | g_free(cur->itmsurl_encoding); |
|
16397
68d0b988e78c
Add the iTunes Music Store url to the GaimPresence for buddies onyour
Mark Doliner <markdoliner@pidgin.im>
parents:
15884
diff
changeset
|
318 | if (userinfo->itmsurl_len > 0) { |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
319 | cur->itmsurl = (char *)g_malloc(userinfo->itmsurl_len); |
|
16397
68d0b988e78c
Add the iTunes Music Store url to the GaimPresence for buddies onyour
Mark Doliner <markdoliner@pidgin.im>
parents:
15884
diff
changeset
|
320 | memcpy(cur->itmsurl, userinfo->itmsurl, userinfo->itmsurl_len); |
|
68d0b988e78c
Add the iTunes Music Store url to the GaimPresence for buddies onyour
Mark Doliner <markdoliner@pidgin.im>
parents:
15884
diff
changeset
|
321 | } else |
|
68d0b988e78c
Add the iTunes Music Store url to the GaimPresence for buddies onyour
Mark Doliner <markdoliner@pidgin.im>
parents:
15884
diff
changeset
|
322 | cur->itmsurl = NULL; |
|
68d0b988e78c
Add the iTunes Music Store url to the GaimPresence for buddies onyour
Mark Doliner <markdoliner@pidgin.im>
parents:
15884
diff
changeset
|
323 | if (userinfo->itmsurl_encoding != NULL) |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
324 | cur->itmsurl_encoding = g_strdup(userinfo->itmsurl_encoding); |
|
16397
68d0b988e78c
Add the iTunes Music Store url to the GaimPresence for buddies onyour
Mark Doliner <markdoliner@pidgin.im>
parents:
15884
diff
changeset
|
325 | else |
|
68d0b988e78c
Add the iTunes Music Store url to the GaimPresence for buddies onyour
Mark Doliner <markdoliner@pidgin.im>
parents:
15884
diff
changeset
|
326 | cur->itmsurl_encoding = NULL; |
|
68d0b988e78c
Add the iTunes Music Store url to the GaimPresence for buddies onyour
Mark Doliner <markdoliner@pidgin.im>
parents:
15884
diff
changeset
|
327 | cur->itmsurl_len = userinfo->itmsurl_len; |
|
68d0b988e78c
Add the iTunes Music Store url to the GaimPresence for buddies onyour
Mark Doliner <markdoliner@pidgin.im>
parents:
15884
diff
changeset
|
328 | } |
|
68d0b988e78c
Add the iTunes Music Store url to the GaimPresence for buddies onyour
Mark Doliner <markdoliner@pidgin.im>
parents:
15884
diff
changeset
|
329 | |
| 13235 | 330 | if (userinfo->away != NULL) { |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
331 | g_free(cur->away); |
|
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
332 | g_free(cur->away_encoding); |
| 13235 | 333 | if (userinfo->away_len > 0) { |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
334 | cur->away = (char *)g_malloc(userinfo->away_len); |
| 13235 | 335 | memcpy(cur->away, userinfo->away, userinfo->away_len); |
| 336 | } else | |
| 337 | cur->away = NULL; | |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
338 | cur->away_encoding = g_strdup(userinfo->away_encoding); |
| 13235 | 339 | cur->away_len = userinfo->away_len; |
|
15318
6cd6b50e812b
[gaim-migrate @ 18046]
Evan Schoenberg <evands@pidgin.im>
parents:
15172
diff
changeset
|
340 | |
|
22129
de49baa51fc0
Some changes intended to make oscar not emit so many
Mark Doliner <markdoliner@pidgin.im>
parents:
22128
diff
changeset
|
341 | } else { |
|
15318
6cd6b50e812b
[gaim-migrate @ 18046]
Evan Schoenberg <evands@pidgin.im>
parents:
15172
diff
changeset
|
342 | /* |
|
22129
de49baa51fc0
Some changes intended to make oscar not emit so many
Mark Doliner <markdoliner@pidgin.im>
parents:
22128
diff
changeset
|
343 | * We don't have an away message specified in this user_info |
|
de49baa51fc0
Some changes intended to make oscar not emit so many
Mark Doliner <markdoliner@pidgin.im>
parents:
22128
diff
changeset
|
344 | * block, so clear any cached away message now. |
|
15318
6cd6b50e812b
[gaim-migrate @ 18046]
Evan Schoenberg <evands@pidgin.im>
parents:
15172
diff
changeset
|
345 | */ |
|
6cd6b50e812b
[gaim-migrate @ 18046]
Evan Schoenberg <evands@pidgin.im>
parents:
15172
diff
changeset
|
346 | if (cur->away) { |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
347 | g_free(cur->away); |
|
15318
6cd6b50e812b
[gaim-migrate @ 18046]
Evan Schoenberg <evands@pidgin.im>
parents:
15172
diff
changeset
|
348 | cur->away = NULL; |
|
6cd6b50e812b
[gaim-migrate @ 18046]
Evan Schoenberg <evands@pidgin.im>
parents:
15172
diff
changeset
|
349 | } |
|
6cd6b50e812b
[gaim-migrate @ 18046]
Evan Schoenberg <evands@pidgin.im>
parents:
15172
diff
changeset
|
350 | if (cur->away_encoding) { |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
351 | g_free(cur->away_encoding); |
|
15318
6cd6b50e812b
[gaim-migrate @ 18046]
Evan Schoenberg <evands@pidgin.im>
parents:
15172
diff
changeset
|
352 | cur->away_encoding = NULL; |
|
6cd6b50e812b
[gaim-migrate @ 18046]
Evan Schoenberg <evands@pidgin.im>
parents:
15172
diff
changeset
|
353 | } |
|
6cd6b50e812b
[gaim-migrate @ 18046]
Evan Schoenberg <evands@pidgin.im>
parents:
15172
diff
changeset
|
354 | cur->away_len = 0; |
| 13235 | 355 | } |
| 356 | ||
| 357 | /* | |
| 358 | * This callback can be used by a client if they want to know whenever | |
| 359 | * info for a buddy is updated. For example, if a client shows away | |
| 360 | * messages in its buddy list, then it would need to know if a user's | |
| 361 | * away message changes. | |
| 362 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
363 | conn = flap_connection_findbygroup(od, SNAC_FAMILY_LOCATE); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
364 | if ((userfunc = aim_callhandler(od, SNAC_FAMILY_LOCATE, SNAC_SUBTYPE_LOCATE_GOTINFOBLOCK))) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
365 | userfunc(od, conn, NULL, cur); |
| 13235 | 366 | } |
| 367 | ||
| 368 | /** | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
369 | * Remove this buddy name from our queue. If this info was requested |
| 13235 | 370 | * by our info request queue, then pop the next element off of the queue. |
| 371 | * | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
372 | * @param od The aim session. |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
373 | * @param bn Buddy name of the info we just received. |
| 13235 | 374 | * @return True if the request was explicit (client requested the info), |
| 375 | * false if the request was implicit (libfaim request the info). | |
| 376 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
377 | static int |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
378 | aim_locate_gotuserinfo(OscarData *od, FlapConnection *conn, const char *bn) |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
379 | { |
| 13235 | 380 | struct userinfo_node *cur, *del; |
| 381 | int was_explicit = TRUE; | |
| 382 | ||
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
383 | while ((od->locate.requested != NULL) && (oscar_util_name_compare(bn, od->locate.requested->bn) == 0)) { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
384 | del = od->locate.requested; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
385 | od->locate.requested = del->next; |
| 13235 | 386 | was_explicit = FALSE; |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
387 | g_free(del->bn); |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
388 | g_free(del); |
| 13235 | 389 | } |
| 390 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
391 | cur = od->locate.requested; |
| 13235 | 392 | while ((cur != NULL) && (cur->next != NULL)) { |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
393 | if (oscar_util_name_compare(bn, cur->next->bn) == 0) { |
| 13235 | 394 | del = cur->next; |
| 395 | cur->next = del->next; | |
| 396 | was_explicit = FALSE; | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
397 | g_free(del->bn); |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
398 | g_free(del); |
| 13235 | 399 | } else |
| 400 | cur = cur->next; | |
| 401 | } | |
| 402 | ||
| 403 | return was_explicit; | |
| 404 | } | |
| 405 | ||
|
13598
04f6791f65e0
[gaim-migrate @ 15983]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
406 | void |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
407 | aim_locate_autofetch_away_message(OscarData *od, const char *bn) |
|
13598
04f6791f65e0
[gaim-migrate @ 15983]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
408 | { |
| 13235 | 409 | struct userinfo_node *cur; |
| 410 | ||
|
22250
0b257489e547
Two performance/network bandwidth related changes here, care of meebo.
Mark Doliner <markdoliner@pidgin.im>
parents:
22129
diff
changeset
|
411 | /* Make sure we haven't already made an info request for this buddy */ |
|
22128
b6e6e3a0afb4
Now that oscar throttles itself as it approaches the rate limit, we can
Mark Doliner <markdoliner@pidgin.im>
parents:
19860
diff
changeset
|
412 | for (cur = od->locate.requested; cur != NULL; cur = cur->next) |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
413 | if (oscar_util_name_compare(bn, cur->bn) == 0) |
| 13235 | 414 | return; |
| 415 | ||
| 416 | /* Add a new node to our request queue */ | |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
417 | cur = (struct userinfo_node *)g_malloc(sizeof(struct userinfo_node)); |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
418 | cur->bn = g_strdup(bn); |
|
22128
b6e6e3a0afb4
Now that oscar throttles itself as it approaches the rate limit, we can
Mark Doliner <markdoliner@pidgin.im>
parents:
19860
diff
changeset
|
419 | cur->next = od->locate.requested; |
|
b6e6e3a0afb4
Now that oscar throttles itself as it approaches the rate limit, we can
Mark Doliner <markdoliner@pidgin.im>
parents:
19860
diff
changeset
|
420 | od->locate.requested = cur; |
| 13235 | 421 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
422 | aim_locate_getinfoshort(od, cur->bn, 0x00000002); |
| 13235 | 423 | } |
| 424 | ||
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
425 | aim_userinfo_t *aim_locate_finduserinfo(OscarData *od, const char *bn) { |
| 13235 | 426 | aim_userinfo_t *cur = NULL; |
| 427 | ||
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
428 | if (bn == NULL) |
| 13235 | 429 | return NULL; |
| 430 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
431 | cur = od->locate.userinfo; |
| 13235 | 432 | |
| 433 | while (cur != NULL) { | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
434 | if (oscar_util_name_compare(cur->bn, bn) == 0) |
| 13235 | 435 | return cur; |
| 436 | cur = cur->next; | |
| 437 | } | |
| 438 | ||
| 439 | return NULL; | |
| 440 | } | |
| 441 | ||
|
13598
04f6791f65e0
[gaim-migrate @ 15983]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
442 | guint32 |
|
04f6791f65e0
[gaim-migrate @ 15983]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
443 | aim_locate_getcaps(OscarData *od, ByteStream *bs, int len) |
| 13235 | 444 | { |
| 445 | guint32 flags = 0; | |
| 446 | int offset; | |
| 447 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
448 | for (offset = 0; byte_stream_empty(bs) && (offset < len); offset += 0x10) { |
| 13235 | 449 | guint8 *cap; |
| 450 | int i, identified; | |
| 451 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
452 | cap = byte_stream_getraw(bs, 0x10); |
| 13235 | 453 | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
454 | for (i = 0, identified = 0; !(aim_caps[i].flag & OSCAR_CAPABILITY_LAST); i++) { |
| 13235 | 455 | if (memcmp(&aim_caps[i].data, cap, 0x10) == 0) { |
| 456 | flags |= aim_caps[i].flag; | |
| 457 | identified++; | |
| 458 | break; /* should only match once... */ | |
| 459 | } | |
| 460 | } | |
| 461 | ||
| 462 | if (!identified) | |
| 15884 | 463 | purple_debug_misc("oscar", "unknown capability: {%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n", |
| 13235 | 464 | cap[0], cap[1], cap[2], cap[3], |
| 465 | cap[4], cap[5], | |
| 466 | cap[6], cap[7], | |
| 467 | cap[8], cap[9], | |
| 468 | cap[10], cap[11], cap[12], cap[13], | |
| 469 | cap[14], cap[15]); | |
| 470 | ||
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
471 | g_free(cap); |
| 13235 | 472 | } |
| 473 | ||
| 474 | return flags; | |
| 475 | } | |
| 476 | ||
|
13598
04f6791f65e0
[gaim-migrate @ 15983]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
477 | guint32 |
|
04f6791f65e0
[gaim-migrate @ 15983]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
478 | aim_locate_getcaps_short(OscarData *od, ByteStream *bs, int len) |
| 13235 | 479 | { |
| 480 | guint32 flags = 0; | |
| 481 | int offset; | |
| 482 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
483 | for (offset = 0; byte_stream_empty(bs) && (offset < len); offset += 0x02) { |
| 13235 | 484 | guint8 *cap; |
| 485 | int i, identified; | |
| 486 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
487 | cap = byte_stream_getraw(bs, 0x02); |
| 13235 | 488 | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
489 | for (i = 0, identified = 0; !(aim_caps[i].flag & OSCAR_CAPABILITY_LAST); i++) { |
| 13235 | 490 | if (memcmp(&aim_caps[i].data[2], cap, 0x02) == 0) { |
| 491 | flags |= aim_caps[i].flag; | |
| 492 | identified++; | |
| 493 | break; /* should only match once... */ | |
| 494 | } | |
| 495 | } | |
| 496 | ||
| 497 | if (!identified) | |
| 15884 | 498 | purple_debug_misc("oscar", "unknown short capability: {%02x%02x}\n", cap[0], cap[1]); |
| 13235 | 499 | |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
500 | g_free(cap); |
| 13235 | 501 | } |
| 502 | ||
| 503 | return flags; | |
| 504 | } | |
| 505 | ||
|
13598
04f6791f65e0
[gaim-migrate @ 15983]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
506 | int |
|
04f6791f65e0
[gaim-migrate @ 15983]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
507 | byte_stream_putcaps(ByteStream *bs, guint32 caps) |
| 13235 | 508 | { |
| 509 | int i; | |
| 510 | ||
| 511 | if (!bs) | |
| 512 | return -EINVAL; | |
| 513 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
514 | for (i = 0; byte_stream_empty(bs); i++) { |
| 13235 | 515 | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
516 | if (aim_caps[i].flag == OSCAR_CAPABILITY_LAST) |
| 13235 | 517 | break; |
| 518 | ||
| 519 | if (caps & aim_caps[i].flag) | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
520 | byte_stream_putraw(bs, aim_caps[i].data, 0x10); |
| 13235 | 521 | |
| 522 | } | |
| 523 | ||
| 524 | return 0; | |
| 525 | } | |
| 526 | ||
|
15318
6cd6b50e812b
[gaim-migrate @ 18046]
Evan Schoenberg <evands@pidgin.im>
parents:
15172
diff
changeset
|
527 | #ifdef LOG_UNKNOWN_TLV |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
528 | static void |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
529 | dumptlv(OscarData *od, guint16 type, ByteStream *bs, guint8 len) |
| 13235 | 530 | { |
| 531 | int i; | |
| 532 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
533 | if (!od || !bs || !len) |
| 13235 | 534 | return; |
| 535 | ||
| 15884 | 536 | purple_debug_misc("oscar", "userinfo: type =0x%04x\n", type); |
| 537 | purple_debug_misc("oscar", "userinfo: length=0x%04x\n", len); | |
| 538 | purple_debug_misc("oscar", "userinfo: value:\n"); | |
| 13235 | 539 | |
| 540 | for (i = 0; i < len; i++) { | |
| 541 | if ((i % 8) == 0) | |
| 15884 | 542 | purple_debug_misc("oscar", "\nuserinfo: "); |
| 543 | purple_debug_misc("oscar", "0x%2x ", byte_stream_get8(bs)); | |
| 13235 | 544 | } |
| 545 | ||
| 15884 | 546 | purple_debug_misc("oscar", "\n"); |
| 13235 | 547 | |
| 548 | return; | |
| 549 | } | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
550 | #endif |
| 13235 | 551 | |
|
13598
04f6791f65e0
[gaim-migrate @ 15983]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
552 | void |
|
04f6791f65e0
[gaim-migrate @ 15983]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
553 | aim_info_free(aim_userinfo_t *info) |
| 13235 | 554 | { |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
555 | g_free(info->bn); |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
556 | g_free(info->iconcsum); |
|
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
557 | g_free(info->info); |
|
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
558 | g_free(info->info_encoding); |
|
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
559 | g_free(info->status); |
|
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
560 | g_free(info->status_encoding); |
|
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
561 | g_free(info->itmsurl); |
|
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
562 | g_free(info->itmsurl_encoding); |
|
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
563 | g_free(info->away); |
|
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
564 | g_free(info->away_encoding); |
| 13235 | 565 | } |
| 566 | ||
| 567 | /* | |
| 568 | * AIM is fairly regular about providing user info. This is a generic | |
| 569 | * routine to extract it in its standard form. | |
| 570 | */ | |
|
13598
04f6791f65e0
[gaim-migrate @ 15983]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
571 | int |
|
04f6791f65e0
[gaim-migrate @ 15983]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
572 | aim_info_extract(OscarData *od, ByteStream *bs, aim_userinfo_t *outinfo) |
| 13235 | 573 | { |
| 574 | int curtlv, tlvcnt; | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
575 | guint8 bnlen; |
| 13235 | 576 | |
| 577 | if (!bs || !outinfo) | |
| 578 | return -EINVAL; | |
| 579 | ||
| 580 | /* Clear out old data first */ | |
| 581 | memset(outinfo, 0x00, sizeof(aim_userinfo_t)); | |
| 582 | ||
| 583 | /* | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
584 | * Username. Stored as an unterminated string prepended with a |
| 13235 | 585 | * byte containing its length. |
| 586 | */ | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
587 | bnlen = byte_stream_get8(bs); |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
588 | outinfo->bn = byte_stream_getstr(bs, bnlen); |
| 13235 | 589 | |
| 590 | /* | |
| 591 | * Warning Level. Stored as an unsigned short. | |
| 592 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
593 | outinfo->warnlevel = byte_stream_get16(bs); |
| 13235 | 594 | |
| 595 | /* | |
| 596 | * TLV Count. Unsigned short representing the number of | |
| 597 | * Type-Length-Value triples that follow. | |
| 598 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
599 | tlvcnt = byte_stream_get16(bs); |
| 13235 | 600 | |
| 601 | /* | |
| 602 | * Parse out the Type-Length-Value triples as they're found. | |
| 603 | */ | |
| 604 | for (curtlv = 0; curtlv < tlvcnt; curtlv++) { | |
|
19860
6f75ff7c4895
Looks like I might have been wrong about the length being only 8 bits.
Mark Doliner <markdoliner@pidgin.im>
parents:
19859
diff
changeset
|
605 | guint16 type, length; |
| 13235 | 606 | int endpos; |
| 607 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
608 | type = byte_stream_get16(bs); |
|
19860
6f75ff7c4895
Looks like I might have been wrong about the length being only 8 bits.
Mark Doliner <markdoliner@pidgin.im>
parents:
19859
diff
changeset
|
609 | length = byte_stream_get16(bs); |
| 13235 | 610 | |
|
18929
946ac80fc144
Hopefully fix a hella sporadic infinite loop bug in ICQ (and maybe AIM).
Mark Doliner <markdoliner@pidgin.im>
parents:
18914
diff
changeset
|
611 | endpos = byte_stream_curpos(bs) + MIN(length, byte_stream_empty(bs)); |
| 13235 | 612 | |
| 613 | if (type == 0x0001) { | |
| 614 | /* | |
|
14611
a97a41a6f1cf
[gaim-migrate @ 17272]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
615 | * User flags |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
616 | * |
| 13235 | 617 | * Specified as any of the following ORed together: |
| 618 | * 0x0001 Trial (user less than 60days) | |
| 619 | * 0x0002 Unknown bit 2 | |
| 620 | * 0x0004 AOL Main Service user | |
| 621 | * 0x0008 Unknown bit 4 | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
622 | * 0x0010 Free (AIM) user |
| 13235 | 623 | * 0x0020 Away |
| 624 | * 0x0400 ActiveBuddy | |
| 625 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
626 | outinfo->flags = byte_stream_get16(bs); |
| 13235 | 627 | outinfo->present |= AIM_USERINFO_PRESENT_FLAGS; |
| 628 | ||
| 629 | } else if (type == 0x0002) { | |
| 630 | /* | |
|
14611
a97a41a6f1cf
[gaim-migrate @ 17272]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
631 | * Account creation time |
| 13235 | 632 | * |
| 633 | * The time/date that the user originally registered for | |
| 634 | * the service, stored in time_t format. | |
| 635 | * | |
| 636 | * I'm not sure how this differs from type 5 ("member | |
| 637 | * since"). | |
| 638 | * | |
| 639 | * Note: This is the field formerly known as "member | |
| 640 | * since". All these years and I finally found out | |
| 641 | * that I got the name wrong. | |
| 642 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
643 | outinfo->createtime = byte_stream_get32(bs); |
| 13235 | 644 | outinfo->present |= AIM_USERINFO_PRESENT_CREATETIME; |
| 645 | ||
| 646 | } else if (type == 0x0003) { | |
| 647 | /* | |
|
14611
a97a41a6f1cf
[gaim-migrate @ 17272]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
648 | * On-Since date |
| 13235 | 649 | * |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
650 | * The time/date that the user started their current |
| 13235 | 651 | * session, stored in time_t format. |
| 652 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
653 | outinfo->onlinesince = byte_stream_get32(bs); |
| 13235 | 654 | outinfo->present |= AIM_USERINFO_PRESENT_ONLINESINCE; |
| 655 | ||
| 656 | } else if (type == 0x0004) { | |
| 657 | /* | |
|
14611
a97a41a6f1cf
[gaim-migrate @ 17272]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
658 | * Idle time |
| 13235 | 659 | * |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
660 | * Number of minutes since the user actively used the |
| 13235 | 661 | * service. |
| 662 | * | |
| 663 | * Note that the client tells the server when to start | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
664 | * counting idle times, so this may or may not be |
| 13235 | 665 | * related to reality. |
| 666 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
667 | outinfo->idletime = byte_stream_get16(bs); |
| 13235 | 668 | outinfo->present |= AIM_USERINFO_PRESENT_IDLE; |
| 669 | ||
| 670 | } else if (type == 0x0005) { | |
| 671 | /* | |
|
14611
a97a41a6f1cf
[gaim-migrate @ 17272]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
672 | * Member since date |
| 13235 | 673 | * |
| 674 | * The time/date that the user originally registered for | |
| 675 | * the service, stored in time_t format. | |
| 676 | * | |
| 677 | * This is sometimes sent instead of type 2 ("account | |
| 678 | * creation time"), particularly in the self-info. | |
| 679 | * And particularly for ICQ? | |
| 680 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
681 | outinfo->membersince = byte_stream_get32(bs); |
| 13235 | 682 | outinfo->present |= AIM_USERINFO_PRESENT_MEMBERSINCE; |
| 683 | ||
| 684 | } else if (type == 0x0006) { | |
| 685 | /* | |
|
14611
a97a41a6f1cf
[gaim-migrate @ 17272]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
686 | * ICQ Online Status |
| 13235 | 687 | * |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
688 | * ICQ's Away/DND/etc "enriched" status. Some decoding |
| 13235 | 689 | * of values done by Scott <darkagl@pcnet.com> |
| 690 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
691 | byte_stream_get16(bs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
692 | outinfo->icqinfo.status = byte_stream_get16(bs); |
| 13235 | 693 | outinfo->present |= AIM_USERINFO_PRESENT_ICQEXTSTATUS; |
| 694 | ||
| 695 | } else if (type == 0x0008) { | |
| 696 | /* | |
| 697 | * Client type, or some such. | |
| 698 | */ | |
| 699 | ||
| 700 | } else if (type == 0x000a) { | |
| 701 | /* | |
|
14611
a97a41a6f1cf
[gaim-migrate @ 17272]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
702 | * ICQ User IP Address |
| 13235 | 703 | * |
| 704 | * Ahh, the joy of ICQ security. | |
| 705 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
706 | outinfo->icqinfo.ipaddr = byte_stream_get32(bs); |
| 13235 | 707 | outinfo->present |= AIM_USERINFO_PRESENT_ICQIPADDR; |
| 708 | ||
| 709 | } else if (type == 0x000c) { | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
710 | /* |
|
14611
a97a41a6f1cf
[gaim-migrate @ 17272]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
711 | * Random crap containing the IP address, |
| 13235 | 712 | * apparently a port number, and some Other Stuff. |
| 713 | * | |
| 714 | * Format is: | |
| 715 | * 4 bytes - Our IP address, 0xc0 a8 01 2b for 192.168.1.43 | |
| 716 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
717 | byte_stream_getrawbuf(bs, outinfo->icqinfo.crap, 0x25); |
| 13235 | 718 | outinfo->present |= AIM_USERINFO_PRESENT_ICQDATA; |
| 719 | ||
| 720 | } else if (type == 0x000d) { | |
| 721 | /* | |
|
14611
a97a41a6f1cf
[gaim-migrate @ 17272]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
722 | * OSCAR Capability information |
| 13235 | 723 | */ |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
724 | outinfo->capabilities |= aim_locate_getcaps(od, bs, length); |
| 13235 | 725 | outinfo->present |= AIM_USERINFO_PRESENT_CAPABILITIES; |
| 726 | ||
| 727 | } else if (type == 0x000e) { | |
| 728 | /* | |
|
14611
a97a41a6f1cf
[gaim-migrate @ 17272]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
729 | * AOL capability information |
| 13235 | 730 | */ |
| 731 | ||
| 732 | } else if ((type == 0x000f) || (type == 0x0010)) { | |
| 733 | /* | |
| 734 | * Type = 0x000f: Session Length. (AIM) | |
| 735 | * Type = 0x0010: Session Length. (AOL) | |
| 736 | * | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
737 | * The duration, in seconds, of the user's current |
| 13235 | 738 | * session. |
| 739 | * | |
| 740 | * Which TLV type this comes in depends on the | |
| 741 | * service the user is using (AIM or AOL). | |
| 742 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
743 | outinfo->sessionlen = byte_stream_get32(bs); |
| 13235 | 744 | outinfo->present |= AIM_USERINFO_PRESENT_SESSIONLEN; |
| 745 | ||
| 746 | } else if (type == 0x0019) { | |
| 747 | /* | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
748 | * OSCAR short capability information. A shortened |
| 13235 | 749 | * form of the normal capabilities. |
| 750 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
751 | outinfo->capabilities |= aim_locate_getcaps_short(od, bs, length); |
| 13235 | 752 | outinfo->present |= AIM_USERINFO_PRESENT_CAPABILITIES; |
| 753 | ||
|
14611
a97a41a6f1cf
[gaim-migrate @ 17272]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
754 | } else if (type == 0x001a) { |
| 13235 | 755 | /* |
| 756 | * Type = 0x001a | |
| 757 | * | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
758 | * AOL short capability information. A shortened |
| 13235 | 759 | * form of the normal capabilities. |
| 760 | */ | |
| 761 | ||
| 762 | } else if (type == 0x001b) { | |
| 763 | /* | |
| 764 | * Encryption certification MD5 checksum. | |
| 765 | */ | |
| 766 | ||
| 767 | } else if (type == 0x001d) { | |
| 768 | /* | |
| 769 | * Buddy icon information and status/available messages. | |
| 770 | * | |
| 771 | * This almost seems like the AIM protocol guys gave | |
| 772 | * the iChat guys a Type, and the iChat guys tried to | |
| 773 | * cram as much cool shit into it as possible. Then | |
| 774 | * the Windows AIM guys were like, "hey, that's | |
| 775 | * pretty neat, let's copy those prawns." | |
| 776 | * | |
| 777 | * In that spirit, this can contain a custom message, | |
| 778 | * kind of like an away message, but you're not away | |
| 779 | * (it's called an "available" message). Or it can | |
| 780 | * contain information about the buddy icon the user | |
| 781 | * has stored on the server. | |
| 782 | */ | |
|
18914
bdcc8939807b
Another stab at fixing that signon infinite loop
Mark Doliner <markdoliner@pidgin.im>
parents:
18913
diff
changeset
|
783 | guint16 type2; |
|
18929
946ac80fc144
Hopefully fix a hella sporadic infinite loop bug in ICQ (and maybe AIM).
Mark Doliner <markdoliner@pidgin.im>
parents:
18914
diff
changeset
|
784 | guint8 number2, length2; |
|
18914
bdcc8939807b
Another stab at fixing that signon infinite loop
Mark Doliner <markdoliner@pidgin.im>
parents:
18913
diff
changeset
|
785 | int endpos2; |
| 13235 | 786 | |
|
18913
61c4ca4f733a
I'm hoping this will fix a semi-random and semi-random infinite looping
Mark Doliner <markdoliner@pidgin.im>
parents:
18807
diff
changeset
|
787 | /* |
|
61c4ca4f733a
I'm hoping this will fix a semi-random and semi-random infinite looping
Mark Doliner <markdoliner@pidgin.im>
parents:
18807
diff
changeset
|
788 | * Continue looping as long as we're able to read type2, |
|
18929
946ac80fc144
Hopefully fix a hella sporadic infinite loop bug in ICQ (and maybe AIM).
Mark Doliner <markdoliner@pidgin.im>
parents:
18914
diff
changeset
|
789 | * number2, and length2. |
|
18913
61c4ca4f733a
I'm hoping this will fix a semi-random and semi-random infinite looping
Mark Doliner <markdoliner@pidgin.im>
parents:
18807
diff
changeset
|
790 | */ |
|
61c4ca4f733a
I'm hoping this will fix a semi-random and semi-random infinite looping
Mark Doliner <markdoliner@pidgin.im>
parents:
18807
diff
changeset
|
791 | while (byte_stream_curpos(bs) + 4 <= endpos) { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
792 | type2 = byte_stream_get16(bs); |
|
18929
946ac80fc144
Hopefully fix a hella sporadic infinite loop bug in ICQ (and maybe AIM).
Mark Doliner <markdoliner@pidgin.im>
parents:
18914
diff
changeset
|
793 | number2 = byte_stream_get8(bs); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
794 | length2 = byte_stream_get8(bs); |
| 13235 | 795 | |
|
18929
946ac80fc144
Hopefully fix a hella sporadic infinite loop bug in ICQ (and maybe AIM).
Mark Doliner <markdoliner@pidgin.im>
parents:
18914
diff
changeset
|
796 | endpos2 = byte_stream_curpos(bs) + MIN(length2, byte_stream_empty(bs)); |
|
18914
bdcc8939807b
Another stab at fixing that signon infinite loop
Mark Doliner <markdoliner@pidgin.im>
parents:
18913
diff
changeset
|
797 | |
| 13235 | 798 | switch (type2) { |
| 799 | case 0x0000: { /* This is an official buddy icon? */ | |
| 800 | /* This is always 5 bytes of "0x02 01 d2 04 72"? */ | |
| 801 | } break; | |
| 802 | ||
| 803 | case 0x0001: { /* A buddy icon checksum */ | |
|
18929
946ac80fc144
Hopefully fix a hella sporadic infinite loop bug in ICQ (and maybe AIM).
Mark Doliner <markdoliner@pidgin.im>
parents:
18914
diff
changeset
|
804 | if ((length2 > 0) && ((number2 == 0x00) || (number2 == 0x01))) { |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
805 | g_free(outinfo->iconcsum); |
|
18929
946ac80fc144
Hopefully fix a hella sporadic infinite loop bug in ICQ (and maybe AIM).
Mark Doliner <markdoliner@pidgin.im>
parents:
18914
diff
changeset
|
806 | outinfo->iconcsumtype = number2; |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
807 | outinfo->iconcsum = byte_stream_getraw(bs, length2); |
| 13235 | 808 | outinfo->iconcsumlen = length2; |
|
18929
946ac80fc144
Hopefully fix a hella sporadic infinite loop bug in ICQ (and maybe AIM).
Mark Doliner <markdoliner@pidgin.im>
parents:
18914
diff
changeset
|
809 | } |
| 13235 | 810 | } break; |
| 811 | ||
| 812 | case 0x0002: { /* A status/available message */ | |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
813 | g_free(outinfo->status); |
|
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
814 | g_free(outinfo->status_encoding); |
| 13235 | 815 | if (length2 >= 4) { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
816 | outinfo->status_len = byte_stream_get16(bs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
817 | outinfo->status = byte_stream_getstr(bs, outinfo->status_len); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
818 | if (byte_stream_get16(bs) == 0x0001) { /* We have an encoding */ |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
819 | byte_stream_get16(bs); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
820 | outinfo->status_encoding = byte_stream_getstr(bs, byte_stream_get16(bs)); |
| 13235 | 821 | } else { |
| 822 | /* No explicit encoding, client should use UTF-8 */ | |
| 823 | outinfo->status_encoding = NULL; | |
| 824 | } | |
| 825 | } else { | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
826 | byte_stream_advance(bs, length2); |
| 13235 | 827 | outinfo->status_len = 0; |
| 828 | outinfo->status = g_strdup(""); | |
| 829 | outinfo->status_encoding = NULL; | |
| 830 | } | |
| 831 | } break; | |
| 832 | ||
|
16397
68d0b988e78c
Add the iTunes Music Store url to the GaimPresence for buddies onyour
Mark Doliner <markdoliner@pidgin.im>
parents:
15884
diff
changeset
|
833 | case 0x0009: { /* An iTunes Music Store link */ |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
834 | g_free(outinfo->itmsurl); |
|
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
835 | g_free(outinfo->itmsurl_encoding); |
|
16397
68d0b988e78c
Add the iTunes Music Store url to the GaimPresence for buddies onyour
Mark Doliner <markdoliner@pidgin.im>
parents:
15884
diff
changeset
|
836 | if (length2 >= 4) { |
|
68d0b988e78c
Add the iTunes Music Store url to the GaimPresence for buddies onyour
Mark Doliner <markdoliner@pidgin.im>
parents:
15884
diff
changeset
|
837 | outinfo->itmsurl_len = byte_stream_get16(bs); |
|
68d0b988e78c
Add the iTunes Music Store url to the GaimPresence for buddies onyour
Mark Doliner <markdoliner@pidgin.im>
parents:
15884
diff
changeset
|
838 | outinfo->itmsurl = byte_stream_getstr(bs, outinfo->itmsurl_len); |
|
68d0b988e78c
Add the iTunes Music Store url to the GaimPresence for buddies onyour
Mark Doliner <markdoliner@pidgin.im>
parents:
15884
diff
changeset
|
839 | if (byte_stream_get16(bs) == 0x0001) { |
|
68d0b988e78c
Add the iTunes Music Store url to the GaimPresence for buddies onyour
Mark Doliner <markdoliner@pidgin.im>
parents:
15884
diff
changeset
|
840 | /* We have an encoding */ |
|
68d0b988e78c
Add the iTunes Music Store url to the GaimPresence for buddies onyour
Mark Doliner <markdoliner@pidgin.im>
parents:
15884
diff
changeset
|
841 | byte_stream_get16(bs); |
|
68d0b988e78c
Add the iTunes Music Store url to the GaimPresence for buddies onyour
Mark Doliner <markdoliner@pidgin.im>
parents:
15884
diff
changeset
|
842 | outinfo->itmsurl_encoding = byte_stream_getstr(bs, byte_stream_get16(bs)); |
|
68d0b988e78c
Add the iTunes Music Store url to the GaimPresence for buddies onyour
Mark Doliner <markdoliner@pidgin.im>
parents:
15884
diff
changeset
|
843 | } else { |
|
68d0b988e78c
Add the iTunes Music Store url to the GaimPresence for buddies onyour
Mark Doliner <markdoliner@pidgin.im>
parents:
15884
diff
changeset
|
844 | /* No explicit encoding, client should use UTF-8 */ |
|
68d0b988e78c
Add the iTunes Music Store url to the GaimPresence for buddies onyour
Mark Doliner <markdoliner@pidgin.im>
parents:
15884
diff
changeset
|
845 | outinfo->itmsurl_encoding = NULL; |
|
68d0b988e78c
Add the iTunes Music Store url to the GaimPresence for buddies onyour
Mark Doliner <markdoliner@pidgin.im>
parents:
15884
diff
changeset
|
846 | } |
|
68d0b988e78c
Add the iTunes Music Store url to the GaimPresence for buddies onyour
Mark Doliner <markdoliner@pidgin.im>
parents:
15884
diff
changeset
|
847 | } else { |
|
68d0b988e78c
Add the iTunes Music Store url to the GaimPresence for buddies onyour
Mark Doliner <markdoliner@pidgin.im>
parents:
15884
diff
changeset
|
848 | byte_stream_advance(bs, length2); |
|
68d0b988e78c
Add the iTunes Music Store url to the GaimPresence for buddies onyour
Mark Doliner <markdoliner@pidgin.im>
parents:
15884
diff
changeset
|
849 | outinfo->itmsurl_len = 0; |
|
68d0b988e78c
Add the iTunes Music Store url to the GaimPresence for buddies onyour
Mark Doliner <markdoliner@pidgin.im>
parents:
15884
diff
changeset
|
850 | outinfo->itmsurl = g_strdup(""); |
|
68d0b988e78c
Add the iTunes Music Store url to the GaimPresence for buddies onyour
Mark Doliner <markdoliner@pidgin.im>
parents:
15884
diff
changeset
|
851 | outinfo->itmsurl_encoding = NULL; |
|
68d0b988e78c
Add the iTunes Music Store url to the GaimPresence for buddies onyour
Mark Doliner <markdoliner@pidgin.im>
parents:
15884
diff
changeset
|
852 | } |
|
68d0b988e78c
Add the iTunes Music Store url to the GaimPresence for buddies onyour
Mark Doliner <markdoliner@pidgin.im>
parents:
15884
diff
changeset
|
853 | } break; |
|
18914
bdcc8939807b
Another stab at fixing that signon infinite loop
Mark Doliner <markdoliner@pidgin.im>
parents:
18913
diff
changeset
|
854 | } |
|
16397
68d0b988e78c
Add the iTunes Music Store url to the GaimPresence for buddies onyour
Mark Doliner <markdoliner@pidgin.im>
parents:
15884
diff
changeset
|
855 | |
|
18914
bdcc8939807b
Another stab at fixing that signon infinite loop
Mark Doliner <markdoliner@pidgin.im>
parents:
18913
diff
changeset
|
856 | /* Save ourselves. */ |
|
bdcc8939807b
Another stab at fixing that signon infinite loop
Mark Doliner <markdoliner@pidgin.im>
parents:
18913
diff
changeset
|
857 | byte_stream_setpos(bs, endpos2); |
| 13235 | 858 | } |
| 859 | ||
| 860 | } else if (type == 0x001e) { | |
| 861 | /* | |
| 862 | * Always four bytes, but it doesn't look like an int. | |
| 863 | */ | |
| 864 | ||
| 865 | } else if (type == 0x001f) { | |
| 866 | /* | |
| 867 | * Seen on a buddy using DeadAIM. Data was 4 bytes: | |
| 868 | * 0x00 00 00 10 | |
| 869 | */ | |
| 870 | ||
| 871 | } else { | |
| 872 | ||
| 873 | /* | |
| 874 | * Reaching here indicates that either AOL has | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
875 | * added yet another TLV for us to deal with, |
| 13235 | 876 | * or the parsing has gone Terribly Wrong. |
| 877 | * | |
| 878 | * Either way, inform the owner and attempt | |
| 879 | * recovery. | |
| 880 | * | |
| 881 | */ | |
|
15318
6cd6b50e812b
[gaim-migrate @ 18046]
Evan Schoenberg <evands@pidgin.im>
parents:
15172
diff
changeset
|
882 | #ifdef LOG_UNKNOWN_TLV |
| 15884 | 883 | purple_debug_misc("oscar", "userinfo: **warning: unexpected TLV:\n"); |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
884 | purple_debug_misc("oscar", "userinfo: bn =%s\n", outinfo->bn); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
885 | dumptlv(od, type, bs, length); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
886 | #endif |
| 13235 | 887 | } |
| 888 | ||
| 889 | /* Save ourselves. */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
890 | byte_stream_setpos(bs, endpos); |
| 13235 | 891 | } |
| 892 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
893 | aim_locate_adduserinfo(od, outinfo); |
| 13235 | 894 | |
| 895 | return 0; | |
| 896 | } | |
| 897 | ||
| 898 | /* | |
| 899 | * Inverse of aim_info_extract() | |
| 900 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
901 | int |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
902 | aim_putuserinfo(ByteStream *bs, aim_userinfo_t *info) |
| 13235 | 903 | { |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
904 | GSList *tlvlist = NULL; |
| 13235 | 905 | |
| 906 | if (!bs || !info) | |
| 907 | return -EINVAL; | |
| 908 | ||
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
909 | byte_stream_put8(bs, strlen(info->bn)); |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
910 | byte_stream_putstr(bs, info->bn); |
| 13235 | 911 | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
912 | byte_stream_put16(bs, info->warnlevel); |
| 13235 | 913 | |
| 914 | if (info->present & AIM_USERINFO_PRESENT_FLAGS) | |
| 915 | aim_tlvlist_add_16(&tlvlist, 0x0001, info->flags); | |
| 916 | if (info->present & AIM_USERINFO_PRESENT_MEMBERSINCE) | |
| 917 | aim_tlvlist_add_32(&tlvlist, 0x0002, info->membersince); | |
| 918 | if (info->present & AIM_USERINFO_PRESENT_ONLINESINCE) | |
| 919 | aim_tlvlist_add_32(&tlvlist, 0x0003, info->onlinesince); | |
| 920 | if (info->present & AIM_USERINFO_PRESENT_IDLE) | |
| 921 | aim_tlvlist_add_16(&tlvlist, 0x0004, info->idletime); | |
| 922 | ||
| 923 | /* XXX - So, ICQ_OSCAR_SUPPORT is never defined anywhere... */ | |
| 924 | #ifdef ICQ_OSCAR_SUPPORT | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
925 | if (atoi(info->bn) != 0) { |
| 13235 | 926 | if (info->present & AIM_USERINFO_PRESENT_ICQEXTSTATUS) |
| 927 | aim_tlvlist_add_16(&tlvlist, 0x0006, info->icqinfo.status); | |
| 928 | if (info->present & AIM_USERINFO_PRESENT_ICQIPADDR) | |
| 929 | aim_tlvlist_add_32(&tlvlist, 0x000a, info->icqinfo.ipaddr); | |
| 930 | } | |
| 931 | #endif | |
| 932 | ||
| 933 | if (info->present & AIM_USERINFO_PRESENT_CAPABILITIES) | |
| 934 | aim_tlvlist_add_caps(&tlvlist, 0x000d, info->capabilities); | |
| 935 | ||
| 936 | if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN) | |
| 937 | aim_tlvlist_add_32(&tlvlist, (guint16)((info->flags & AIM_FLAG_AOL) ? 0x0010 : 0x000f), info->sessionlen); | |
| 938 | ||
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
939 | byte_stream_put16(bs, aim_tlvlist_count(tlvlist)); |
| 13235 | 940 | aim_tlvlist_write(bs, &tlvlist); |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
941 | aim_tlvlist_free(tlvlist); |
| 13235 | 942 | |
| 943 | return 0; | |
| 944 | } | |
| 945 | ||
| 946 | /* | |
| 947 | * Subtype 0x0001 | |
| 948 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
949 | static int |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
950 | error(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
| 13235 | 951 | { |
| 952 | int ret = 0; | |
| 953 | aim_rxcallback_t userfunc; | |
| 954 | aim_snac_t *snac2; | |
| 955 | guint16 reason; | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
956 | char *bn; |
| 13235 | 957 | int was_explicit; |
| 958 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
959 | if (!(snac2 = aim_remsnac(od, snac->id))) { |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
960 | purple_debug_misc("oscar", "locate error: received response from unknown request!\n"); |
| 13235 | 961 | return 0; |
| 962 | } | |
| 963 | ||
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
964 | if ((snac2->family != SNAC_FAMILY_LOCATE) && (snac2->type != 0x0015)) { |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
965 | purple_debug_misc("oscar", "locate error: received response from invalid request! %d\n", snac2->family); |
|
26966
463f0b771201
fixes one more potential leak of the same type
Ka-Hing Cheung <khc@pidgin.im>
parents:
25889
diff
changeset
|
966 | g_free(snac2->data); |
|
463f0b771201
fixes one more potential leak of the same type
Ka-Hing Cheung <khc@pidgin.im>
parents:
25889
diff
changeset
|
967 | g_free(snac2); |
| 13235 | 968 | return 0; |
| 969 | } | |
| 970 | ||
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
971 | if (!(bn = snac2->data)) { |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
972 | purple_debug_misc("oscar", "locate error: received response from request without a buddy name!\n"); |
|
26966
463f0b771201
fixes one more potential leak of the same type
Ka-Hing Cheung <khc@pidgin.im>
parents:
25889
diff
changeset
|
973 | g_free(snac2); |
| 13235 | 974 | return 0; |
| 975 | } | |
| 976 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
977 | reason = byte_stream_get16(bs); |
| 13235 | 978 | |
| 979 | /* | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
980 | * Remove this buddy name from our queue. If the client requested |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
981 | * this buddy's info explicitly, then notify them that we do not have |
| 13235 | 982 | * info for this buddy. |
| 983 | */ | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
984 | was_explicit = aim_locate_gotuserinfo(od, conn, bn); |
| 13235 | 985 | if (was_explicit == TRUE) |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
986 | if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
987 | ret = userfunc(od, conn, frame, reason, bn); |
| 13235 | 988 | |
| 989 | if (snac2) | |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
990 | g_free(snac2->data); |
|
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
991 | g_free(snac2); |
| 13235 | 992 | |
| 993 | return ret; | |
| 994 | } | |
| 995 | ||
| 996 | /* | |
| 997 | * Subtype 0x0002 | |
| 998 | * | |
| 999 | * Request Location services rights. | |
| 1000 | * | |
| 1001 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1002 | int |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1003 | aim_locate_reqrights(OscarData *od) |
| 13235 | 1004 | { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1005 | FlapConnection *conn; |
| 13235 | 1006 | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1007 | if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_LOCATE))) |
| 13235 | 1008 | return -EINVAL; |
| 1009 | ||
|
13610
b2c15a312144
[gaim-migrate @ 15995]
Mark Doliner <markdoliner@pidgin.im>
parents:
13598
diff
changeset
|
1010 | aim_genericreq_n_snacid(od, conn, SNAC_FAMILY_LOCATE, SNAC_SUBTYPE_LOCATE_REQRIGHTS); |
|
b2c15a312144
[gaim-migrate @ 15995]
Mark Doliner <markdoliner@pidgin.im>
parents:
13598
diff
changeset
|
1011 | |
|
b2c15a312144
[gaim-migrate @ 15995]
Mark Doliner <markdoliner@pidgin.im>
parents:
13598
diff
changeset
|
1012 | return 0; |
| 13235 | 1013 | } |
| 1014 | ||
| 1015 | /* | |
| 1016 | * Subtype 0x0003 | |
| 1017 | * | |
| 1018 | * Normally contains: | |
| 1019 | * t(0001) - short containing max profile length (value = 1024) | |
| 1020 | * t(0002) - short - unknown (value = 16) [max MIME type length?] | |
| 1021 | * t(0003) - short - unknown (value = 10) | |
| 1022 | * t(0004) - short - unknown (value = 2048) [ICQ only?] | |
| 1023 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1024 | static int |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1025 | rights(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
| 13235 | 1026 | { |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1027 | GSList *tlvlist; |
| 13235 | 1028 | aim_rxcallback_t userfunc; |
| 1029 | int ret = 0; | |
| 1030 | guint16 maxsiglen = 0; | |
| 1031 | ||
| 1032 | tlvlist = aim_tlvlist_read(bs); | |
| 1033 | ||
| 1034 | if (aim_tlv_gettlv(tlvlist, 0x0001, 1)) | |
| 1035 | maxsiglen = aim_tlv_get16(tlvlist, 0x0001, 1); | |
| 1036 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1037 | if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1038 | ret = userfunc(od, conn, frame, maxsiglen); |
| 13235 | 1039 | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1040 | aim_tlvlist_free(tlvlist); |
| 13235 | 1041 | |
| 1042 | return ret; | |
| 1043 | } | |
| 1044 | ||
| 1045 | /* | |
| 1046 | * Subtype 0x0004 | |
| 1047 | * | |
| 1048 | * Gives BOS your profile. | |
| 1049 | * | |
| 1050 | * profile_encoding and awaymsg_encoding MUST be set if profile or | |
| 1051 | * away are set, respectively, and their value may or may not be | |
| 1052 | * restricted to a few choices. I am currently aware of: | |
| 1053 | * | |
| 1054 | * us-ascii Just that | |
|
22570
9bd1644a7bd4
Change OSCAR to use UTF-16 rather than UCS-2 conversions. Apparently
Ethan Blanton <elb@pidgin.im>
parents:
22250
diff
changeset
|
1055 | * unicode-2-0 UTF-16BE |
| 13235 | 1056 | * |
| 1057 | * profile_len and awaymsg_len MUST be set similarly, and they MUST | |
| 1058 | * be the length of their respective strings in bytes. | |
| 1059 | * | |
| 1060 | * To get the previous behavior of awaymsg == "" un-setting the away | |
| 1061 | * message, set awaymsg non-NULL and awaymsg_len to 0 (this is the | |
| 1062 | * obvious equivalent). | |
| 1063 | * | |
| 1064 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1065 | int |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1066 | aim_locate_setprofile(OscarData *od, |
| 13235 | 1067 | const char *profile_encoding, const gchar *profile, const int profile_len, |
| 1068 | const char *awaymsg_encoding, const gchar *awaymsg, const int awaymsg_len) | |
| 1069 | { | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1070 | FlapConnection *conn; |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22761
diff
changeset
|
1071 | ByteStream bs; |
| 13235 | 1072 | aim_snacid_t snacid; |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1073 | GSList *tlvlist = NULL; |
| 13235 | 1074 | char *encoding; |
| 1075 | static const char defencoding[] = {"text/aolrtf; charset=\"%s\""}; | |
| 1076 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1077 | if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_LOCATE))) |
| 13235 | 1078 | return -EINVAL; |
| 1079 | ||
| 1080 | if (!profile && !awaymsg) | |
| 1081 | return -EINVAL; | |
| 1082 | ||
| 1083 | if ((profile && profile_encoding == NULL) || (awaymsg && awaymsg_len && awaymsg_encoding == NULL)) { | |
| 1084 | return -EINVAL; | |
| 1085 | } | |
| 1086 | ||
| 1087 | /* Build the packet first to get real length */ | |
| 1088 | if (profile) { | |
| 1089 | /* no + 1 here because of %s */ | |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
1090 | encoding = g_malloc(strlen(defencoding) + strlen(profile_encoding)); |
| 13235 | 1091 | snprintf(encoding, strlen(defencoding) + strlen(profile_encoding), defencoding, profile_encoding); |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1092 | aim_tlvlist_add_str(&tlvlist, 0x0001, encoding); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1093 | aim_tlvlist_add_raw(&tlvlist, 0x0002, profile_len, (const guchar *)profile); |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
1094 | g_free(encoding); |
| 13235 | 1095 | } |
| 1096 | ||
| 1097 | /* | |
| 1098 | * So here's how this works: | |
| 1099 | * - You are away when you have a non-zero-length type 4 TLV stored. | |
| 1100 | * - You become unaway when you clear the TLV with a zero-length | |
| 1101 | * type 4 TLV. | |
| 1102 | * - If you do not send the type 4 TLV, your status does not change | |
| 1103 | * (that is, if you were away, you'll remain away). | |
| 1104 | */ | |
| 1105 | if (awaymsg) { | |
| 1106 | if (awaymsg_len) { | |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
1107 | encoding = g_malloc(strlen(defencoding) + strlen(awaymsg_encoding)); |
| 13235 | 1108 | snprintf(encoding, strlen(defencoding) + strlen(awaymsg_encoding), defencoding, awaymsg_encoding); |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1109 | aim_tlvlist_add_str(&tlvlist, 0x0003, encoding); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1110 | aim_tlvlist_add_raw(&tlvlist, 0x0004, awaymsg_len, (const guchar *)awaymsg); |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
1111 | g_free(encoding); |
| 13235 | 1112 | } else |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1113 | aim_tlvlist_add_noval(&tlvlist, 0x0004); |
| 13235 | 1114 | } |
| 1115 | ||
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22761
diff
changeset
|
1116 | byte_stream_new(&bs, aim_tlvlist_size(tlvlist)); |
| 13235 | 1117 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
1118 | snacid = aim_cachesnac(od, SNAC_FAMILY_LOCATE, 0x0004, 0x0000, NULL, 0); |
| 13235 | 1119 | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22761
diff
changeset
|
1120 | aim_tlvlist_write(&bs, &tlvlist); |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1121 | aim_tlvlist_free(tlvlist); |
| 13235 | 1122 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
1123 | flap_connection_send_snac(od, conn, SNAC_FAMILY_LOCATE, 0x0004, 0x0000, snacid, &bs); |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22761
diff
changeset
|
1124 | |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22761
diff
changeset
|
1125 | byte_stream_destroy(&bs); |
| 13235 | 1126 | |
| 1127 | return 0; | |
| 1128 | } | |
| 1129 | ||
| 1130 | /* | |
| 1131 | * Subtype 0x0004 - Set your client's capabilities. | |
| 1132 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1133 | int |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1134 | aim_locate_setcaps(OscarData *od, guint32 caps) |
| 13235 | 1135 | { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1136 | FlapConnection *conn; |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22761
diff
changeset
|
1137 | ByteStream bs; |
| 13235 | 1138 | aim_snacid_t snacid; |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1139 | GSList *tlvlist = NULL; |
| 13235 | 1140 | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1141 | if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_LOCATE))) |
| 13235 | 1142 | return -EINVAL; |
| 1143 | ||
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1144 | aim_tlvlist_add_caps(&tlvlist, 0x0005, caps); |
| 13235 | 1145 | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22761
diff
changeset
|
1146 | byte_stream_new(&bs, aim_tlvlist_size(tlvlist)); |
| 13235 | 1147 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
1148 | snacid = aim_cachesnac(od, SNAC_FAMILY_LOCATE, 0x0004, 0x0000, NULL, 0); |
| 13235 | 1149 | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22761
diff
changeset
|
1150 | aim_tlvlist_write(&bs, &tlvlist); |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1151 | aim_tlvlist_free(tlvlist); |
| 13235 | 1152 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
1153 | flap_connection_send_snac(od, conn, SNAC_FAMILY_LOCATE, 0x0004, 0x0000, snacid, &bs); |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22761
diff
changeset
|
1154 | |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22761
diff
changeset
|
1155 | byte_stream_destroy(&bs); |
| 13235 | 1156 | |
| 1157 | return 0; | |
| 1158 | } | |
| 1159 | ||
| 1160 | /* | |
| 1161 | * Subtype 0x0005 - Request info of another AIM user. | |
| 1162 | * | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
1163 | * @param bn The buddy name whose info you wish to request. |
| 13235 | 1164 | * @param infotype The type of info you wish to request. |
| 1165 | * 0x0001 - Info/profile | |
| 1166 | * 0x0003 - Away message | |
| 1167 | * 0x0004 - Capabilities | |
| 1168 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1169 | int |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
1170 | aim_locate_getinfo(OscarData *od, const char *bn, guint16 infotype) |
| 13235 | 1171 | { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1172 | FlapConnection *conn; |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22761
diff
changeset
|
1173 | ByteStream bs; |
| 13235 | 1174 | aim_snacid_t snacid; |
| 1175 | ||
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
1176 | if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_LOCATE)) || !bn) |
| 13235 | 1177 | return -EINVAL; |
| 1178 | ||
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
1179 | byte_stream_new(&bs, 2+1+strlen(bn)); |
| 13235 | 1180 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
1181 | snacid = aim_cachesnac(od, SNAC_FAMILY_LOCATE, 0x0005, 0x0000, NULL, 0); |
| 13235 | 1182 | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22761
diff
changeset
|
1183 | byte_stream_put16(&bs, infotype); |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
1184 | byte_stream_put8(&bs, strlen(bn)); |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
1185 | byte_stream_putstr(&bs, bn); |
| 13235 | 1186 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
1187 | flap_connection_send_snac(od, conn, SNAC_FAMILY_LOCATE, 0x0005, 0x0000, snacid, &bs); |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22761
diff
changeset
|
1188 | |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22761
diff
changeset
|
1189 | byte_stream_destroy(&bs); |
| 13235 | 1190 | |
| 1191 | return 0; | |
| 1192 | } | |
| 1193 | ||
| 1194 | /* Subtype 0x0006 */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1195 | static int |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1196 | userinfo(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
| 13235 | 1197 | { |
| 1198 | int ret = 0; | |
| 1199 | aim_rxcallback_t userfunc; | |
| 1200 | aim_userinfo_t *userinfo, *userinfo2; | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1201 | GSList *tlvlist; |
| 13235 | 1202 | aim_tlv_t *tlv = NULL; |
| 1203 | int was_explicit; | |
| 1204 | ||
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
1205 | userinfo = (aim_userinfo_t *)g_malloc(sizeof(aim_userinfo_t)); |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1206 | aim_info_extract(od, bs, userinfo); |
| 13235 | 1207 | tlvlist = aim_tlvlist_read(bs); |
| 1208 | ||
| 1209 | /* Profile will be 1 and 2 */ | |
| 1210 | userinfo->info_encoding = aim_tlv_getstr(tlvlist, 0x0001, 1); | |
| 1211 | if ((tlv = aim_tlv_gettlv(tlvlist, 0x0002, 1))) { | |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
1212 | userinfo->info = (char *)g_malloc(tlv->length); |
| 13235 | 1213 | memcpy(userinfo->info, tlv->value, tlv->length); |
| 1214 | userinfo->info_len = tlv->length; | |
| 1215 | } | |
| 1216 | ||
| 1217 | /* Away message will be 3 and 4 */ | |
| 1218 | userinfo->away_encoding = aim_tlv_getstr(tlvlist, 0x0003, 1); | |
| 1219 | if ((tlv = aim_tlv_gettlv(tlvlist, 0x0004, 1))) { | |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
1220 | userinfo->away = (char *)g_malloc(tlv->length); |
| 13235 | 1221 | memcpy(userinfo->away, tlv->value, tlv->length); |
| 1222 | userinfo->away_len = tlv->length; | |
| 1223 | } | |
| 1224 | ||
| 1225 | /* Caps will be 5 */ | |
| 1226 | if ((tlv = aim_tlv_gettlv(tlvlist, 0x0005, 1))) { | |
|
13240
db5187cc40d1
[gaim-migrate @ 15605]
Mark Doliner <markdoliner@pidgin.im>
parents:
13235
diff
changeset
|
1227 | ByteStream cbs; |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1228 | byte_stream_init(&cbs, tlv->value, tlv->length); |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1229 | userinfo->capabilities = aim_locate_getcaps(od, &cbs, tlv->length); |
| 13235 | 1230 | userinfo->present = AIM_USERINFO_PRESENT_CAPABILITIES; |
| 1231 | } | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1232 | aim_tlvlist_free(tlvlist); |
| 13235 | 1233 | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1234 | aim_locate_adduserinfo(od, userinfo); |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
1235 | userinfo2 = aim_locate_finduserinfo(od, userinfo->bn); |
| 13235 | 1236 | aim_info_free(userinfo); |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
1237 | g_free(userinfo); |
| 13235 | 1238 | |
| 1239 | /* | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
1240 | * Remove this buddy name from our queue. If the client requested |
| 13235 | 1241 | * this buddy's info explicitly, then notify them that we have info |
| 1242 | * for this buddy. | |
| 1243 | */ | |
|
18807
b0407f65aecf
aim_locate_finduserinfo() can return NUL (particularly if userinfo->sn is NULL), which leads to the crash in AdiumTicket:7346. Handle this possibility rather than crashing.
Evan Schoenberg <evands@pidgin.im>
parents:
17443
diff
changeset
|
1244 | if (userinfo2 != NULL) |
|
b0407f65aecf
aim_locate_finduserinfo() can return NUL (particularly if userinfo->sn is NULL), which leads to the crash in AdiumTicket:7346. Handle this possibility rather than crashing.
Evan Schoenberg <evands@pidgin.im>
parents:
17443
diff
changeset
|
1245 | { |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
1246 | was_explicit = aim_locate_gotuserinfo(od, conn, userinfo2->bn); |
|
18807
b0407f65aecf
aim_locate_finduserinfo() can return NUL (particularly if userinfo->sn is NULL), which leads to the crash in AdiumTicket:7346. Handle this possibility rather than crashing.
Evan Schoenberg <evands@pidgin.im>
parents:
17443
diff
changeset
|
1247 | if (was_explicit == TRUE) |
|
b0407f65aecf
aim_locate_finduserinfo() can return NUL (particularly if userinfo->sn is NULL), which leads to the crash in AdiumTicket:7346. Handle this possibility rather than crashing.
Evan Schoenberg <evands@pidgin.im>
parents:
17443
diff
changeset
|
1248 | if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) |
|
b0407f65aecf
aim_locate_finduserinfo() can return NUL (particularly if userinfo->sn is NULL), which leads to the crash in AdiumTicket:7346. Handle this possibility rather than crashing.
Evan Schoenberg <evands@pidgin.im>
parents:
17443
diff
changeset
|
1249 | ret = userfunc(od, conn, frame, userinfo2); |
|
b0407f65aecf
aim_locate_finduserinfo() can return NUL (particularly if userinfo->sn is NULL), which leads to the crash in AdiumTicket:7346. Handle this possibility rather than crashing.
Evan Schoenberg <evands@pidgin.im>
parents:
17443
diff
changeset
|
1250 | } |
| 13235 | 1251 | |
| 1252 | return ret; | |
| 1253 | } | |
| 1254 | ||
| 1255 | /* | |
| 1256 | * Subtype 0x0009 - Set directory profile data. | |
| 1257 | * | |
| 1258 | * This is not the same as aim_location_setprofile! | |
| 1259 | * privacy: 1 to allow searching, 0 to disallow. | |
| 1260 | * | |
| 1261 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1262 | int aim_locate_setdirinfo(OscarData *od, 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, guint16 privacy) |
| 13235 | 1263 | { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1264 | FlapConnection *conn; |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22761
diff
changeset
|
1265 | ByteStream bs; |
| 13235 | 1266 | aim_snacid_t snacid; |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1267 | GSList *tlvlist = NULL; |
| 13235 | 1268 | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1269 | if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_LOCATE))) |
| 13235 | 1270 | return -EINVAL; |
| 1271 | ||
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1272 | aim_tlvlist_add_16(&tlvlist, 0x000a, privacy); |
| 13235 | 1273 | |
| 1274 | if (first) | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1275 | aim_tlvlist_add_str(&tlvlist, 0x0001, first); |
| 13235 | 1276 | if (last) |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1277 | aim_tlvlist_add_str(&tlvlist, 0x0002, last); |
| 13235 | 1278 | if (middle) |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1279 | aim_tlvlist_add_str(&tlvlist, 0x0003, middle); |
| 13235 | 1280 | if (maiden) |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1281 | aim_tlvlist_add_str(&tlvlist, 0x0004, maiden); |
| 13235 | 1282 | |
| 1283 | if (state) | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1284 | aim_tlvlist_add_str(&tlvlist, 0x0007, state); |
| 13235 | 1285 | if (city) |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1286 | aim_tlvlist_add_str(&tlvlist, 0x0008, city); |
| 13235 | 1287 | |
| 1288 | if (nickname) | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1289 | aim_tlvlist_add_str(&tlvlist, 0x000c, nickname); |
| 13235 | 1290 | if (zip) |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1291 | aim_tlvlist_add_str(&tlvlist, 0x000d, zip); |
| 13235 | 1292 | |
| 1293 | if (street) | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1294 | aim_tlvlist_add_str(&tlvlist, 0x0021, street); |
| 13235 | 1295 | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22761
diff
changeset
|
1296 | byte_stream_new(&bs, aim_tlvlist_size(tlvlist)); |
| 13235 | 1297 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
1298 | snacid = aim_cachesnac(od, SNAC_FAMILY_LOCATE, 0x0009, 0x0000, NULL, 0); |
| 13235 | 1299 | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22761
diff
changeset
|
1300 | aim_tlvlist_write(&bs, &tlvlist); |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1301 | aim_tlvlist_free(tlvlist); |
| 13235 | 1302 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
1303 | flap_connection_send_snac(od, conn, SNAC_FAMILY_LOCATE, 0x0009, 0x0000, snacid, &bs); |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22761
diff
changeset
|
1304 | |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22761
diff
changeset
|
1305 | byte_stream_destroy(&bs); |
| 13235 | 1306 | |
| 1307 | return 0; | |
| 1308 | } | |
| 1309 | ||
| 1310 | /* | |
| 1311 | * Subtype 0x000b - Huh? What is this? | |
| 1312 | */ | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
1313 | int aim_locate_000b(OscarData *od, const char *bn) |
| 13235 | 1314 | { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1315 | FlapConnection *conn; |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22761
diff
changeset
|
1316 | ByteStream bs; |
| 13235 | 1317 | aim_snacid_t snacid; |
| 1318 | ||
| 1319 | return -EINVAL; | |
| 1320 | ||
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
1321 | if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_LOCATE)) || !bn) |
| 13235 | 1322 | return -EINVAL; |
| 1323 | ||
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
1324 | byte_stream_new(&bs, 1+strlen(bn)); |
| 13235 | 1325 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
1326 | snacid = aim_cachesnac(od, SNAC_FAMILY_LOCATE, 0x000b, 0x0000, NULL, 0); |
| 13235 | 1327 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
1328 | byte_stream_put8(&bs, strlen(bn)); |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
1329 | byte_stream_putstr(&bs, bn); |
| 13235 | 1330 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
1331 | flap_connection_send_snac(od, conn, SNAC_FAMILY_LOCATE, 0x000b, 0x0000, snacid, &bs); |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22761
diff
changeset
|
1332 | |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22761
diff
changeset
|
1333 | byte_stream_destroy(&bs); |
| 13235 | 1334 | |
| 1335 | return 0; | |
| 1336 | } | |
| 1337 | ||
| 1338 | /* | |
| 1339 | * Subtype 0x000f | |
| 1340 | * | |
| 1341 | * XXX pass these in better | |
| 1342 | * | |
| 1343 | */ | |
|
13598
04f6791f65e0
[gaim-migrate @ 15983]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
1344 | int |
|
04f6791f65e0
[gaim-migrate @ 15983]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
1345 | aim_locate_setinterests(OscarData *od, const char *interest1, const char *interest2, const char *interest3, const char *interest4, const char *interest5, guint16 privacy) |
| 13235 | 1346 | { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1347 | FlapConnection *conn; |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22761
diff
changeset
|
1348 | ByteStream bs; |
| 13235 | 1349 | aim_snacid_t snacid; |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1350 | GSList *tlvlist = NULL; |
| 13235 | 1351 | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1352 | if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_LOCATE))) |
| 13235 | 1353 | return -EINVAL; |
| 1354 | ||
| 1355 | /* ?? privacy ?? */ | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1356 | aim_tlvlist_add_16(&tlvlist, 0x000a, privacy); |
| 13235 | 1357 | |
| 1358 | if (interest1) | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1359 | aim_tlvlist_add_str(&tlvlist, 0x0000b, interest1); |
| 13235 | 1360 | if (interest2) |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1361 | aim_tlvlist_add_str(&tlvlist, 0x0000b, interest2); |
| 13235 | 1362 | if (interest3) |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1363 | aim_tlvlist_add_str(&tlvlist, 0x0000b, interest3); |
| 13235 | 1364 | if (interest4) |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1365 | aim_tlvlist_add_str(&tlvlist, 0x0000b, interest4); |
| 13235 | 1366 | if (interest5) |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1367 | aim_tlvlist_add_str(&tlvlist, 0x0000b, interest5); |
| 13235 | 1368 | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22761
diff
changeset
|
1369 | byte_stream_new(&bs, aim_tlvlist_size(tlvlist)); |
| 13235 | 1370 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
1371 | snacid = aim_cachesnac(od, SNAC_FAMILY_LOCATE, 0x000f, 0x0000, NULL, 0); |
| 13235 | 1372 | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22761
diff
changeset
|
1373 | aim_tlvlist_write(&bs, &tlvlist); |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
1374 | aim_tlvlist_free(tlvlist); |
| 13235 | 1375 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
1376 | flap_connection_send_snac(od, conn, SNAC_FAMILY_LOCATE, 0x000f, 0x0000, snacid, &bs); |
|
23004
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22860
diff
changeset
|
1377 | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22761
diff
changeset
|
1378 | byte_stream_destroy(&bs); |
| 13235 | 1379 | return 0; |
| 1380 | } | |
| 1381 | ||
| 1382 | /* | |
|
22761
af89e853532c
Minor comment change
Mark Doliner <markdoliner@pidgin.im>
parents:
22570
diff
changeset
|
1383 | * Subtype 0x0015 - Request the info of a user using the short method. This is |
| 13235 | 1384 | * what iChat uses. It normally is VERY leniently rate limited. |
| 1385 | * | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
1386 | * @param bn The buddy name whose info you wish to request. |
| 13235 | 1387 | * @param flags The bitmask which specifies the type of info you wish to request. |
| 1388 | * 0x00000001 - Info/profile. | |
| 1389 | * 0x00000002 - Away message. | |
| 1390 | * 0x00000004 - Capabilities. | |
| 1391 | * 0x00000008 - Certification. | |
| 1392 | * @return Return 0 if no errors, otherwise return the error number. | |
| 1393 | */ | |
|
13598
04f6791f65e0
[gaim-migrate @ 15983]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
1394 | int |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
1395 | aim_locate_getinfoshort(OscarData *od, const char *bn, guint32 flags) |
| 13235 | 1396 | { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1397 | FlapConnection *conn; |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22761
diff
changeset
|
1398 | ByteStream bs; |
| 13235 | 1399 | aim_snacid_t snacid; |
| 1400 | ||
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
1401 | if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_LOCATE)) || !bn) |
| 13235 | 1402 | return -EINVAL; |
| 1403 | ||
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
1404 | byte_stream_new(&bs, 4 + 1 + strlen(bn)); |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22761
diff
changeset
|
1405 | byte_stream_put32(&bs, flags); |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
1406 | byte_stream_put8(&bs, strlen(bn)); |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
1407 | byte_stream_putstr(&bs, bn); |
| 13235 | 1408 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
1409 | snacid = aim_cachesnac(od, SNAC_FAMILY_LOCATE, 0x0015, 0x0000, bn, strlen(bn)+1); |
|
23893
cecaa4f961df
Get rid of a few low priority "high priority" comments
Mark Doliner <markdoliner@pidgin.im>
parents:
23886
diff
changeset
|
1410 | flap_connection_send_snac_with_priority(od, conn, SNAC_FAMILY_LOCATE, 0x0015, 0x0000, snacid, &bs, FALSE); |
| 13235 | 1411 | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
22761
diff
changeset
|
1412 | byte_stream_destroy(&bs); |
| 13235 | 1413 | |
| 1414 | return 0; | |
| 1415 | } | |
| 1416 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1417 | static int |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1418 | snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
| 13235 | 1419 | { |
| 1420 | if (snac->subtype == 0x0001) | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1421 | return error(od, conn, mod, frame, snac, bs); |
| 13235 | 1422 | else if (snac->subtype == 0x0003) |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1423 | return rights(od, conn, mod, frame, snac, bs); |
| 13235 | 1424 | else if (snac->subtype == 0x0006) |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1425 | return userinfo(od, conn, mod, frame, snac, bs); |
| 13235 | 1426 | |
| 1427 | return 0; | |
| 1428 | } | |
| 1429 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1430 | static void |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1431 | locate_shutdown(OscarData *od, aim_module_t *mod) |
| 13235 | 1432 | { |
| 1433 | aim_userinfo_t *del; | |
| 1434 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1435 | while (od->locate.userinfo) { |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1436 | del = od->locate.userinfo; |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1437 | od->locate.userinfo = od->locate.userinfo->next; |
| 13235 | 1438 | aim_info_free(del); |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
16397
diff
changeset
|
1439 | g_free(del); |
| 13235 | 1440 | } |
| 1441 | } | |
| 1442 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1443 | int |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1444 | locate_modfirst(OscarData *od, aim_module_t *mod) |
| 13235 | 1445 | { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
1446 | mod->family = SNAC_FAMILY_LOCATE; |
| 13235 | 1447 | mod->version = 0x0001; |
| 1448 | mod->toolid = 0x0110; | |
| 1449 | mod->toolversion = 0x0629; | |
| 1450 | mod->flags = 0; | |
| 1451 | strncpy(mod->name, "locate", sizeof(mod->name)); | |
| 1452 | mod->snachandler = snachandler; | |
| 1453 | mod->shutdown = locate_shutdown; | |
| 1454 | ||
| 1455 | return 0; | |
| 1456 | } |