libpurple/purpleprotocolcontactsearch.h

changeset 42266
f521c4c38c6e
child 42338
2548eb61acc9
equal deleted inserted replaced
42265:f73d7d49a91c 42266:f521c4c38c6e
1 /*
2 * Purple - Internet Messaging Library
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
4 *
5 * Purple is the legal property of its developers, whose names are too numerous
6 * to list here. Please refer to the COPYRIGHT file distributed with this
7 * source distribution.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, see <https://www.gnu.org/licenses/>.
21 */
22
23 #if !defined(PURPLE_GLOBAL_HEADER_INSIDE) && !defined(PURPLE_COMPILATION)
24 # error "only <purple.h> may be included directly"
25 #endif
26
27 #ifndef PURPLE_PROTOCOL_CONTACT_SEARCH_H
28 #define PURPLE_PROTOCOL_CONTACT_SEARCH_H
29
30 #include <glib.h>
31 #include <glib-object.h>
32
33 #include <libpurple/purpleprotocol.h>
34
35 #define PURPLE_TYPE_PROTOCOL_CONTACT_SEARCH (purple_protocol_contact_search_get_type())
36 G_DECLARE_INTERFACE(PurpleProtocolContactSearch,
37 purple_protocol_contact_search, PURPLE,
38 PROTOCOL_CONTACT_SEARCH, PurpleProtocol)
39
40 #define PURPLE_PROTOCOL_CONTACT_SEARCH_DOMAIN (g_quark_from_static_string("purple-protocol-contact-search"))
41
42 /**
43 * PurpleProtocolContactSearch:
44 *
45 * The #PurpleProtocolContactSearch interface defines the behavior to search
46 * for new contacts to add to your contact list. A user interface will use
47 * these methods to help users find new contacts.
48 *
49 * Since: 3.0.0
50 */
51
52 /**
53 * PurpleProtocolContactSearchInterface:
54 *
55 * This interface defines the behavior to implement searching for new contacts.
56 *
57 * Since: 3.0.0
58 */
59 struct _PurpleProtocolContactSearchInterface {
60 /*< private >*/
61 GTypeInterface parent;
62
63 /*< public >*/
64 void (*search_async)(PurpleProtocolContactSearch *search, PurpleAccount *account, const char *text, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer data);
65 GListModel *(*search_finish)(PurpleProtocolContactSearch *search, GAsyncResult *result, GError **error);
66
67 /*< private >*/
68 gpointer reserved[4];
69 };
70
71 G_BEGIN_DECLS
72
73 /**
74 * purple_protocol_contact_search_search_async:
75 * @search: The instance.
76 * @account: The [class@Account] to search under.
77 * @text: The text to search for which must not be an empty string.
78 * @cancellable: (nullable): optional GCancellable object, %NULL to ignore.
79 * @callback: (scope async): a #GAsyncReadyCallback to call when the request is
80 * satisfied.
81 * @data: User data to pass to @callback.
82 *
83 * Starts the process of searching for contacts using @account that match
84 * @text.
85 *
86 * Call [method@ProtocolContactSearch.search_finish] to get the results.
87 *
88 * Since: 3.0.0
89 */
90 void purple_protocol_contact_search_search_async(PurpleProtocolContactSearch *search, PurpleAccount *account, const char *text, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer data);
91
92 /**
93 * purple_protocol_contact_search_search_finish:
94 * @search: The instance.
95 * @result: The [iface@Gio.AsyncResult] from the previous
96 * [method@ProtocolContactSearch.search_async] call.
97 * @error: Return address for a #GError, or %NULL.
98 *
99 * Finishes a previous call to [method@ProtocolContactSearch.search_async] and
100 * gets the result.
101 *
102 * Returns: (transfer full): A [iface@Gio.ListModel] of the matched contacts or
103 * %NULL with @error set on error.
104 *
105 * Since: 3.0.0
106 */
107 GListModel *purple_protocol_contact_search_search_finish(PurpleProtocolContactSearch *search, GAsyncResult *result, GError **error);
108
109 G_END_DECLS
110
111 #endif /* PURPLE_PROTOCOL_CONTACT_SEARCH_H */

mercurial