Mercurial > pidgin.yaz
annotate src/protocols/gg/search.c @ 12007:8724718d387f
[gaim-migrate @ 14300]
Further updates to gg from Bartosz Oler. This makes the login and token retrieval processes asynchronous. There are also some encoding fixes and various cleanups. There are some changes from me to make it work on win32.
committer: Tailor Script <tailor@pidgin.im>
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Tue, 08 Nov 2005 19:45:09 +0000 |
parents | d5599677bf32 |
children | 41747a38a1a8 |
rev | line source |
---|---|
11414 | 1 /** |
2 * @file search.c | |
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 #include "lib/libgadu.h" | |
25 | |
26 #include "utils.h" | |
27 #include "search.h" | |
28 | |
29 /* GGPSearchForm *ggp_search_form_new() {{{ */ | |
30 GGPSearchForm *ggp_search_form_new() | |
31 { | |
32 GGPSearchForm *form; | |
33 | |
34 form = g_new0(GGPSearchForm, 1); | |
35 form->uin = NULL; | |
36 form->lastname = NULL; | |
37 form->firstname = NULL; | |
38 form->nickname = NULL; | |
39 form->city = NULL; | |
40 form->birthyear = NULL; | |
41 form->gender = NULL; | |
42 form->active = NULL; | |
43 form->offset = NULL; | |
44 | |
45 form->last_uin = NULL; | |
46 | |
47 return form; | |
48 } | |
49 /* }}} */ | |
50 | |
51 /* void ggp_search_start(GaimConnection *gc, GGPSearchForm *form) {{{ */ | |
52 void ggp_search_start(GaimConnection *gc, GGPSearchForm *form) | |
53 { | |
54 GGPInfo *info = gc->proto_data; | |
55 gg_pubdir50_t req; | |
56 | |
57 gaim_debug_info("gg", "It's time to perform a search...\n"); | |
58 | |
59 if ((req = gg_pubdir50_new(GG_PUBDIR50_SEARCH)) == NULL) { | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11414
diff
changeset
|
60 gaim_debug_error("gg", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11414
diff
changeset
|
61 "ggp_bmenu_show_details: Unable to create req variable.\n"); |
11414 | 62 return; |
63 } | |
64 | |
65 if (form->uin != NULL) { | |
66 gaim_debug_info("gg", " uin: %s\n", form->uin); | |
67 gg_pubdir50_add(req, GG_PUBDIR50_UIN, form->uin); | |
68 } else { | |
69 if (form->lastname != NULL) { | |
70 gaim_debug_info("gg", " lastname: %s\n", form->lastname); | |
71 gg_pubdir50_add(req, GG_PUBDIR50_LASTNAME, form->lastname); | |
72 } | |
73 | |
74 if (form->firstname != NULL) { | |
75 gaim_debug_info("gg", " firstname: %s\n", form->firstname); | |
76 gg_pubdir50_add(req, GG_PUBDIR50_FIRSTNAME, form->firstname); | |
77 } | |
78 | |
79 if (form->nickname != NULL) { | |
80 gaim_debug_info("gg", " nickname: %s\n", form->nickname); | |
81 gg_pubdir50_add(req, GG_PUBDIR50_NICKNAME, form->nickname); | |
82 } | |
83 | |
84 if (form->city != NULL) { | |
85 gaim_debug_info("gg", " city: %s\n", form->city); | |
86 gg_pubdir50_add(req, GG_PUBDIR50_CITY, form->city); | |
87 } | |
88 | |
89 if (form->birthyear != NULL) { | |
90 gaim_debug_info("gg", " birthyear: %s\n", form->birthyear); | |
91 gg_pubdir50_add(req, GG_PUBDIR50_BIRTHYEAR, form->birthyear); | |
92 } | |
93 | |
94 if (form->gender != NULL) { | |
95 gaim_debug_info("gg", " gender: %s\n", form->gender); | |
96 gg_pubdir50_add(req, GG_PUBDIR50_GENDER, form->gender); | |
97 } | |
98 | |
99 if (form->active != NULL) { | |
100 gaim_debug_info("gg", " active: %s\n", form->active); | |
101 gg_pubdir50_add(req, GG_PUBDIR50_ACTIVE, form->active); | |
102 } | |
103 } | |
104 | |
105 gaim_debug_info("gg", "offset: %s\n", form->offset); | |
106 gg_pubdir50_add(req, GG_PUBDIR50_START, g_strdup(form->offset)); | |
107 | |
108 if (gg_pubdir50(info->session, req) == 0) { | |
109 gaim_debug_warning("gg", "ggp_bmenu_show_details: Search failed.\n"); | |
110 return; | |
111 } | |
112 | |
113 gg_pubdir50_free(req); | |
114 } | |
115 /* }}} */ | |
116 | |
117 /* char *ggp_search_get_result(gg_pubdir50_t res, int num, const char *field) {{{ */ | |
118 char *ggp_search_get_result(gg_pubdir50_t res, int num, const char *field) | |
119 { | |
120 char *tmp; | |
121 | |
122 tmp = charset_convert(gg_pubdir50_get(res, num, field), "CP1250", "UTF-8"); | |
123 | |
124 return (tmp == NULL) ? g_strdup("") : tmp; | |
125 } | |
126 /* }}} */ | |
127 | |
128 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11414
diff
changeset
|
129 /* vim: set ts=8 sts=0 sw=8 noet: */ |