Frameworks/libpurple.framework/Versions/2.10.12r8d2874a79747/Headers/search.h
branchadium-1.5.11
changeset 6014 fcb71cb71a3d
parent 5941 307f53385811
parent 6013 f8d0dc659e3f
child 6016 325e2ab3406f
equal deleted inserted replaced
5941:307f53385811 6014:fcb71cb71a3d
     1 /**
       
     2  * @file search.h
       
     3  *
       
     4  * purple
       
     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., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
       
    21  */
       
    22 
       
    23 
       
    24 #ifndef _PURPLE_GG_SEARCH_H
       
    25 #define _PURPLE_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 
       
    50 	GGPSearchType search_type;
       
    51 	guint32 seq;
       
    52 	guint16 page_number;
       
    53 	guint16 page_size; /* how many contacts fits into one page of results */
       
    54 
       
    55 	void *user_data;
       
    56 	void *window;
       
    57 } GGPSearchForm;
       
    58 
       
    59 typedef GHashTable GGPSearches;
       
    60 
       
    61 
       
    62 /**
       
    63  * Create a new GGPSearchForm structure, and set the fields
       
    64  * to the sane defaults.
       
    65  *
       
    66  * @return Newly allocated GGPSearchForm.
       
    67  */
       
    68 GGPSearchForm *
       
    69 ggp_search_form_new(GGPSearchType st);
       
    70 
       
    71 /**
       
    72  * Destroy a Search Form.
       
    73  *
       
    74  * @param form Search Form to destroy.
       
    75  */
       
    76 void
       
    77 ggp_search_form_destroy(GGPSearchForm *form);
       
    78 
       
    79 /**
       
    80  * Add a search to the list of searches.
       
    81  *
       
    82  * @param searches The list of searches.
       
    83  * @param seq      Search (form) ID number.
       
    84  * @param form 	   The search form to add.
       
    85  */
       
    86 void
       
    87 ggp_search_add(GGPSearches *searches, guint32 seq, GGPSearchForm *form);
       
    88 
       
    89 /**
       
    90  * Remove a search from the list.
       
    91  *
       
    92  * If you want to destory the search completely also call:
       
    93  * ggp_search_form_destroy().
       
    94  *
       
    95  * @param searches The list of searches.
       
    96  * @param seq      ID number of the search.
       
    97  */
       
    98 void
       
    99 ggp_search_remove(GGPSearches *searches, guint32 seq);
       
   100 
       
   101 /**
       
   102  * Return the search with the specified ID.
       
   103  *
       
   104  * @param searches The list of searches.
       
   105  * @param seq      ID number of the search.
       
   106  */
       
   107 GGPSearchForm *
       
   108 ggp_search_get(GGPSearches *searches, guint32 seq);
       
   109 
       
   110 /**
       
   111  * Create a new GGPSearches structure.
       
   112  *
       
   113  * @return GGPSearches instance.
       
   114  */
       
   115 GGPSearches *
       
   116 ggp_search_new(void);
       
   117 
       
   118 /**
       
   119  * Destroy GGPSearches instance.
       
   120  *
       
   121  * @param searches GGPSearches instance.
       
   122  */
       
   123 void
       
   124 ggp_search_destroy(GGPSearches *searches);
       
   125 
       
   126 /**
       
   127  * Initiate a search in the public directory.
       
   128  *
       
   129  * @param gc   PurpleConnection.
       
   130  * @param form Filled in GGPSearchForm.
       
   131  *
       
   132  * @return Sequence number of a search or 0 if an error occurred.
       
   133  */
       
   134 guint32
       
   135 ggp_search_start(PurpleConnection *gc, GGPSearchForm *form);
       
   136 
       
   137 /*
       
   138  * Return converted to the UTF-8 value of the specified field.
       
   139  *
       
   140  * @param res    Public directory look-up result.
       
   141  * @param num    Id of the record.
       
   142  * @param fileld Name of the field.
       
   143  *
       
   144  * @return UTF-8 encoded value of the field.
       
   145  */
       
   146 char *
       
   147 ggp_search_get_result(gg_pubdir50_t res, int num, const char *field);
       
   148 
       
   149 
       
   150 #endif /* _PURPLE_GG_SEARCH_H */
       
   151 
       
   152 /* vim: set ts=8 sts=0 sw=8 noet: */