Thu, 22 Feb 2024 06:03:16 -0600
Add a favorite property to PurpleContactInfo
This will be used in the future for toggling whether or not contacts are
favorited or starred.
Testing Done:
Ran the unit tests under valgrind.
Reviewed at https://reviews.imfreedom.org/r/2965/
|
42293
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
2 | * Purple - Internet Messaging Library |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * Purple is the legal property of its developers, whose names are too numerous |
|
42594
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42538
diff
changeset
|
6 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
42293
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * source distribution. |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * |
|
42594
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42538
diff
changeset
|
9 | * This library is free software; you can redistribute it and/or modify it |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42538
diff
changeset
|
10 | * under the terms of the GNU General Public License as published by the Free |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42538
diff
changeset
|
11 | * Software Foundation; either version 2 of the License, or (at your option) |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42538
diff
changeset
|
12 | * any later version. |
|
42293
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * |
|
42594
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42538
diff
changeset
|
14 | * This library is distributed in the hope that it will be useful, but WITHOUT |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42538
diff
changeset
|
15 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42538
diff
changeset
|
16 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42538
diff
changeset
|
17 | * more details. |
|
42293
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | * |
|
42594
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42538
diff
changeset
|
19 | * You should have received a copy of the GNU General Public License along with |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42538
diff
changeset
|
20 | * this library; if not, see <https://www.gnu.org/licenses/>. |
|
42293
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | */ |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 | |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
23 | #include "purpleprotocolcontacts.h" |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
24 | |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
25 | /****************************************************************************** |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
26 | * GInterface Implementation |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
27 | *****************************************************************************/ |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
28 | G_DEFINE_INTERFACE(PurpleProtocolContacts, purple_protocol_contacts, |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
29 | PURPLE_TYPE_PROTOCOL) |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
30 | |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
31 | static void |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
32 | purple_protocol_contacts_default_init(G_GNUC_UNUSED PurpleProtocolContactsInterface *iface) |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
33 | { |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 | } |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 | /****************************************************************************** |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 | * Public API |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
38 | *****************************************************************************/ |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
39 | void |
|
42538
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
40 | purple_protocol_contacts_search_async(PurpleProtocolContacts *protocol_contacts, |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
41 | PurpleAccount *account, |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
42 | const char *text, |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
43 | GCancellable *cancellable, |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
44 | GAsyncReadyCallback callback, |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
45 | gpointer data) |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
46 | { |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
47 | PurpleProtocolContactsInterface *iface = NULL; |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
48 | |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
49 | g_return_if_fail(PURPLE_IS_PROTOCOL_CONTACTS(protocol_contacts)); |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
50 | g_return_if_fail(PURPLE_IS_ACCOUNT(account)); |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
51 | g_return_if_fail(!purple_strempty(text)); |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
52 | |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
53 | iface = PURPLE_PROTOCOL_CONTACTS_GET_IFACE(protocol_contacts); |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
54 | if(iface != NULL && iface->search_async != NULL) { |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
55 | iface->search_async(protocol_contacts, account, text, cancellable, |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
56 | callback, data); |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
57 | } else { |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
58 | g_warning("%s does not implement search_async", |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
59 | G_OBJECT_TYPE_NAME(protocol_contacts)); |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
60 | } |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
61 | } |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
62 | |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
63 | GListModel * |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
64 | purple_protocol_contacts_search_finish(PurpleProtocolContacts *protocol_contacts, |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
65 | GAsyncResult *result, |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
66 | GError **error) |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
67 | { |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
68 | PurpleProtocolContactsInterface *iface = NULL; |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
69 | |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
70 | g_return_val_if_fail(PURPLE_IS_PROTOCOL_CONTACTS(protocol_contacts), NULL); |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
71 | |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
72 | iface = PURPLE_PROTOCOL_CONTACTS_GET_IFACE(protocol_contacts); |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
73 | if(iface != NULL && iface->search_finish != NULL) { |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
74 | GListModel *ret = NULL; |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
75 | |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
76 | ret = iface->search_finish(protocol_contacts, result, error); |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
77 | if(G_IS_LIST_MODEL(ret)) { |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
78 | GType type = G_TYPE_INVALID; |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
79 | |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
80 | type = g_list_model_get_item_type(G_LIST_MODEL(ret)); |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
81 | if(g_type_is_a(type, PURPLE_TYPE_CONTACT_INFO)) { |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
82 | return ret; |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
83 | } |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
84 | |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
85 | /* The GListModel we got back doesn't have an item type that is |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
86 | * PurpleContactInfo or a subclass of it. |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
87 | */ |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
88 | g_clear_object(&ret); |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
89 | |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
90 | g_set_error(error, PURPLE_PROTOCOL_CONTACTS_DOMAIN, 0, |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
91 | "%s returned a list of type %s which is not " |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
92 | "PurpleContactInfo or a subclass of", |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
93 | G_OBJECT_TYPE_NAME(protocol_contacts), |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
94 | g_type_name(type)); |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
95 | } |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
96 | } else { |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
97 | g_warning("%s does not implement search_finish", |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
98 | G_OBJECT_TYPE_NAME(protocol_contacts)); |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
99 | } |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
100 | |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
101 | return NULL; |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
102 | } |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
103 | |
|
d6b14c011e68
Merge PurpleProtocolContactsSearch into PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42297
diff
changeset
|
104 | void |
|
42293
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
105 | purple_protocol_contacts_get_profile_async(PurpleProtocolContacts *protocol_contacts, |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
106 | PurpleContactInfo *info, |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
107 | GCancellable *cancellable, |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
108 | GAsyncReadyCallback callback, |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
109 | gpointer data) |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
110 | { |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
111 | PurpleProtocolContactsInterface *iface = NULL; |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
112 | |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
113 | g_return_if_fail(PURPLE_IS_PROTOCOL_CONTACTS(protocol_contacts)); |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
114 | g_return_if_fail(PURPLE_IS_CONTACT_INFO(info)); |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
115 | |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
116 | iface = PURPLE_PROTOCOL_CONTACTS_GET_IFACE(protocol_contacts); |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
117 | if(iface != NULL && iface->get_profile_async != NULL) { |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
118 | iface->get_profile_async(protocol_contacts, info, cancellable, |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
119 | callback, data); |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
120 | } else { |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
121 | g_warning("%s does not implement get_profile_async", |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
122 | G_OBJECT_TYPE_NAME(protocol_contacts)); |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
123 | } |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
124 | } |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
125 | |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
126 | char * |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
127 | purple_protocol_contacts_get_profile_finish(PurpleProtocolContacts *protocol_contacts, |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
128 | GAsyncResult *result, |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
129 | GError **error) |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
130 | { |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
131 | PurpleProtocolContactsInterface *iface = NULL; |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
132 | |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
133 | g_return_val_if_fail(PURPLE_IS_PROTOCOL_CONTACTS(protocol_contacts), NULL); |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
134 | |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
135 | iface = PURPLE_PROTOCOL_CONTACTS_GET_IFACE(protocol_contacts); |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
136 | if(iface != NULL && iface->get_profile_finish != NULL) { |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
137 | return iface->get_profile_finish(protocol_contacts, result, error); |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
138 | } else { |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
139 | g_warning("%s does not implement get_profile_finish", |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
140 | G_OBJECT_TYPE_NAME(protocol_contacts)); |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
141 | } |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
142 | |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
143 | return NULL; |
|
8888e6d1e9a8
Create the PurpleProtocolContacts interface
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
144 | } |
|
42297
392bb692c505
Add virtual functions for actions and menu to PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42293
diff
changeset
|
145 | |
|
392bb692c505
Add virtual functions for actions and menu to PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42293
diff
changeset
|
146 | GActionGroup * |
|
392bb692c505
Add virtual functions for actions and menu to PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42293
diff
changeset
|
147 | purple_protocol_contacts_get_actions(PurpleProtocolContacts *protocol_contacts, |
|
392bb692c505
Add virtual functions for actions and menu to PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42293
diff
changeset
|
148 | PurpleContactInfo *info) |
|
392bb692c505
Add virtual functions for actions and menu to PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42293
diff
changeset
|
149 | { |
|
392bb692c505
Add virtual functions for actions and menu to PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42293
diff
changeset
|
150 | PurpleProtocolContactsInterface *iface = NULL; |
|
392bb692c505
Add virtual functions for actions and menu to PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42293
diff
changeset
|
151 | |
|
392bb692c505
Add virtual functions for actions and menu to PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42293
diff
changeset
|
152 | g_return_val_if_fail(PURPLE_IS_PROTOCOL_CONTACTS(protocol_contacts), NULL); |
|
392bb692c505
Add virtual functions for actions and menu to PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42293
diff
changeset
|
153 | g_return_val_if_fail(PURPLE_IS_CONTACT_INFO(info), NULL); |
|
392bb692c505
Add virtual functions for actions and menu to PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42293
diff
changeset
|
154 | |
|
392bb692c505
Add virtual functions for actions and menu to PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42293
diff
changeset
|
155 | iface = PURPLE_PROTOCOL_CONTACTS_GET_IFACE(protocol_contacts); |
|
392bb692c505
Add virtual functions for actions and menu to PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42293
diff
changeset
|
156 | if(iface != NULL && iface->get_actions != NULL) { |
|
392bb692c505
Add virtual functions for actions and menu to PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42293
diff
changeset
|
157 | return iface->get_actions(protocol_contacts, info); |
|
392bb692c505
Add virtual functions for actions and menu to PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42293
diff
changeset
|
158 | } |
|
392bb692c505
Add virtual functions for actions and menu to PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42293
diff
changeset
|
159 | |
|
392bb692c505
Add virtual functions for actions and menu to PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42293
diff
changeset
|
160 | return NULL; |
|
392bb692c505
Add virtual functions for actions and menu to PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42293
diff
changeset
|
161 | } |
|
392bb692c505
Add virtual functions for actions and menu to PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42293
diff
changeset
|
162 | |
|
392bb692c505
Add virtual functions for actions and menu to PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42293
diff
changeset
|
163 | GMenuModel * |
|
392bb692c505
Add virtual functions for actions and menu to PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42293
diff
changeset
|
164 | purple_protocol_contacts_get_menu(PurpleProtocolContacts *protocol_contacts, |
|
392bb692c505
Add virtual functions for actions and menu to PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42293
diff
changeset
|
165 | PurpleContactInfo *info) |
|
392bb692c505
Add virtual functions for actions and menu to PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42293
diff
changeset
|
166 | { |
|
392bb692c505
Add virtual functions for actions and menu to PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42293
diff
changeset
|
167 | PurpleProtocolContactsInterface *iface = NULL; |
|
392bb692c505
Add virtual functions for actions and menu to PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42293
diff
changeset
|
168 | |
|
392bb692c505
Add virtual functions for actions and menu to PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42293
diff
changeset
|
169 | g_return_val_if_fail(PURPLE_IS_PROTOCOL_CONTACTS(protocol_contacts), NULL); |
|
392bb692c505
Add virtual functions for actions and menu to PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42293
diff
changeset
|
170 | g_return_val_if_fail(PURPLE_IS_CONTACT_INFO(info), NULL); |
|
392bb692c505
Add virtual functions for actions and menu to PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42293
diff
changeset
|
171 | |
|
392bb692c505
Add virtual functions for actions and menu to PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42293
diff
changeset
|
172 | iface = PURPLE_PROTOCOL_CONTACTS_GET_IFACE(protocol_contacts); |
|
392bb692c505
Add virtual functions for actions and menu to PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42293
diff
changeset
|
173 | if(iface != NULL && iface->get_menu != NULL) { |
|
392bb692c505
Add virtual functions for actions and menu to PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42293
diff
changeset
|
174 | return iface->get_menu(protocol_contacts, info); |
|
392bb692c505
Add virtual functions for actions and menu to PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42293
diff
changeset
|
175 | } |
|
392bb692c505
Add virtual functions for actions and menu to PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42293
diff
changeset
|
176 | |
|
392bb692c505
Add virtual functions for actions and menu to PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42293
diff
changeset
|
177 | return NULL; |
|
392bb692c505
Add virtual functions for actions and menu to PurpleProtocolContacts
Gary Kramlich <grim@reaperworld.com>
parents:
42293
diff
changeset
|
178 | } |