14192
|
1 /**
|
|
2 * @file search.h
|
|
3 *
|
|
4 * gaim
|
|
5 *
|
|
6 * Copyright (C) 2005 Bartosz Oler <bartosz@bzimage.us>
|
|
7 *
|
|
8 * This program is free software; you can redistribute it and/or modify
|
|
9 * it under the terms of the GNU General Public License as published by
|
|
10 * the Free Software Foundation; either version 2 of the License, or
|
|
11 * (at your option) any later version.
|
|
12 *
|
|
13 * This program is distributed in the hope that it will be useful,
|
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16 * GNU General Public License for more details.
|
|
17 *
|
|
18 * You should have received a copy of the GNU General Public License
|
|
19 * along with this program; if not, write to the Free Software
|
|
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
21 */
|
|
22
|
|
23
|
|
24 #ifndef _GAIM_GG_SEARCH_H
|
|
25 #define _GAIM_GG_SEARCH_H
|
|
26
|
|
27 #include "connection.h"
|
|
28
|
|
29 #include <libgadu.h>
|
|
30 #include "gg.h"
|
|
31
|
|
32
|
|
33 typedef enum {
|
|
34 GGP_SEARCH_TYPE_INFO,
|
|
35 GGP_SEARCH_TYPE_FULL
|
|
36
|
|
37 } GGPSearchType;
|
|
38
|
|
39 typedef struct {
|
|
40
|
|
41 char *uin;
|
|
42 char *lastname;
|
|
43 char *firstname;
|
|
44 char *nickname;
|
|
45 char *city;
|
|
46 char *birthyear;
|
|
47 char *gender;
|
|
48 char *active;
|
|
49 char *offset;
|
|
50
|
|
51 char *last_uin;
|
|
52
|
|
53 GGPSearchType search_type;
|
|
54 guint32 seq;
|
|
55
|
|
56 void *user_data;
|
|
57 void *window;
|
|
58 } GGPSearchForm;
|
|
59
|
|
60 typedef GHashTable GGPSearches;
|
|
61
|
|
62
|
|
63 /**
|
|
64 * Create a new GGPSearchForm structure, and set the fields
|
|
65 * to the sane defaults.
|
|
66 *
|
|
67 * @return Newly allocated GGPSearchForm.
|
|
68 */
|
|
69 GGPSearchForm *
|
|
70 ggp_search_form_new(GGPSearchType st);
|
|
71
|
|
72 /**
|
|
73 * Destroy a Search Form.
|
|
74 *
|
|
75 * @param form Search Form to destroy.
|
|
76 */
|
|
77 void
|
|
78 ggp_search_form_destroy(GGPSearchForm *form);
|
|
79
|
|
80 /**
|
|
81 * Add a search to the list of searches.
|
|
82 *
|
|
83 * @param searches The list of searches.
|
|
84 * @param seq Search (form) ID number.
|
|
85 * @param form The search form to add.
|
|
86 */
|
|
87 void
|
|
88 ggp_search_add(GGPSearches *searches, guint32 seq, GGPSearchForm *form);
|
|
89
|
|
90 /**
|
|
91 * Remove a search from the list.
|
|
92 *
|
|
93 * If you want to destory the search completely also call:
|
|
94 * ggp_search_form_destroy().
|
|
95 *
|
|
96 * @param searches The list of searches.
|
|
97 * @param seq ID number of the search.
|
|
98 */
|
|
99 void
|
|
100 ggp_search_remove(GGPSearches *searches, guint32 seq);
|
|
101
|
|
102 /**
|
|
103 * Return the search with the specified ID.
|
|
104 *
|
|
105 * @param searches The list of searches.
|
|
106 * @param seq ID number of the search.
|
|
107 */
|
|
108 GGPSearchForm *
|
|
109 ggp_search_get(GGPSearches *searches, guint32 seq);
|
|
110
|
|
111 /**
|
|
112 * Create a new GGPSearches structure.
|
|
113 *
|
|
114 * @return GGPSearches instance.
|
|
115 */
|
|
116 GGPSearches *
|
|
117 ggp_search_new(void);
|
|
118
|
|
119 /**
|
|
120 * Destroy GGPSearches instance.
|
|
121 *
|
|
122 * @param searches GGPSearches instance.
|
|
123 */
|
|
124 void
|
|
125 ggp_search_destroy(GGPSearches *searches);
|
|
126
|
|
127 /**
|
|
128 * Initiate a search in the public directory.
|
|
129 *
|
|
130 * @param gc GaimConnection.
|
|
131 * @param form Filled in GGPSearchForm.
|
|
132 *
|
|
133 * @return Sequence number of a search or 0 if an error occured.
|
|
134 */
|
|
135 guint32
|
|
136 ggp_search_start(GaimConnection *gc, GGPSearchForm *form);
|
|
137
|
|
138 /*
|
|
139 * Return converted to the UTF-8 value of the specified field.
|
|
140 *
|
|
141 * @param res Public directory look-up result.
|
|
142 * @param num Id of the record.
|
|
143 * @param fileld Name of the field.
|
|
144 *
|
|
145 * @return UTF-8 encoded value of the field.
|
|
146 */
|
|
147 char *
|
|
148 ggp_search_get_result(gg_pubdir50_t res, int num, const char *field);
|
|
149
|
|
150
|
|
151 #endif /* _GAIM_GG_SEARCH_H */
|
|
152
|
|
153 /* vim: set ts=8 sts=0 sw=8 noet: */
|