Wed, 08 Aug 2012 10:02:43 +0200
Gadu-Gadu: status refactoring - own status
| 11414 | 1 | /** |
| 2 | * @file search.h | |
| 3 | * | |
| 15884 | 4 | * purple |
| 11414 | 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 | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
15884
diff
changeset
|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 11414 | 21 | */ |
| 22 | ||
| 23 | ||
| 15884 | 24 | #ifndef _PURPLE_GG_SEARCH_H |
| 25 | #define _PURPLE_GG_SEARCH_H | |
| 11414 | 26 | |
| 27 | #include "connection.h" | |
| 28 | ||
| 13318 | 29 | #include <libgadu.h> |
| 11414 | 30 | |
| 31 | ||
| 13641 | 32 | typedef enum { |
| 33 | GGP_SEARCH_TYPE_INFO, | |
| 34 | GGP_SEARCH_TYPE_FULL | |
| 35 | ||
| 36 | } GGPSearchType; | |
| 37 | ||
| 11414 | 38 | typedef struct { |
| 39 | ||
| 40 | char *uin; | |
| 41 | char *lastname; | |
| 42 | char *firstname; | |
| 43 | char *nickname; | |
| 44 | char *city; | |
| 45 | char *birthyear; | |
| 46 | char *gender; | |
| 47 | char *active; | |
| 48 | ||
| 13641 | 49 | GGPSearchType search_type; |
| 50 | guint32 seq; | |
|
31879
6c34fd3b36f4
Fixed searching for buddies in Gadu-Gadu public directory. Fixes #5242
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
31293
diff
changeset
|
51 | guint16 page_number; |
|
6c34fd3b36f4
Fixed searching for buddies in Gadu-Gadu public directory. Fixes #5242
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
31293
diff
changeset
|
52 | guint16 page_size; /* how many contacts fits into one page of results */ |
| 13641 | 53 | |
| 54 | void *user_data; | |
| 55 | void *window; | |
| 11414 | 56 | } GGPSearchForm; |
| 57 | ||
| 13641 | 58 | typedef GHashTable GGPSearches; |
| 59 | ||
| 60 | ||
| 11414 | 61 | /** |
| 62 | * Create a new GGPSearchForm structure, and set the fields | |
| 63 | * to the sane defaults. | |
| 64 | * | |
| 65 | * @return Newly allocated GGPSearchForm. | |
| 66 | */ | |
| 67 | GGPSearchForm * | |
| 13641 | 68 | ggp_search_form_new(GGPSearchType st); |
| 69 | ||
| 70 | /** | |
| 71 | * Destroy a Search Form. | |
| 72 | * | |
| 73 | * @param form Search Form to destroy. | |
| 74 | */ | |
| 75 | void | |
| 76 | ggp_search_form_destroy(GGPSearchForm *form); | |
| 77 | ||
| 78 | /** | |
| 79 | * Add a search to the list of searches. | |
| 80 | * | |
| 81 | * @param searches The list of searches. | |
| 82 | * @param seq Search (form) ID number. | |
| 83 | * @param form The search form to add. | |
| 84 | */ | |
| 85 | void | |
| 86 | ggp_search_add(GGPSearches *searches, guint32 seq, GGPSearchForm *form); | |
| 87 | ||
| 88 | /** | |
| 89 | * Remove a search from the list. | |
| 90 | * | |
| 91 | * If you want to destory the search completely also call: | |
| 92 | * ggp_search_form_destroy(). | |
| 93 | * | |
| 94 | * @param searches The list of searches. | |
| 95 | * @param seq ID number of the search. | |
| 96 | */ | |
| 97 | void | |
| 98 | ggp_search_remove(GGPSearches *searches, guint32 seq); | |
| 99 | ||
| 100 | /** | |
| 101 | * Return the search with the specified ID. | |
| 102 | * | |
| 103 | * @param searches The list of searches. | |
| 104 | * @param seq ID number of the search. | |
| 105 | */ | |
| 106 | GGPSearchForm * | |
| 107 | ggp_search_get(GGPSearches *searches, guint32 seq); | |
| 108 | ||
| 109 | /** | |
| 110 | * Create a new GGPSearches structure. | |
| 111 | * | |
| 112 | * @return GGPSearches instance. | |
| 113 | */ | |
| 114 | GGPSearches * | |
| 115 | ggp_search_new(void); | |
| 116 | ||
| 117 | /** | |
| 118 | * Destroy GGPSearches instance. | |
| 119 | * | |
| 120 | * @param searches GGPSearches instance. | |
| 121 | */ | |
| 122 | void | |
| 123 | ggp_search_destroy(GGPSearches *searches); | |
| 11414 | 124 | |
| 125 | /** | |
| 126 | * Initiate a search in the public directory. | |
| 127 | * | |
| 15884 | 128 | * @param gc PurpleConnection. |
| 11414 | 129 | * @param form Filled in GGPSearchForm. |
| 13641 | 130 | * |
|
23517
db3d6a500678
Fix occurred to be spelled correctly. Thanks to bruce89 for noticing. Fixes #6096.
Daniel Atallah <datallah@pidgin.im>
parents:
19859
diff
changeset
|
131 | * @return Sequence number of a search or 0 if an error occurred. |
| 11414 | 132 | */ |
| 13641 | 133 | guint32 |
| 15884 | 134 | ggp_search_start(PurpleConnection *gc, GGPSearchForm *form); |
| 11414 | 135 | |
| 136 | /* | |
| 137 | * Return converted to the UTF-8 value of the specified field. | |
| 138 | * | |
| 12007 | 139 | * @param res Public directory look-up result. |
| 140 | * @param num Id of the record. | |
| 141 | * @param fileld Name of the field. | |
|
31293
169eeb43b52c
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
23517
diff
changeset
|
142 | * |
| 12007 | 143 | * @return UTF-8 encoded value of the field. |
| 11414 | 144 | */ |
| 145 | char * | |
| 146 | ggp_search_get_result(gg_pubdir50_t res, int num, const char *field); | |
| 147 | ||
| 148 | ||
| 15884 | 149 | #endif /* _PURPLE_GG_SEARCH_H */ |
| 11414 | 150 | |
| 12007 | 151 | /* vim: set ts=8 sts=0 sw=8 noet: */ |