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