annotate src/protocols/oscar/family_odir.c @ 13711:967ef719cb62

[gaim-migrate @ 16115] Resolve some unused value CIDs. This changeset just removes dead code. jabber chat.c CID 180 CID 181 msn httpconn.c CID 179 msn.c CID 185 CID 186 notification.c CID 189 slp.c CID 183 CID 184 switchboard.c CID 178 sync.c CID 187 CID 188 user.c CID 182 novell novell.c CID 190 sametime sametime.c CID 214 CID 215 yahoo yahoo.c CID 200 CID 201 CID 202 yahoo_doodle.c CID 168 CID 169 yahoo_filexfer.c CID 170 CID 171 CID 172 committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Mon, 01 May 2006 20:37:37 +0000
parents 6519aeb66b31
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13234
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1 /*
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
2 * Gaim's oscar protocol plugin
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
3 * This file is the legal property of its developers.
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
4 * Please see the AUTHORS file distributed alongside this file.
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
5 *
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
6 * This library is free software; you can redistribute it and/or
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
7 * modify it under the terms of the GNU Lesser General Public
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
8 * License as published by the Free Software Foundation; either
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
9 * version 2 of the License, or (at your option) any later version.
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
10 *
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
11 * This library is distributed in the hope that it will be useful,
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
14 * Lesser General Public License for more details.
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
15 *
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
16 * You should have received a copy of the GNU Lesser General Public
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
17 * License along with this library; if not, write to the Free Software
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
19 */
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
20
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
21 /*
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
22 * Family 0x000f - Newer Search Method
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
23 *
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
24 * Used for searching for other AIM users by email address, name,
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
25 * location, commmon interests, and a few other similar things.
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
26 *
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
27 */
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
28
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
29 #include "oscar.h"
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
30
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
31 /**
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
32 * Subtype 0x0002 - Submit a User Search Request
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
33 *
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
34 * Search for an AIM screen name based on their email address.
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
35 *
13592
6519aeb66b31 [gaim-migrate @ 15978]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
36 * @param od The oscar session.
13234
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
37 * @param region Should be "us-ascii" unless you know what you're doing.
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
38 * @param email The email address you want to search for.
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
39 * @return Return 0 if no errors, otherwise return the error number.
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
40 */
13592
6519aeb66b31 [gaim-migrate @ 15978]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
41 int aim_odir_email(OscarData *od, const char *region, const char *email)
13234
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
42 {
13592
6519aeb66b31 [gaim-migrate @ 15978]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
43 FlapConnection *conn;
6519aeb66b31 [gaim-migrate @ 15978]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
44 FlapFrame *frame;
13234
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
45 aim_snacid_t snacid;
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
46 aim_tlvlist_t *tl = NULL;
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
47
13592
6519aeb66b31 [gaim-migrate @ 15978]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
48 if (!od || !(conn = flap_connection_findbygroup(od, 0x000f)) || !region || !email)
13234
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
49 return -EINVAL;
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
50
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
51 /* Create a TLV chain, write it to the outgoing frame, then free the chain */
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
52 aim_tlvlist_add_str(&tl, 0x001c, region);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
53 aim_tlvlist_add_16(&tl, 0x000a, 0x0001); /* Type of search */
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
54 aim_tlvlist_add_str(&tl, 0x0005, email);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
55
13592
6519aeb66b31 [gaim-migrate @ 15978]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
56 frame = flap_frame_new(od, 0x02, 10+aim_tlvlist_size(&tl));
6519aeb66b31 [gaim-migrate @ 15978]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
57 snacid = aim_cachesnac(od, 0x000f, 0x0002, 0x0000, NULL, 0);
6519aeb66b31 [gaim-migrate @ 15978]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
58 aim_putsnac(&frame->data, 0x000f, 0x0002, 0x0000, snacid);
13234
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
59
13592
6519aeb66b31 [gaim-migrate @ 15978]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
60 aim_tlvlist_write(&frame->data, &tl);
13234
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
61 aim_tlvlist_free(&tl);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
62
13592
6519aeb66b31 [gaim-migrate @ 15978]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
63 flap_connection_send(conn, frame);
13234
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
64
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
65 return 0;
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
66 }
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
67
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
68
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
69 /**
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
70 * Subtype 0x0002 - Submit a User Search Request
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
71 *
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
72 * Search for an AIM screen name based on various info
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
73 * about the person.
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
74 *
13592
6519aeb66b31 [gaim-migrate @ 15978]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
75 * @param od The oscar session.
13234
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
76 * @param region Should be "us-ascii" unless you know what you're doing.
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
77 * @param first The first name of the person you want to search for.
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
78 * @param middle The middle name of the person you want to search for.
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
79 * @param last The last name of the person you want to search for.
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
80 * @param maiden The maiden name of the person you want to search for.
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
81 * @param nick The nick name of the person you want to search for.
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
82 * @param city The city where the person you want to search for resides.
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
83 * @param state The state where the person you want to search for resides.
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
84 * @param country The country where the person you want to search for resides.
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
85 * @param zip The zip code where the person you want to search for resides.
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
86 * @param address The street address where the person you want to seach for resides.
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
87 * @return Return 0 if no errors, otherwise return the error number.
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
88 */
13592
6519aeb66b31 [gaim-migrate @ 15978]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
89 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)
13234
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
90 {
13592
6519aeb66b31 [gaim-migrate @ 15978]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
91 FlapConnection *conn;
6519aeb66b31 [gaim-migrate @ 15978]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
92 FlapFrame *frame;
13234
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
93 aim_snacid_t snacid;
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
94 aim_tlvlist_t *tl = NULL;
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
95
13592
6519aeb66b31 [gaim-migrate @ 15978]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
96 if (!od || !(conn = flap_connection_findbygroup(od, 0x000f)) || !region)
13234
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
97 return -EINVAL;
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
98
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
99 /* Create a TLV chain, write it to the outgoing frame, then free the chain */
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
100 aim_tlvlist_add_str(&tl, 0x001c, region);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
101 aim_tlvlist_add_16(&tl, 0x000a, 0x0000); /* Type of search */
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
102 if (first)
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
103 aim_tlvlist_add_str(&tl, 0x0001, first);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
104 if (last)
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
105 aim_tlvlist_add_str(&tl, 0x0002, last);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
106 if (middle)
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
107 aim_tlvlist_add_str(&tl, 0x0003, middle);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
108 if (maiden)
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
109 aim_tlvlist_add_str(&tl, 0x0004, maiden);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
110 if (country)
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
111 aim_tlvlist_add_str(&tl, 0x0006, country);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
112 if (state)
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
113 aim_tlvlist_add_str(&tl, 0x0007, state);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
114 if (city)
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
115 aim_tlvlist_add_str(&tl, 0x0008, city);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
116 if (nick)
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
117 aim_tlvlist_add_str(&tl, 0x000c, nick);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
118 if (zip)
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
119 aim_tlvlist_add_str(&tl, 0x000d, zip);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
120 if (address)
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
121 aim_tlvlist_add_str(&tl, 0x0021, address);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
122
13592
6519aeb66b31 [gaim-migrate @ 15978]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
123 frame = flap_frame_new(od, 0x02, 10+aim_tlvlist_size(&tl));
6519aeb66b31 [gaim-migrate @ 15978]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
124 snacid = aim_cachesnac(od, 0x000f, 0x0002, 0x0000, NULL, 0);
6519aeb66b31 [gaim-migrate @ 15978]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
125 aim_putsnac(&frame->data, 0x000f, 0x0002, 0x0000, snacid);
13234
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
126
13592
6519aeb66b31 [gaim-migrate @ 15978]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
127 aim_tlvlist_write(&frame->data, &tl);
13234
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
128 aim_tlvlist_free(&tl);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
129
13592
6519aeb66b31 [gaim-migrate @ 15978]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
130 flap_connection_send(conn, frame);
13234
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
131
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
132 return 0;
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
133 }
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
134
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
135
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
136 /**
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
137 * Subtype 0x0002 - Submit a User Search Request
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
138 *
13592
6519aeb66b31 [gaim-migrate @ 15978]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
139 * @param od The oscar session.
13234
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
140 * @param interest1 An interest you want to search for.
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
141 * @return Return 0 if no errors, otherwise return the error number.
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
142 */
13592
6519aeb66b31 [gaim-migrate @ 15978]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
143 int aim_odir_interest(OscarData *od, const char *region, const char *interest)
13234
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
144 {
13592
6519aeb66b31 [gaim-migrate @ 15978]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
145 FlapConnection *conn;
6519aeb66b31 [gaim-migrate @ 15978]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
146 FlapFrame *frame;
13234
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
147 aim_snacid_t snacid;
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
148 aim_tlvlist_t *tl = NULL;
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
149
13592
6519aeb66b31 [gaim-migrate @ 15978]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
150 if (!od || !(conn = flap_connection_findbygroup(od, 0x000f)) || !region)
13234
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
151 return -EINVAL;
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
152
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
153 /* Create a TLV chain, write it to the outgoing frame, then free the chain */
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
154 aim_tlvlist_add_str(&tl, 0x001c, region);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
155 aim_tlvlist_add_16(&tl, 0x000a, 0x0001); /* Type of search */
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
156 if (interest)
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
157 aim_tlvlist_add_str(&tl, 0x0001, interest);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
158
13592
6519aeb66b31 [gaim-migrate @ 15978]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
159 frame = flap_frame_new(od, 0x02, 10+aim_tlvlist_size(&tl));
6519aeb66b31 [gaim-migrate @ 15978]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
160 snacid = aim_cachesnac(od, 0x000f, 0x0002, 0x0000, NULL, 0);
6519aeb66b31 [gaim-migrate @ 15978]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
161 aim_putsnac(&frame->data, 0x000f, 0x0002, 0x0000, snacid);
13234
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
162
13592
6519aeb66b31 [gaim-migrate @ 15978]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
163 aim_tlvlist_write(&frame->data, &tl);
13234
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
164 aim_tlvlist_free(&tl);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
165
13592
6519aeb66b31 [gaim-migrate @ 15978]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
166 flap_connection_send(conn, frame);
13234
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
167
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
168 return 0;
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
169 }
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
170
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
171
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
172 /**
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
173 * Subtype 0x0003 - Receive Reply From a User Search
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
174 *
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
175 */
13592
6519aeb66b31 [gaim-migrate @ 15978]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
176 static int parseresults(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs)
13234
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
177 {
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
178 int ret = 0;
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
179 aim_rxcallback_t userfunc;
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
180 guint16 tmp, numresults;
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
181 struct aim_odir *results = NULL;
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
182
13592
6519aeb66b31 [gaim-migrate @ 15978]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
183 tmp = byte_stream_get16(bs); /* Unknown */
6519aeb66b31 [gaim-migrate @ 15978]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
184 tmp = byte_stream_get16(bs); /* Unknown */
6519aeb66b31 [gaim-migrate @ 15978]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
185 byte_stream_advance(bs, tmp);
13234
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
186
13592
6519aeb66b31 [gaim-migrate @ 15978]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
187 numresults = byte_stream_get16(bs); /* Number of results to follow */
13234
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
188
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
189 /* Allocate a linked list, 1 node per result */
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
190 while (numresults) {
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
191 struct aim_odir *new;
13592
6519aeb66b31 [gaim-migrate @ 15978]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
192 aim_tlvlist_t *tl = aim_tlvlist_readnum(bs, byte_stream_get16(bs));
13234
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
193 new = (struct aim_odir *)malloc(sizeof(struct aim_odir));
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
194 new->first = aim_tlv_getstr(tl, 0x0001, 1);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
195 new->last = aim_tlv_getstr(tl, 0x0002, 1);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
196 new->middle = aim_tlv_getstr(tl, 0x0003, 1);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
197 new->maiden = aim_tlv_getstr(tl, 0x0004, 1);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
198 new->email = aim_tlv_getstr(tl, 0x0005, 1);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
199 new->country = aim_tlv_getstr(tl, 0x0006, 1);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
200 new->state = aim_tlv_getstr(tl, 0x0007, 1);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
201 new->city = aim_tlv_getstr(tl, 0x0008, 1);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
202 new->sn = aim_tlv_getstr(tl, 0x0009, 1);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
203 new->interest = aim_tlv_getstr(tl, 0x000b, 1);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
204 new->nick = aim_tlv_getstr(tl, 0x000c, 1);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
205 new->zip = aim_tlv_getstr(tl, 0x000d, 1);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
206 new->region = aim_tlv_getstr(tl, 0x001c, 1);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
207 new->address = aim_tlv_getstr(tl, 0x0021, 1);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
208 new->next = results;
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
209 results = new;
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
210 numresults--;
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
211 }
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
212
13592
6519aeb66b31 [gaim-migrate @ 15978]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
213 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype)))
6519aeb66b31 [gaim-migrate @ 15978]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
214 ret = userfunc(od, conn, frame, results);
13234
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
215
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
216 /* Now free everything from above */
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
217 while (results) {
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
218 struct aim_odir *del = results;
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
219 results = results->next;
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
220 free(del->first);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
221 free(del->last);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
222 free(del->middle);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
223 free(del->maiden);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
224 free(del->email);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
225 free(del->country);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
226 free(del->state);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
227 free(del->city);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
228 free(del->sn);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
229 free(del->interest);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
230 free(del->nick);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
231 free(del->zip);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
232 free(del->region);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
233 free(del->address);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
234 free(del);
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
235 }
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
236
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
237 return ret;
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
238 }
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
239
13592
6519aeb66b31 [gaim-migrate @ 15978]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
240 static int
6519aeb66b31 [gaim-migrate @ 15978]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
241 snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs)
13234
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
242 {
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
243 if (snac->subtype == 0x0003)
13592
6519aeb66b31 [gaim-migrate @ 15978]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
244 return parseresults(od, conn, mod, frame, snac, bs);
13234
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
245
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
246 return 0;
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
247 }
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
248
13592
6519aeb66b31 [gaim-migrate @ 15978]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
249 int
6519aeb66b31 [gaim-migrate @ 15978]
Mark Doliner <mark@kingant.net>
parents: 13253
diff changeset
250 odir_modfirst(OscarData *od, aim_module_t *mod)
13234
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
251 {
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
252 mod->family = 0x000f;
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
253 mod->version = 0x0001;
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
254 mod->toolid = 0x0010;
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
255 mod->toolversion = 0x0629;
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
256 mod->flags = 0;
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
257 strncpy(mod->name, "odir", sizeof(mod->name));
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
258 mod->snachandler = snachandler;
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
259
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
260 return 0;
f2431a7e33aa [gaim-migrate @ 15600]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
261 }