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:
17443
diff
changeset
|
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 13235 | 19 | */ |
| 20 | ||
| 21 | /* | |
| 22 | * Family 0x000f - Newer Search Method | |
| 23 | * | |
| 24 | * Used for searching for other AIM users by email address, name, | |
| 25 | * location, commmon interests, and a few other similar things. | |
| 26 | * | |
| 27 | */ | |
| 28 | ||
| 29 | #include "oscar.h" | |
| 30 | ||
| 31 | /** | |
| 32 | * Subtype 0x0002 - Submit a User Search Request | |
| 33 | * | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
23456
diff
changeset
|
34 | * Search for an AIM buddy based on their email address. |
| 13235 | 35 | * |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
36 | * @param od The oscar session. |
| 13235 | 37 | * @param region Should be "us-ascii" unless you know what you're doing. |
| 38 | * @param email The email address you want to search for. | |
| 39 | * @return Return 0 if no errors, otherwise return the error number. | |
| 40 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
41 | int aim_odir_email(OscarData *od, const char *region, const char *email) |
| 13235 | 42 | { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
43 | 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:
19859
diff
changeset
|
44 | ByteStream bs; |
| 13235 | 45 | 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
|
46 | GSList *tlvlist = NULL; |
| 13235 | 47 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
48 | if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ODIR)) || !region || !email) |
| 13235 | 49 | return -EINVAL; |
| 50 | ||
| 51 | /* Create a TLV chain, write it to the outgoing frame, then free the chain */ | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
52 | aim_tlvlist_add_str(&tlvlist, 0x001c, region); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
53 | aim_tlvlist_add_16(&tlvlist, 0x000a, 0x0001); /* Type of search */ |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
54 | aim_tlvlist_add_str(&tlvlist, 0x0005, email); |
| 13235 | 55 | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
19859
diff
changeset
|
56 | byte_stream_new(&bs, aim_tlvlist_size(tlvlist)); |
| 13235 | 57 | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
19859
diff
changeset
|
58 | 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
|
59 | aim_tlvlist_free(tlvlist); |
| 13235 | 60 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
61 | snacid = aim_cachesnac(od, SNAC_FAMILY_ODIR, 0x0002, 0x0000, NULL, 0); |
|
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
62 | flap_connection_send_snac(od, conn, SNAC_FAMILY_ODIR, 0x0002, 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:
19859
diff
changeset
|
63 | |
|
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
19859
diff
changeset
|
64 | byte_stream_destroy(&bs); |
| 13235 | 65 | |
| 66 | return 0; | |
| 67 | } | |
| 68 | ||
| 69 | ||
| 70 | /** | |
| 71 | * Subtype 0x0002 - Submit a User Search Request | |
| 72 | * | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
23456
diff
changeset
|
73 | * Search for an AIM buddy based on various info |
| 13235 | 74 | * about the person. |
| 75 | * | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
76 | * @param od The oscar session. |
| 13235 | 77 | * @param region Should be "us-ascii" unless you know what you're doing. |
| 78 | * @param first The first name of the person you want to search for. | |
| 79 | * @param middle The middle name of the person you want to search for. | |
| 80 | * @param last The last name of the person you want to search for. | |
| 81 | * @param maiden The maiden name of the person you want to search for. | |
| 82 | * @param nick The nick name of the person you want to search for. | |
| 83 | * @param city The city where the person you want to search for resides. | |
| 84 | * @param state The state where the person you want to search for resides. | |
| 85 | * @param country The country where the person you want to search for resides. | |
| 86 | * @param zip The zip code where the person you want to search for resides. | |
| 87 | * @param address The street address where the person you want to seach for resides. | |
| 88 | * @return Return 0 if no errors, otherwise return the error number. | |
| 89 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
90 | int aim_odir_name(OscarData *od, const char *region, const char *first, const char *middle, const char *last, const char *maiden, const char *nick, const char *city, const char *state, const char *country, const char *zip, const char *address) |
| 13235 | 91 | { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
92 | 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:
19859
diff
changeset
|
93 | ByteStream bs; |
| 13235 | 94 | 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
|
95 | GSList *tlvlist = NULL; |
| 13235 | 96 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
97 | if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ODIR)) || !region) |
| 13235 | 98 | return -EINVAL; |
| 99 | ||
| 100 | /* Create a TLV chain, write it to the outgoing frame, then free the chain */ | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
101 | aim_tlvlist_add_str(&tlvlist, 0x001c, region); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
102 | aim_tlvlist_add_16(&tlvlist, 0x000a, 0x0000); /* Type of search */ |
| 13235 | 103 | if (first) |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
104 | aim_tlvlist_add_str(&tlvlist, 0x0001, first); |
| 13235 | 105 | if (last) |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
106 | aim_tlvlist_add_str(&tlvlist, 0x0002, last); |
| 13235 | 107 | if (middle) |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
108 | aim_tlvlist_add_str(&tlvlist, 0x0003, middle); |
| 13235 | 109 | if (maiden) |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
110 | aim_tlvlist_add_str(&tlvlist, 0x0004, maiden); |
| 13235 | 111 | if (country) |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
112 | aim_tlvlist_add_str(&tlvlist, 0x0006, country); |
| 13235 | 113 | if (state) |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
114 | aim_tlvlist_add_str(&tlvlist, 0x0007, state); |
| 13235 | 115 | if (city) |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
116 | aim_tlvlist_add_str(&tlvlist, 0x0008, city); |
| 13235 | 117 | if (nick) |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
118 | aim_tlvlist_add_str(&tlvlist, 0x000c, nick); |
| 13235 | 119 | if (zip) |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
120 | aim_tlvlist_add_str(&tlvlist, 0x000d, zip); |
| 13235 | 121 | if (address) |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
122 | aim_tlvlist_add_str(&tlvlist, 0x0021, address); |
| 13235 | 123 | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
19859
diff
changeset
|
124 | byte_stream_new(&bs, aim_tlvlist_size(tlvlist)); |
| 13235 | 125 | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
19859
diff
changeset
|
126 | 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
|
127 | aim_tlvlist_free(tlvlist); |
| 13235 | 128 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
129 | snacid = aim_cachesnac(od, SNAC_FAMILY_ODIR, 0x0002, 0x0000, NULL, 0); |
|
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
130 | flap_connection_send_snac(od, conn, SNAC_FAMILY_ODIR, 0x0002, 0x0000, snacid, &bs); |
| 13235 | 131 | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
19859
diff
changeset
|
132 | byte_stream_destroy(&bs); |
|
23004
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22860
diff
changeset
|
133 | |
| 13235 | 134 | return 0; |
| 135 | } | |
| 136 | ||
| 137 | ||
| 138 | /** | |
| 139 | * Subtype 0x0002 - Submit a User Search Request | |
| 140 | * | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
141 | * @param od The oscar session. |
| 13235 | 142 | * @param interest1 An interest you want to search for. |
| 143 | * @return Return 0 if no errors, otherwise return the error number. | |
| 144 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
145 | int aim_odir_interest(OscarData *od, const char *region, const char *interest) |
| 13235 | 146 | { |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
147 | 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:
19859
diff
changeset
|
148 | ByteStream bs; |
| 13235 | 149 | 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
|
150 | GSList *tlvlist = NULL; |
| 13235 | 151 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
152 | if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ODIR)) || !region) |
| 13235 | 153 | return -EINVAL; |
| 154 | ||
| 155 | /* Create a TLV chain, write it to the outgoing frame, then free the chain */ | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
156 | aim_tlvlist_add_str(&tlvlist, 0x001c, region); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
157 | aim_tlvlist_add_16(&tlvlist, 0x000a, 0x0001); /* Type of search */ |
| 13235 | 158 | if (interest) |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
159 | aim_tlvlist_add_str(&tlvlist, 0x0001, interest); |
| 13235 | 160 | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
19859
diff
changeset
|
161 | byte_stream_new(&bs, aim_tlvlist_size(tlvlist)); |
| 13235 | 162 | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
19859
diff
changeset
|
163 | 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
|
164 | aim_tlvlist_free(tlvlist); |
| 13235 | 165 | |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
166 | snacid = aim_cachesnac(od, SNAC_FAMILY_ODIR, 0x0002, 0x0000, NULL, 0); |
|
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
167 | flap_connection_send_snac(od, conn, SNAC_FAMILY_ODIR, 0x0002, 0x0000, snacid, &bs); |
|
23004
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22860
diff
changeset
|
168 | |
|
22860
2b0e247173b2
All SNACs on FLAP channel 2 except in the auth family are now sent through
Evan Schoenberg <evands@pidgin.im>
parents:
19859
diff
changeset
|
169 | byte_stream_destroy(&bs); |
|
23004
0d9272ff5e50
Minor changes... mostly whitespace related.
Mark Doliner <markdoliner@pidgin.im>
parents:
22860
diff
changeset
|
170 | |
| 13235 | 171 | return 0; |
| 172 | } | |
| 173 | ||
| 174 | ||
| 175 | /** | |
| 176 | * Subtype 0x0003 - Receive Reply From a User Search | |
| 177 | * | |
| 178 | */ | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
179 | static int parseresults(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
| 13235 | 180 | { |
| 181 | int ret = 0; | |
| 182 | aim_rxcallback_t userfunc; | |
| 183 | guint16 tmp, numresults; | |
| 184 | struct aim_odir *results = NULL; | |
| 185 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
186 | tmp = byte_stream_get16(bs); /* Unknown */ |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
187 | tmp = byte_stream_get16(bs); /* Unknown */ |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
188 | byte_stream_advance(bs, tmp); |
| 13235 | 189 | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
190 | numresults = byte_stream_get16(bs); /* Number of results to follow */ |
| 13235 | 191 | |
| 192 | /* Allocate a linked list, 1 node per result */ | |
| 193 | while (numresults) { | |
| 194 | struct aim_odir *new; | |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
195 | GSList *tlvlist = aim_tlvlist_readnum(bs, byte_stream_get16(bs)); |
|
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:
15884
diff
changeset
|
196 | new = (struct aim_odir *)g_malloc(sizeof(struct aim_odir)); |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
197 | new->first = aim_tlv_getstr(tlvlist, 0x0001, 1); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
198 | new->last = aim_tlv_getstr(tlvlist, 0x0002, 1); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
199 | new->middle = aim_tlv_getstr(tlvlist, 0x0003, 1); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
200 | new->maiden = aim_tlv_getstr(tlvlist, 0x0004, 1); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
201 | new->email = aim_tlv_getstr(tlvlist, 0x0005, 1); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
202 | new->country = aim_tlv_getstr(tlvlist, 0x0006, 1); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
203 | new->state = aim_tlv_getstr(tlvlist, 0x0007, 1); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
204 | new->city = aim_tlv_getstr(tlvlist, 0x0008, 1); |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
23456
diff
changeset
|
205 | new->bn = aim_tlv_getstr(tlvlist, 0x0009, 1); |
|
17443
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
206 | new->interest = aim_tlv_getstr(tlvlist, 0x000b, 1); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
207 | new->nick = aim_tlv_getstr(tlvlist, 0x000c, 1); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
208 | new->zip = aim_tlv_getstr(tlvlist, 0x000d, 1); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
209 | new->region = aim_tlv_getstr(tlvlist, 0x001c, 1); |
|
bae8548d98b3
Cleanup and simplification of some tlvlist stuff in the oscar protocol.
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
210 | new->address = aim_tlv_getstr(tlvlist, 0x0021, 1); |
| 13235 | 211 | new->next = results; |
| 212 | results = new; | |
| 213 | numresults--; | |
| 214 | } | |
| 215 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
216 | if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
217 | ret = userfunc(od, conn, frame, results); |
| 13235 | 218 | |
| 219 | /* Now free everything from above */ | |
| 220 | while (results) { | |
| 221 | struct aim_odir *del = results; | |
| 222 | results = results->next; | |
|
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:
15884
diff
changeset
|
223 | g_free(del->first); |
|
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:
15884
diff
changeset
|
224 | g_free(del->last); |
|
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:
15884
diff
changeset
|
225 | g_free(del->middle); |
|
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:
15884
diff
changeset
|
226 | g_free(del->maiden); |
|
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:
15884
diff
changeset
|
227 | g_free(del->email); |
|
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:
15884
diff
changeset
|
228 | g_free(del->country); |
|
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:
15884
diff
changeset
|
229 | g_free(del->state); |
|
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:
15884
diff
changeset
|
230 | g_free(del->city); |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
23456
diff
changeset
|
231 | 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:
15884
diff
changeset
|
232 | g_free(del->interest); |
|
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:
15884
diff
changeset
|
233 | g_free(del->nick); |
|
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:
15884
diff
changeset
|
234 | g_free(del->zip); |
|
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:
15884
diff
changeset
|
235 | g_free(del->region); |
|
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:
15884
diff
changeset
|
236 | g_free(del->address); |
|
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:
15884
diff
changeset
|
237 | g_free(del); |
| 13235 | 238 | } |
| 239 | ||
| 240 | return ret; | |
| 241 | } | |
| 242 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
243 | static int |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
244 | snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) |
| 13235 | 245 | { |
| 246 | if (snac->subtype == 0x0003) | |
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
247 | return parseresults(od, conn, mod, frame, snac, bs); |
| 13235 | 248 | |
| 249 | return 0; | |
| 250 | } | |
| 251 | ||
|
13593
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
252 | int |
|
3450a7cede99
[gaim-migrate @ 15978]
Mark Doliner <markdoliner@pidgin.im>
parents:
13254
diff
changeset
|
253 | odir_modfirst(OscarData *od, aim_module_t *mod) |
| 13235 | 254 | { |
|
23456
66ab07770438
Replaced family_*'s magic numbers of FLAP families with the constants
Evan Schoenberg <evands@pidgin.im>
parents:
23004
diff
changeset
|
255 | mod->family = SNAC_FAMILY_ODIR; |
| 13235 | 256 | mod->version = 0x0001; |
| 257 | mod->toolid = 0x0010; | |
| 258 | mod->toolversion = 0x0629; | |
| 259 | mod->flags = 0; | |
| 260 | strncpy(mod->name, "odir", sizeof(mod->name)); | |
| 261 | mod->snachandler = snachandler; | |
| 262 | ||
| 263 | return 0; | |
| 264 | } |