Sun, 03 Nov 2024 00:05:44 -0500
remove purple3-url-handler.desktop.in.in
The application that did the launching was removed long ago. Also this should
be implemented by the user interfaces and they might provide separate files to
groups schemas as well.
Testing Done:
Called in the turtles.
Reviewed at https://reviews.imfreedom.org/r/3640/
|
41459
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
1 | /* |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
2 | * Purple - Internet Messaging Library |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
4 | * |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
5 | * This library is free software; you can redistribute it and/or |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
6 | * modify it under the terms of the GNU Lesser General Public |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
7 | * License as published by the Free Software Foundation; either |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
8 | * version 2 of the License, or (at your option) any later version. |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
9 | * |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
10 | * This library is distributed in the hope that it will be useful, |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
13 | * Lesser General Public License for more details. |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
14 | * |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU Lesser General Public |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
16 | * License along with this library; if not, see <https://www.gnu.org/licenses/>. |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
17 | */ |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
18 | |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
19 | #include <glib/gi18n-lib.h> |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
20 | |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
21 | #include "purpledemoprotocol.h" |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
22 | #include "purpledemoprotocolactions.h" |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
23 | #include "purpledemoresource.h" |
|
41459
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
24 | |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
25 | /****************************************************************************** |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
26 | * Connection failure action implementations |
|
41459
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
27 | *****************************************************************************/ |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
28 | #define REAPER_BUDDY_NAME ("Gary") |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
29 | #define DEFAULT_REAP_TIME (5) /* seconds */ |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
30 | #define FATAL_TICK_STR N_("Reaping connection in %d second...") |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
31 | #define FATAL_TICK_PLURAL_STR N_("Reaping connection in %d seconds...") |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
32 | #define FATAL_DISCONNECT_STR N_("%s reaped the connection") |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
33 | #define TEMPORARY_TICK_STR N_("Pruning connection in %d second...") |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
34 | #define TEMPORARY_TICK_PLURAL_STR N_("Pruning connection in %d seconds...") |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
35 | #define TEMPORARY_DISCONNECT_STR N_("%s pruned the connection") |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
36 | |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
37 | static gboolean |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
38 | purple_demo_protocol_failure_tick(gpointer data, |
|
41463
6b13615303cc
Add some custom connection errors
Gary Kramlich <grim@reaperworld.com>
parents:
41460
diff
changeset
|
39 | PurpleConnectionError error_code, |
|
42914
27c407608b6b
Update Purple.AddContactRequest to use a PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
42881
diff
changeset
|
40 | const char *tick_str, |
|
27c407608b6b
Update Purple.AddContactRequest to use a PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
42881
diff
changeset
|
41 | const char *tick_plural_str, |
|
27c407608b6b
Update Purple.AddContactRequest to use a PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
42881
diff
changeset
|
42 | const char *disconnect_str) |
|
41459
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
43 | { |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
44 | PurpleConnection *connection = PURPLE_CONNECTION(data); |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
45 | PurpleAccount *account = purple_connection_get_account(connection); |
|
43006
b9cbf5cb2003
Update the protocols now that Purple.Account:error is a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents:
43002
diff
changeset
|
46 | GError *error = NULL; |
|
42914
27c407608b6b
Update Purple.AddContactRequest to use a PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
42881
diff
changeset
|
47 | int timeout = 0; |
|
41459
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
48 | |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
49 | timeout = GPOINTER_TO_INT(g_object_steal_data(G_OBJECT(connection), |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
50 | "reaping-time")); |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
51 | timeout--; |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
52 | if(timeout > 0) { |
|
42204
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
53 | PurpleContact *contact = NULL; |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
54 | PurpleContactManager *manager = NULL; |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
55 | |
|
41459
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
56 | g_object_set_data(G_OBJECT(connection), "reaping-time", |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
57 | GINT_TO_POINTER(timeout)); |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
58 | |
|
42204
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
59 | manager = purple_contact_manager_get_default(); |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
60 | contact = purple_contact_manager_find_with_username(manager, account, |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
61 | REAPER_BUDDY_NAME); |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
62 | |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
63 | if(PURPLE_IS_CONTACT(contact)) { |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
64 | PurpleContactInfo *info = PURPLE_CONTACT_INFO(contact); |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
65 | PurplePresence *presence = purple_contact_info_get_presence(info); |
|
43006
b9cbf5cb2003
Update the protocols now that Purple.Account:error is a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents:
43002
diff
changeset
|
66 | char *message = NULL; |
|
42204
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
67 | const char *format = ngettext(tick_str, tick_plural_str, timeout); |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
68 | |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
69 | message = g_strdup_printf(format, timeout); |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
70 | purple_presence_set_message(presence, message); |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
71 | g_free(message); |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
72 | } |
|
41459
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
73 | |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
74 | return G_SOURCE_CONTINUE; |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
75 | } |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
76 | |
|
43006
b9cbf5cb2003
Update the protocols now that Purple.Account:error is a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents:
43002
diff
changeset
|
77 | error = g_error_new(PURPLE_CONNECTION_ERROR, error_code, _(disconnect_str), |
|
b9cbf5cb2003
Update the protocols now that Purple.Account:error is a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents:
43002
diff
changeset
|
78 | REAPER_BUDDY_NAME); |
|
b9cbf5cb2003
Update the protocols now that Purple.Account:error is a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents:
43002
diff
changeset
|
79 | purple_account_disconnect_with_error(account, error); |
|
42998
9fae31173eb3
Remove Purple.Connection.error and its friends
Gary Kramlich <grim@reaperworld.com>
parents:
42988
diff
changeset
|
80 | |
|
41459
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
81 | return G_SOURCE_REMOVE; |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
82 | } |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
83 | |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
84 | static gboolean |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
85 | purple_demo_protocol_fatal_failure_cb(gpointer data) { |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
86 | return purple_demo_protocol_failure_tick(data, |
|
41463
6b13615303cc
Add some custom connection errors
Gary Kramlich <grim@reaperworld.com>
parents:
41460
diff
changeset
|
87 | PURPLE_CONNECTION_ERROR_CUSTOM_FATAL, |
|
41459
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
88 | FATAL_TICK_STR, |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
89 | FATAL_TICK_PLURAL_STR, |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
90 | FATAL_DISCONNECT_STR); |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
91 | } |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
92 | |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
93 | static gboolean |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
94 | purple_demo_protocol_temporary_failure_cb(gpointer data) { |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
95 | return purple_demo_protocol_failure_tick(data, |
|
41463
6b13615303cc
Add some custom connection errors
Gary Kramlich <grim@reaperworld.com>
parents:
41460
diff
changeset
|
96 | PURPLE_CONNECTION_ERROR_CUSTOM_TEMPORARY, |
|
41459
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
97 | TEMPORARY_TICK_STR, |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
98 | TEMPORARY_TICK_PLURAL_STR, |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
99 | TEMPORARY_DISCONNECT_STR); |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
100 | } |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
101 | |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
102 | static void |
|
41968
2fc2db360044
Bump C standard to C99 for Demo protocol and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41905
diff
changeset
|
103 | purple_demo_protocol_failure_action_activate(G_GNUC_UNUSED GSimpleAction *action, |
|
41459
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
104 | GVariant *parameter, |
|
42914
27c407608b6b
Update Purple.AddContactRequest to use a PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
42881
diff
changeset
|
105 | const char *tick_str, |
|
27c407608b6b
Update Purple.AddContactRequest to use a PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
42881
diff
changeset
|
106 | const char *tick_plural_str, |
|
41459
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
107 | GSourceFunc cb) |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
108 | { |
|
42204
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
109 | PurpleAccountManager *account_manager = NULL; |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
110 | PurpleAccount *account = NULL; |
|
41459
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
111 | PurpleConnection *connection = NULL; |
|
42204
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
112 | PurpleContact *contact = NULL; |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
113 | PurpleContactManager *contact_manager = NULL; |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
114 | const char *account_id = NULL; |
|
41459
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
115 | |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
116 | if(!g_variant_is_of_type(parameter, G_VARIANT_TYPE_STRING)) { |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
117 | g_critical("Demo failure action parameter is of incorrect type %s", |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
118 | g_variant_get_type_string(parameter)); |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
119 | return; |
|
41459
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
120 | } |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
121 | |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
122 | account_id = g_variant_get_string(parameter, NULL); |
|
42204
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
123 | account_manager = purple_account_manager_get_default(); |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
124 | account = purple_account_manager_find_by_id(account_manager, account_id); |
|
41459
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
125 | connection = purple_account_get_connection(account); |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
126 | |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
127 | /* Do nothing if disconnected, or already in process of reaping. */ |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
128 | if(!PURPLE_IS_CONNECTION(connection)) { |
|
42291
a86b7bcbb471
Make the purple_account_manager_find functions return transfer full.
Gary Kramlich <grim@reaperworld.com>
parents:
42204
diff
changeset
|
129 | g_clear_object(&account); |
|
a86b7bcbb471
Make the purple_account_manager_find functions return transfer full.
Gary Kramlich <grim@reaperworld.com>
parents:
42204
diff
changeset
|
130 | |
|
41459
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
131 | return; |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
132 | } |
|
42291
a86b7bcbb471
Make the purple_account_manager_find functions return transfer full.
Gary Kramlich <grim@reaperworld.com>
parents:
42204
diff
changeset
|
133 | |
|
41459
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
134 | if(g_object_get_data(G_OBJECT(connection), "reaping-time")) { |
|
42291
a86b7bcbb471
Make the purple_account_manager_find functions return transfer full.
Gary Kramlich <grim@reaperworld.com>
parents:
42204
diff
changeset
|
135 | g_clear_object(&account); |
|
a86b7bcbb471
Make the purple_account_manager_find functions return transfer full.
Gary Kramlich <grim@reaperworld.com>
parents:
42204
diff
changeset
|
136 | |
|
41459
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
137 | return; |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
138 | } |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
139 | |
|
42204
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
140 | /* Find the reaper. */ |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
141 | contact_manager = purple_contact_manager_get_default(); |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
142 | contact = purple_contact_manager_find_with_username(contact_manager, |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
143 | account, |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
144 | REAPER_BUDDY_NAME); |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
145 | |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
146 | if(PURPLE_IS_CONTACT(contact)) { |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
147 | PurpleContactInfo *info = PURPLE_CONTACT_INFO(contact); |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
148 | PurplePresence *presence = purple_contact_info_get_presence(info); |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
149 | const char *format = NULL; |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
150 | char *message = NULL; |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
151 | |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
152 | format = ngettext(tick_str, tick_plural_str, DEFAULT_REAP_TIME); |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
153 | message = g_strdup_printf(format, DEFAULT_REAP_TIME); |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
154 | |
|
42747
801025bad2e1
Make PurplePresence final and other clean ups
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
155 | purple_presence_set_idle(presence, FALSE); |
|
42204
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
156 | purple_presence_set_message(presence, message); |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
157 | g_free(message); |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
158 | } |
|
41459
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
159 | |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
160 | g_object_set_data(G_OBJECT(connection), "reaping-time", |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
161 | GINT_TO_POINTER(DEFAULT_REAP_TIME)); |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
162 | g_timeout_add_seconds(1, cb, connection); |
|
42291
a86b7bcbb471
Make the purple_account_manager_find functions return transfer full.
Gary Kramlich <grim@reaperworld.com>
parents:
42204
diff
changeset
|
163 | |
|
a86b7bcbb471
Make the purple_account_manager_find functions return transfer full.
Gary Kramlich <grim@reaperworld.com>
parents:
42204
diff
changeset
|
164 | g_clear_object(&account); |
|
41459
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
165 | } |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
166 | |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
167 | static void |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
168 | purple_demo_protocol_temporary_failure_action_activate(GSimpleAction *action, |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
169 | GVariant *parameter, |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
170 | G_GNUC_UNUSED gpointer data) |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
171 | { |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
172 | purple_demo_protocol_failure_action_activate(action, parameter, |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
173 | TEMPORARY_TICK_STR, |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
174 | TEMPORARY_TICK_PLURAL_STR, |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
175 | purple_demo_protocol_temporary_failure_cb); |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
176 | } |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
177 | |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
178 | static void |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
179 | purple_demo_protocol_fatal_failure_action_activate(GSimpleAction *action, |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
180 | GVariant *parameter, |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
181 | G_GNUC_UNUSED gpointer data) |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
182 | { |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
183 | purple_demo_protocol_failure_action_activate(action, parameter, |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
184 | FATAL_TICK_STR, |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
185 | FATAL_TICK_PLURAL_STR, |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
186 | purple_demo_protocol_fatal_failure_cb); |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
187 | } |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
188 | |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
189 | /****************************************************************************** |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
190 | * Request API action implementations |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
191 | *****************************************************************************/ |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
192 | static void |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
193 | purple_demo_protocol_request_fields_ok_cb(G_GNUC_UNUSED gpointer data, |
|
42128
118067ca0367
Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42127
diff
changeset
|
194 | PurpleRequestPage *page) |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
195 | { |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
196 | PurpleAccount *account = NULL; |
|
42140
beba61bbdf19
Convert PurpleRequestFieldList into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42139
diff
changeset
|
197 | PurpleRequestFieldList *field = NULL; |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
198 | GList *list = NULL; |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
199 | const char *tmp = NULL; |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
200 | GString *info = NULL; |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
201 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
202 | info = g_string_new(_("Basic group:\n")); |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
203 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
204 | g_string_append_printf(info, _("\tString: %s\n"), |
|
42128
118067ca0367
Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42127
diff
changeset
|
205 | purple_request_page_get_string(page, "string")); |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
206 | g_string_append_printf(info, _("\tMultiline string: %s\n"), |
|
42128
118067ca0367
Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42127
diff
changeset
|
207 | purple_request_page_get_string(page, |
|
118067ca0367
Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42127
diff
changeset
|
208 | "multiline-string")); |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
209 | g_string_append_printf(info, _("\tMasked string: %s\n"), |
|
42128
118067ca0367
Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42127
diff
changeset
|
210 | purple_request_page_get_string(page, |
|
118067ca0367
Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42127
diff
changeset
|
211 | "masked-string")); |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
212 | g_string_append_printf(info, _("\tAlphanumeric string: %s\n"), |
|
42128
118067ca0367
Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42127
diff
changeset
|
213 | purple_request_page_get_string(page, |
|
118067ca0367
Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42127
diff
changeset
|
214 | "alphanumeric")); |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
215 | g_string_append_printf(info, _("\tEmail string: %s\n"), |
|
42128
118067ca0367
Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42127
diff
changeset
|
216 | purple_request_page_get_string(page, "email")); |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
217 | g_string_append_printf(info, _("\tInteger: %d\n"), |
|
42128
118067ca0367
Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42127
diff
changeset
|
218 | purple_request_page_get_integer(page, "int")); |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
219 | g_string_append_printf(info, _("\tBoolean: %s\n"), |
|
42128
118067ca0367
Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42127
diff
changeset
|
220 | purple_request_page_get_bool(page, "bool") ? |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
221 | _("TRUE") : _("FALSE")); |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
222 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
223 | g_string_append(info, _("Multiple-choice group:\n")); |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
224 | |
|
42128
118067ca0367
Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42127
diff
changeset
|
225 | tmp = (const char *)purple_request_page_get_choice(page, "choice"); |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
226 | g_string_append_printf(info, _("\tChoice: %s\n"), tmp); |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
227 | |
|
42140
beba61bbdf19
Convert PurpleRequestFieldList into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42139
diff
changeset
|
228 | field = PURPLE_REQUEST_FIELD_LIST(purple_request_page_get_field(page, |
|
beba61bbdf19
Convert PurpleRequestFieldList into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42139
diff
changeset
|
229 | "list")); |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
230 | list = purple_request_field_list_get_selected(field); |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
231 | if(list != NULL) { |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
232 | tmp = (const char *)list->data; |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
233 | } else { |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
234 | tmp = _("(unset)"); |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
235 | } |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
236 | g_string_append_printf(info, _("\tList: %s\n"), tmp); |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
237 | |
|
42140
beba61bbdf19
Convert PurpleRequestFieldList into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42139
diff
changeset
|
238 | field = PURPLE_REQUEST_FIELD_LIST(purple_request_page_get_field(page, |
|
beba61bbdf19
Convert PurpleRequestFieldList into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42139
diff
changeset
|
239 | "multilist")); |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
240 | list = purple_request_field_list_get_selected(field); |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
241 | g_string_append(info, _("\tMulti-list: [")); |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
242 | while(list != NULL) { |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
243 | tmp = (const char *)list->data; |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
244 | g_string_append_printf(info, "%s%s", tmp, |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
245 | list->next != NULL ? ", " : ""); |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
246 | list = list->next; |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
247 | } |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
248 | g_string_append(info, _("]\n")); |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
249 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
250 | g_string_append(info, _("Special group:\n")); |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
251 | |
|
42128
118067ca0367
Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42127
diff
changeset
|
252 | account = purple_request_page_get_account(page, "account"); |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
253 | if(PURPLE_IS_ACCOUNT(account)) { |
|
42803
984f8dfabb47
Update the protocols to use get id and username directly on PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents:
42752
diff
changeset
|
254 | PurpleContactInfo *info = NULL; |
|
984f8dfabb47
Update the protocols to use get id and username directly on PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents:
42752
diff
changeset
|
255 | |
|
984f8dfabb47
Update the protocols to use get id and username directly on PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents:
42752
diff
changeset
|
256 | info = purple_account_get_contact_info(account); |
|
984f8dfabb47
Update the protocols to use get id and username directly on PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents:
42752
diff
changeset
|
257 | tmp = purple_contact_info_get_name_for_display(info); |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
258 | } else { |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
259 | tmp = _("(unset)"); |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
260 | } |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
261 | g_string_append_printf(info, _("\tAccount: %s\n"), tmp); |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
262 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
263 | g_message(_("Successfully requested fields:\n%s"), info->str); |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
264 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
265 | g_string_free(info, TRUE); |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
266 | } |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
267 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
268 | static void |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
269 | purple_demo_protocol_request_fields_cancel_cb(G_GNUC_UNUSED gpointer data, |
|
42128
118067ca0367
Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42127
diff
changeset
|
270 | G_GNUC_UNUSED PurpleRequestPage *page) |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
271 | { |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
272 | g_message(_("UI cancelled field request")); |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
273 | } |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
274 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
275 | static void |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
276 | purple_demo_protocol_request_fields_activate(G_GNUC_UNUSED GSimpleAction *action, |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
277 | GVariant *parameter, |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
278 | G_GNUC_UNUSED gpointer data) |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
279 | { |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
280 | PurpleConnection *connection = NULL; |
|
42914
27c407608b6b
Update Purple.AddContactRequest to use a PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
42881
diff
changeset
|
281 | const char *account_id = NULL; |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
282 | PurpleAccountManager *manager = NULL; |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
283 | PurpleAccount *account = NULL; |
|
42128
118067ca0367
Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42127
diff
changeset
|
284 | PurpleRequestPage *page = NULL; |
|
42127
18acb99a0fa6
Convert PurpleRequestGroup into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42105
diff
changeset
|
285 | PurpleRequestGroup *group = NULL; |
|
42157
a4b3376be353
demo: Toggle sensitivity of fields in requests demo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42154
diff
changeset
|
286 | PurpleRequestField *boolfield = NULL; |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
287 | PurpleRequestField *field = NULL; |
|
42139
c053558f1236
Make PurpleRequestFieldChoice into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42135
diff
changeset
|
288 | PurpleRequestFieldChoice *choice_field = NULL; |
|
42140
beba61bbdf19
Convert PurpleRequestFieldList into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42139
diff
changeset
|
289 | PurpleRequestFieldList *list_field = NULL; |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
290 | GBytes *icon = NULL; |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
291 | gconstpointer icon_data = NULL; |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
292 | gsize icon_len = 0; |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
293 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
294 | if(!g_variant_is_of_type(parameter, G_VARIANT_TYPE_STRING)) { |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
295 | g_critical("Demo failure action parameter is of incorrect type %s", |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
296 | g_variant_get_type_string(parameter)); |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
297 | return; |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
298 | } |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
299 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
300 | account_id = g_variant_get_string(parameter, NULL); |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
301 | manager = purple_account_manager_get_default(); |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
302 | account = purple_account_manager_find_by_id(manager, account_id); |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
303 | connection = purple_account_get_connection(account); |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
304 | |
|
42128
118067ca0367
Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42127
diff
changeset
|
305 | page = purple_request_page_new(); |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
306 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
307 | /* This group will contain basic fields. */ |
|
42127
18acb99a0fa6
Convert PurpleRequestGroup into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42105
diff
changeset
|
308 | group = purple_request_group_new(_("Basic")); |
|
42128
118067ca0367
Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42127
diff
changeset
|
309 | purple_request_page_add_group(page, group); |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
310 | |
|
42157
a4b3376be353
demo: Toggle sensitivity of fields in requests demo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42154
diff
changeset
|
311 | boolfield = purple_request_field_bool_new("bool", _("Sensitive?"), TRUE); |
|
a4b3376be353
demo: Toggle sensitivity of fields in requests demo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42154
diff
changeset
|
312 | purple_request_field_set_tooltip(boolfield, |
|
a4b3376be353
demo: Toggle sensitivity of fields in requests demo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42154
diff
changeset
|
313 | _("Allow modifying all fields.")); |
|
a4b3376be353
demo: Toggle sensitivity of fields in requests demo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42154
diff
changeset
|
314 | purple_request_group_add_field(group, boolfield); |
|
a4b3376be353
demo: Toggle sensitivity of fields in requests demo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42154
diff
changeset
|
315 | |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
316 | field = purple_request_field_label_new("basic-label", |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
317 | _("This group contains basic fields")); |
|
42157
a4b3376be353
demo: Toggle sensitivity of fields in requests demo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42154
diff
changeset
|
318 | g_object_bind_property(boolfield, "value", field, "sensitive", 0); |
|
42127
18acb99a0fa6
Convert PurpleRequestGroup into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42105
diff
changeset
|
319 | purple_request_group_add_field(group, field); |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
320 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
321 | field = purple_request_field_string_new("string", _("A string"), |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
322 | _("default"), FALSE); |
|
42154
2557742988dc
Remove tracking of required fields
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42149
diff
changeset
|
323 | purple_request_field_set_required(field, TRUE); |
|
42157
a4b3376be353
demo: Toggle sensitivity of fields in requests demo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42154
diff
changeset
|
324 | g_object_bind_property(boolfield, "value", field, "sensitive", 0); |
|
42127
18acb99a0fa6
Convert PurpleRequestGroup into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42105
diff
changeset
|
325 | purple_request_group_add_field(group, field); |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
326 | field = purple_request_field_string_new("multiline-string", |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
327 | _("A multiline string"), |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
328 | _("default"), TRUE); |
|
42127
18acb99a0fa6
Convert PurpleRequestGroup into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42105
diff
changeset
|
329 | purple_request_group_add_field(group, field); |
|
42157
a4b3376be353
demo: Toggle sensitivity of fields in requests demo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42154
diff
changeset
|
330 | g_object_bind_property(boolfield, "value", field, "sensitive", 0); |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
331 | field = purple_request_field_string_new("masked-string", |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
332 | _("A masked string"), _("default"), |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
333 | FALSE); |
|
42135
1a89a067a0d5
Add a PurpleRequestFieldString subclass
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42128
diff
changeset
|
334 | purple_request_field_string_set_masked(PURPLE_REQUEST_FIELD_STRING(field), |
|
1a89a067a0d5
Add a PurpleRequestFieldString subclass
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42128
diff
changeset
|
335 | TRUE); |
|
42157
a4b3376be353
demo: Toggle sensitivity of fields in requests demo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42154
diff
changeset
|
336 | g_object_bind_property(boolfield, "value", field, "sensitive", 0); |
|
42127
18acb99a0fa6
Convert PurpleRequestGroup into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42105
diff
changeset
|
337 | purple_request_group_add_field(group, field); |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
338 | field = purple_request_field_string_new("alphanumeric", |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
339 | _("An alphanumeric string"), |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
340 | _("default"), FALSE); |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
341 | purple_request_field_set_validator(field, |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
342 | purple_request_field_alphanumeric_validator, |
|
42149
4de5a514b8ba
Add a PurpleRequestField:valid property and is_valid vfunc
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42140
diff
changeset
|
343 | NULL, NULL); |
|
42157
a4b3376be353
demo: Toggle sensitivity of fields in requests demo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42154
diff
changeset
|
344 | g_object_bind_property(boolfield, "value", field, "sensitive", 0); |
|
42127
18acb99a0fa6
Convert PurpleRequestGroup into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42105
diff
changeset
|
345 | purple_request_group_add_field(group, field); |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
346 | field = purple_request_field_string_new("email", _("An email"), |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
347 | _("me@example.com"), FALSE); |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
348 | purple_request_field_set_validator(field, |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
349 | purple_request_field_email_validator, |
|
42149
4de5a514b8ba
Add a PurpleRequestField:valid property and is_valid vfunc
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42140
diff
changeset
|
350 | NULL, NULL); |
|
42157
a4b3376be353
demo: Toggle sensitivity of fields in requests demo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42154
diff
changeset
|
351 | g_object_bind_property(boolfield, "value", field, "sensitive", 0); |
|
42127
18acb99a0fa6
Convert PurpleRequestGroup into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42105
diff
changeset
|
352 | purple_request_group_add_field(group, field); |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
353 | field = purple_request_field_int_new("int", _("An integer"), 123, -42, 1337); |
|
42157
a4b3376be353
demo: Toggle sensitivity of fields in requests demo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42154
diff
changeset
|
354 | g_object_bind_property(boolfield, "value", field, "sensitive", 0); |
|
42127
18acb99a0fa6
Convert PurpleRequestGroup into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42105
diff
changeset
|
355 | purple_request_group_add_field(group, field); |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
356 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
357 | /* This group will contain fields with multiple options. */ |
|
42127
18acb99a0fa6
Convert PurpleRequestGroup into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42105
diff
changeset
|
358 | group = purple_request_group_new(_("Multiple")); |
|
42128
118067ca0367
Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42127
diff
changeset
|
359 | purple_request_page_add_group(page, group); |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
360 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
361 | field = purple_request_field_label_new("multiple-label", |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
362 | _("This group contains fields with multiple options")); |
|
42157
a4b3376be353
demo: Toggle sensitivity of fields in requests demo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42154
diff
changeset
|
363 | g_object_bind_property(boolfield, "value", field, "sensitive", 0); |
|
42127
18acb99a0fa6
Convert PurpleRequestGroup into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42105
diff
changeset
|
364 | purple_request_group_add_field(group, field); |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
365 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
366 | field = purple_request_field_choice_new("choice", _("A choice"), "foo"); |
|
42139
c053558f1236
Make PurpleRequestFieldChoice into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42135
diff
changeset
|
367 | choice_field = PURPLE_REQUEST_FIELD_CHOICE(field); |
|
c053558f1236
Make PurpleRequestFieldChoice into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42135
diff
changeset
|
368 | purple_request_field_choice_add(choice_field, _("foo"), "foo"); |
|
c053558f1236
Make PurpleRequestFieldChoice into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42135
diff
changeset
|
369 | purple_request_field_choice_add(choice_field, _("bar"), "bar"); |
|
c053558f1236
Make PurpleRequestFieldChoice into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42135
diff
changeset
|
370 | purple_request_field_choice_add(choice_field, _("baz"), "baz"); |
|
c053558f1236
Make PurpleRequestFieldChoice into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42135
diff
changeset
|
371 | purple_request_field_choice_add(choice_field, _("quux"), "quux"); |
|
42157
a4b3376be353
demo: Toggle sensitivity of fields in requests demo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42154
diff
changeset
|
372 | g_object_bind_property(boolfield, "value", field, "sensitive", 0); |
|
42127
18acb99a0fa6
Convert PurpleRequestGroup into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42105
diff
changeset
|
373 | purple_request_group_add_field(group, field); |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
374 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
375 | field = purple_request_field_list_new("list", _("A list")); |
|
42140
beba61bbdf19
Convert PurpleRequestFieldList into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42139
diff
changeset
|
376 | list_field = PURPLE_REQUEST_FIELD_LIST(field); |
|
beba61bbdf19
Convert PurpleRequestFieldList into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42139
diff
changeset
|
377 | purple_request_field_list_add_icon(list_field, _("foo"), NULL, "foo"); |
|
beba61bbdf19
Convert PurpleRequestFieldList into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42139
diff
changeset
|
378 | purple_request_field_list_add_icon(list_field, _("bar"), NULL, "bar"); |
|
beba61bbdf19
Convert PurpleRequestFieldList into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42139
diff
changeset
|
379 | purple_request_field_list_add_icon(list_field, _("baz"), NULL, "baz"); |
|
beba61bbdf19
Convert PurpleRequestFieldList into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42139
diff
changeset
|
380 | purple_request_field_list_add_icon(list_field, _("quux"), NULL, "quux"); |
|
42157
a4b3376be353
demo: Toggle sensitivity of fields in requests demo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42154
diff
changeset
|
381 | g_object_bind_property(boolfield, "value", field, "sensitive", 0); |
|
42127
18acb99a0fa6
Convert PurpleRequestGroup into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42105
diff
changeset
|
382 | purple_request_group_add_field(group, field); |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
383 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
384 | field = purple_request_field_list_new("multilist", _("A multi-select list")); |
|
42140
beba61bbdf19
Convert PurpleRequestFieldList into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42139
diff
changeset
|
385 | list_field = PURPLE_REQUEST_FIELD_LIST(field); |
|
beba61bbdf19
Convert PurpleRequestFieldList into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42139
diff
changeset
|
386 | purple_request_field_list_set_multi_select(list_field, TRUE); |
|
beba61bbdf19
Convert PurpleRequestFieldList into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42139
diff
changeset
|
387 | purple_request_field_list_add_icon(list_field, _("foo"), NULL, "foo"); |
|
beba61bbdf19
Convert PurpleRequestFieldList into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42139
diff
changeset
|
388 | purple_request_field_list_add_icon(list_field, _("bar"), NULL, "bar"); |
|
beba61bbdf19
Convert PurpleRequestFieldList into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42139
diff
changeset
|
389 | purple_request_field_list_add_icon(list_field, _("baz"), NULL, "baz"); |
|
beba61bbdf19
Convert PurpleRequestFieldList into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42139
diff
changeset
|
390 | purple_request_field_list_add_icon(list_field, _("quux"), NULL, "quux"); |
|
42157
a4b3376be353
demo: Toggle sensitivity of fields in requests demo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42154
diff
changeset
|
391 | g_object_bind_property(boolfield, "value", field, "sensitive", 0); |
|
42127
18acb99a0fa6
Convert PurpleRequestGroup into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42105
diff
changeset
|
392 | purple_request_group_add_field(group, field); |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
393 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
394 | /* This group will contain specialized fields. */ |
|
42127
18acb99a0fa6
Convert PurpleRequestGroup into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42105
diff
changeset
|
395 | group = purple_request_group_new(_("Special")); |
|
42128
118067ca0367
Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42127
diff
changeset
|
396 | purple_request_page_add_group(page, group); |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
397 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
398 | field = purple_request_field_label_new("special-label", |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
399 | _("This group contains specialized fields")); |
|
42157
a4b3376be353
demo: Toggle sensitivity of fields in requests demo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42154
diff
changeset
|
400 | g_object_bind_property(boolfield, "value", field, "sensitive", 0); |
|
42127
18acb99a0fa6
Convert PurpleRequestGroup into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42105
diff
changeset
|
401 | purple_request_group_add_field(group, field); |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
402 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
403 | icon = g_resource_lookup_data(purple_demo_get_resource(), |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
404 | "/im/pidgin/purple/demo/icons/scalable/apps/im-purple-demo.svg", |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
405 | G_RESOURCE_LOOKUP_FLAGS_NONE, NULL); |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
406 | icon_data = g_bytes_get_data(icon, &icon_len); |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
407 | field = purple_request_field_image_new("image", _("An image"), |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
408 | icon_data, icon_len); |
|
42157
a4b3376be353
demo: Toggle sensitivity of fields in requests demo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42154
diff
changeset
|
409 | g_object_bind_property(boolfield, "value", field, "sensitive", 0); |
|
42127
18acb99a0fa6
Convert PurpleRequestGroup into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42105
diff
changeset
|
410 | purple_request_group_add_field(group, field); |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
411 | g_bytes_unref(icon); |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
412 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
413 | field = purple_request_field_account_new("account", _("An account"), |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
414 | account); |
|
42157
a4b3376be353
demo: Toggle sensitivity of fields in requests demo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42154
diff
changeset
|
415 | g_object_bind_property(boolfield, "value", field, "sensitive", 0); |
|
42127
18acb99a0fa6
Convert PurpleRequestGroup into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42105
diff
changeset
|
416 | purple_request_group_add_field(group, field); |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
417 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
418 | purple_request_fields(connection, _("Request Fields Demo"), |
|
42128
118067ca0367
Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42127
diff
changeset
|
419 | _("Please fill out these fields…"), NULL, page, |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
420 | _("OK"), |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
421 | G_CALLBACK(purple_demo_protocol_request_fields_ok_cb), |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
422 | _("Cancel"), |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
423 | G_CALLBACK(purple_demo_protocol_request_fields_cancel_cb), |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
424 | purple_request_cpar_from_connection(connection), |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
425 | NULL); |
|
42291
a86b7bcbb471
Make the purple_account_manager_find functions return transfer full.
Gary Kramlich <grim@reaperworld.com>
parents:
42204
diff
changeset
|
426 | |
|
a86b7bcbb471
Make the purple_account_manager_find functions return transfer full.
Gary Kramlich <grim@reaperworld.com>
parents:
42204
diff
changeset
|
427 | g_clear_object(&account); |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
428 | } |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
429 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
430 | /****************************************************************************** |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
431 | * Contact action implementations |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
432 | *****************************************************************************/ |
|
42914
27c407608b6b
Update Purple.AddContactRequest to use a PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
42881
diff
changeset
|
433 | static const char *contact_ids[] = {"alice", "bob", "carlos", "erin" }; |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
434 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
435 | static void |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
436 | purple_demo_protocol_remote_add(G_GNUC_UNUSED GSimpleAction *action, |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
437 | GVariant *parameter, |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
438 | G_GNUC_UNUSED gpointer data) |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
439 | { |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
440 | PurpleAccount *account = NULL; |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
441 | PurpleAccountManager *account_manager = NULL; |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
442 | PurpleAddContactRequest *request = NULL; |
|
42914
27c407608b6b
Update Purple.AddContactRequest to use a PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
42881
diff
changeset
|
443 | PurpleContact *contact = NULL; |
|
27c407608b6b
Update Purple.AddContactRequest to use a PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
42881
diff
changeset
|
444 | PurpleContactManager *contact_manager = NULL; |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
445 | PurpleNotification *notification = NULL; |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
446 | PurpleNotificationManager *notification_manager = NULL; |
|
42956
445c8ac8139f
Add some messages to the Demo contacts that are used for AddContactRequest notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42930
diff
changeset
|
447 | PurpleTags *tags = NULL; |
|
42914
27c407608b6b
Update Purple.AddContactRequest to use a PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
42881
diff
changeset
|
448 | const char *account_id = NULL; |
|
42956
445c8ac8139f
Add some messages to the Demo contacts that are used for AddContactRequest notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42930
diff
changeset
|
449 | const char *message = NULL; |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
450 | static guint counter = 0; |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
451 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
452 | account_id = g_variant_get_string(parameter, NULL); |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
453 | account_manager = purple_account_manager_get_default(); |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
454 | account = purple_account_manager_find_by_id(account_manager, account_id); |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
455 | |
|
42914
27c407608b6b
Update Purple.AddContactRequest to use a PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
42881
diff
changeset
|
456 | contact_manager = purple_contact_manager_get_default(); |
|
27c407608b6b
Update Purple.AddContactRequest to use a PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
42881
diff
changeset
|
457 | contact = purple_contact_manager_find_with_id(contact_manager, account, |
|
27c407608b6b
Update Purple.AddContactRequest to use a PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
42881
diff
changeset
|
458 | contact_ids[counter]); |
|
27c407608b6b
Update Purple.AddContactRequest to use a PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
42881
diff
changeset
|
459 | |
|
42956
445c8ac8139f
Add some messages to the Demo contacts that are used for AddContactRequest notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42930
diff
changeset
|
460 | tags = purple_contact_info_get_tags(PURPLE_CONTACT_INFO(contact)); |
|
445c8ac8139f
Add some messages to the Demo contacts that are used for AddContactRequest notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42930
diff
changeset
|
461 | message = purple_tags_get(tags, "add-contact-req-msg"); |
|
445c8ac8139f
Add some messages to the Demo contacts that are used for AddContactRequest notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42930
diff
changeset
|
462 | |
|
42914
27c407608b6b
Update Purple.AddContactRequest to use a PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
42881
diff
changeset
|
463 | request = purple_add_contact_request_new(contact); |
|
42956
445c8ac8139f
Add some messages to the Demo contacts that are used for AddContactRequest notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42930
diff
changeset
|
464 | if(!purple_strempty(message)) { |
|
445c8ac8139f
Add some messages to the Demo contacts that are used for AddContactRequest notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42930
diff
changeset
|
465 | purple_add_contact_request_set_message(request, message); |
|
445c8ac8139f
Add some messages to the Demo contacts that are used for AddContactRequest notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42930
diff
changeset
|
466 | } |
|
445c8ac8139f
Add some messages to the Demo contacts that are used for AddContactRequest notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42930
diff
changeset
|
467 | |
|
42930
2f883972e245
Update the Demo protocol plugin for the Purple.Notification deprecations
Gary Kramlich <grim@reaperworld.com>
parents:
42914
diff
changeset
|
468 | notification = purple_notification_add_contact_new(NULL, request); |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
469 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
470 | notification_manager = purple_notification_manager_get_default(); |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
471 | purple_notification_manager_add(notification_manager, notification); |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
472 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
473 | counter++; |
|
42914
27c407608b6b
Update Purple.AddContactRequest to use a PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
42881
diff
changeset
|
474 | if(counter >= G_N_ELEMENTS(contact_ids)) { |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
475 | counter = 0; |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
476 | } |
|
42291
a86b7bcbb471
Make the purple_account_manager_find functions return transfer full.
Gary Kramlich <grim@reaperworld.com>
parents:
42204
diff
changeset
|
477 | |
|
42638
81ef32d85e5a
Fix transfer annotation of purple_notification_manager_add
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42635
diff
changeset
|
478 | g_clear_object(¬ification); |
|
42291
a86b7bcbb471
Make the purple_account_manager_find functions return transfer full.
Gary Kramlich <grim@reaperworld.com>
parents:
42204
diff
changeset
|
479 | g_clear_object(&account); |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
480 | } |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
481 | |
|
42635
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
482 | static const char *puns[] = { |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
483 | "Toucan play at that game!", |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
484 | "As long as it's not too much of a birden...", |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
485 | "Sounds like a bit of ostrich...", |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
486 | "People can't stop raven!", |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
487 | "Have you heard about the bird?", |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
488 | }; |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
489 | |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
490 | static void |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
491 | purple_demo_protocol_generic_notification(G_GNUC_UNUSED GSimpleAction *action, |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
492 | GVariant *parameter, |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
493 | G_GNUC_UNUSED gpointer data) |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
494 | { |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
495 | PurpleAccount *account = NULL; |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
496 | PurpleAccountManager *account_manager = NULL; |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
497 | PurpleNotification *notification = NULL; |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
498 | PurpleNotificationManager *notification_manager = NULL; |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
499 | const char *account_id = NULL; |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
500 | static guint counter = 0; |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
501 | |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
502 | account_id = g_variant_get_string(parameter, NULL); |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
503 | account_manager = purple_account_manager_get_default(); |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
504 | account = purple_account_manager_find_by_id(account_manager, account_id); |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
505 | |
|
42988
c2357ee36551
Replace Purple.Notification.new_generic with Purple.Notification.new
Gary Kramlich <grim@reaperworld.com>
parents:
42959
diff
changeset
|
506 | notification = purple_notification_new(NULL, puns[counter]); |
|
42828
fbfb9dbdb87c
Make the demo notifications look a bit better
Gary Kramlich <grim@reaperworld.com>
parents:
42803
diff
changeset
|
507 | purple_notification_set_icon_name(notification, "im-purple-demo"); |
|
42635
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
508 | |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
509 | notification_manager = purple_notification_manager_get_default(); |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
510 | purple_notification_manager_add(notification_manager, notification); |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
511 | |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
512 | counter++; |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
513 | if(counter >= G_N_ELEMENTS(puns)) { |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
514 | counter = 0; |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
515 | } |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
516 | |
|
42638
81ef32d85e5a
Fix transfer annotation of purple_notification_manager_add
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42635
diff
changeset
|
517 | g_clear_object(¬ification); |
|
42635
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
518 | g_clear_object(&account); |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
519 | } |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
520 | |
|
42959
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
521 | static const char *auth_request_ids[] = {"chuck", "eve", "mallory", "michael"}; |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
522 | |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
523 | static void |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
524 | purple_demo_protocol_authorization_request(G_GNUC_UNUSED GSimpleAction *action, |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
525 | GVariant *parameter, |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
526 | G_GNUC_UNUSED gpointer data) |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
527 | { |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
528 | PurpleAccount *account = NULL; |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
529 | PurpleAccountManager *account_manager = NULL; |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
530 | PurpleAuthorizationRequest *request = NULL; |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
531 | PurpleContact *contact = NULL; |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
532 | PurpleContactManager *contact_manager = NULL; |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
533 | PurpleNotification *notification = NULL; |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
534 | PurpleNotificationManager *notification_manager = NULL; |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
535 | PurpleTags *tags = NULL; |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
536 | const char *account_id = NULL; |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
537 | const char *message = NULL; |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
538 | static guint counter = 0; |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
539 | |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
540 | account_id = g_variant_get_string(parameter, NULL); |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
541 | account_manager = purple_account_manager_get_default(); |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
542 | account = purple_account_manager_find_by_id(account_manager, account_id); |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
543 | |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
544 | contact_manager = purple_contact_manager_get_default(); |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
545 | contact = purple_contact_manager_find_with_id(contact_manager, account, |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
546 | auth_request_ids[counter]); |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
547 | |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
548 | tags = purple_contact_info_get_tags(PURPLE_CONTACT_INFO(contact)); |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
549 | message = purple_tags_get(tags, "auth-request-msg"); |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
550 | |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
551 | request = purple_authorization_request_new(contact); |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
552 | if(!purple_strempty(message)) { |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
553 | purple_authorization_request_set_message(request, message); |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
554 | } |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
555 | |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
556 | notification = purple_notification_authorization_request_new(NULL, |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
557 | request); |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
558 | notification_manager = purple_notification_manager_get_default(); |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
559 | purple_notification_manager_add(notification_manager, notification); |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
560 | |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
561 | counter++; |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
562 | if(counter >= G_N_ELEMENTS(auth_request_ids)) { |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
563 | counter = 0; |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
564 | } |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
565 | |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
566 | g_clear_object(¬ification); |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
567 | g_clear_object(&account); |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
568 | } |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
569 | |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
570 | /****************************************************************************** |
|
42881
f501f1a0ca6e
Remove the Purple.ProtocolActions implementation from the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42878
diff
changeset
|
571 | * Helpers |
|
41459
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
572 | *****************************************************************************/ |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
573 | static GActionGroup * |
|
42881
f501f1a0ca6e
Remove the Purple.ProtocolActions implementation from the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42878
diff
changeset
|
574 | purple_demo_protocol_get_action_group(void) { |
|
41459
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
575 | GSimpleActionGroup *group = NULL; |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
576 | GActionEntry entries[] = { |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
577 | { |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
578 | .name = "temporary-failure", |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
579 | .activate = purple_demo_protocol_temporary_failure_action_activate, |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
580 | .parameter_type = "s", |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
581 | }, { |
|
41459
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
582 | .name = "fatal-failure", |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
583 | .activate = purple_demo_protocol_fatal_failure_action_activate, |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
584 | .parameter_type = "s", |
|
41517
5bafe75d3907
Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
41463
diff
changeset
|
585 | }, { |
|
42635
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
586 | .name = "generic-notification", |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
587 | .activate = purple_demo_protocol_generic_notification, |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
588 | .parameter_type = "s", |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
589 | }, { |
|
41517
5bafe75d3907
Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
41463
diff
changeset
|
590 | .name = "remote-add", |
|
5bafe75d3907
Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
41463
diff
changeset
|
591 | .activate = purple_demo_protocol_remote_add, |
|
5bafe75d3907
Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
41463
diff
changeset
|
592 | .parameter_type = "s", |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
593 | }, { |
|
42959
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
594 | .name = "authorization-request", |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
595 | .activate = purple_demo_protocol_authorization_request, |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
596 | .parameter_type = "s", |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
597 | }, { |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
598 | .name = "request-fields", |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
599 | .activate = purple_demo_protocol_request_fields_activate, |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
600 | .parameter_type = "s", |
|
41517
5bafe75d3907
Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
41463
diff
changeset
|
601 | } |
|
41459
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
602 | }; |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
603 | gsize nentries = G_N_ELEMENTS(entries); |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
604 | |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
605 | group = g_simple_action_group_new(); |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
606 | g_action_map_add_action_entries(G_ACTION_MAP(group), entries, nentries, |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
607 | NULL); |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
608 | |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
609 | return G_ACTION_GROUP(group); |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
610 | } |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
611 | |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
612 | static GMenu * |
|
42881
f501f1a0ca6e
Remove the Purple.ProtocolActions implementation from the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42878
diff
changeset
|
613 | purple_demo_protocol_get_menu(void) { |
|
41459
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
614 | GMenu *menu = NULL; |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
615 | GMenuItem *item = NULL; |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
616 | |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
617 | menu = g_menu_new(); |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
618 | |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
619 | item = g_menu_item_new(_("Trigger temporary connection failure..."), |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
620 | "prpl-demo.temporary-failure"); |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
621 | g_menu_item_set_attribute(item, PURPLE_MENU_ATTRIBUTE_DYNAMIC_TARGET, "s", |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
622 | "account"); |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
623 | g_menu_append_item(menu, item); |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
624 | g_object_unref(item); |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
625 | |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
626 | item = g_menu_item_new(_("Trigger fatal connection failure..."), |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
627 | "prpl-demo.fatal-failure"); |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
628 | g_menu_item_set_attribute(item, PURPLE_MENU_ATTRIBUTE_DYNAMIC_TARGET, "s", |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
629 | "account"); |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
630 | g_menu_append_item(menu, item); |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
631 | g_object_unref(item); |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
632 | |
|
42635
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
633 | item = g_menu_item_new(_("Trigger a generic notification"), |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
634 | "prpl-demo.generic-notification"); |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
635 | g_menu_item_set_attribute(item, PURPLE_MENU_ATTRIBUTE_DYNAMIC_TARGET, "s", |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
636 | "account"); |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
637 | g_menu_append_item(menu, item); |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
638 | g_object_unref(item); |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
639 | |
|
41517
5bafe75d3907
Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
41463
diff
changeset
|
640 | item = g_menu_item_new(_("Trigger a contact adding you"), |
|
5bafe75d3907
Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
41463
diff
changeset
|
641 | "prpl-demo.remote-add"); |
|
5bafe75d3907
Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
41463
diff
changeset
|
642 | g_menu_item_set_attribute(item, PURPLE_MENU_ATTRIBUTE_DYNAMIC_TARGET, "s", |
|
5bafe75d3907
Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
41463
diff
changeset
|
643 | "account"); |
|
5bafe75d3907
Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
41463
diff
changeset
|
644 | g_menu_append_item(menu, item); |
|
5bafe75d3907
Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
41463
diff
changeset
|
645 | g_object_unref(item); |
|
5bafe75d3907
Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
41463
diff
changeset
|
646 | |
|
42959
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
647 | item = g_menu_item_new(_("Trigger a contact authorization request"), |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
648 | "prpl-demo.authorization-request"); |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
649 | g_menu_item_set_attribute(item, PURPLE_MENU_ATTRIBUTE_DYNAMIC_TARGET, "s", |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
650 | "account"); |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
651 | g_menu_append_item(menu, item); |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
652 | g_object_unref(item); |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
653 | |
|
42752
cc8312cb5017
Remove all request options except fields from the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42747
diff
changeset
|
654 | item = g_menu_item_new(_("Request Fields"), "prpl-demo.request-fields"); |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
655 | g_menu_item_set_attribute(item, PURPLE_MENU_ATTRIBUTE_DYNAMIC_TARGET, "s", |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
656 | "account"); |
|
42752
cc8312cb5017
Remove all request options except fields from the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42747
diff
changeset
|
657 | g_menu_append_item(menu, item); |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
658 | g_object_unref(item); |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
659 | |
|
41459
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
660 | return menu; |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
661 | } |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
662 | |
|
42881
f501f1a0ca6e
Remove the Purple.ProtocolActions implementation from the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42878
diff
changeset
|
663 | /****************************************************************************** |
|
f501f1a0ca6e
Remove the Purple.ProtocolActions implementation from the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42878
diff
changeset
|
664 | * Internal API |
|
f501f1a0ca6e
Remove the Purple.ProtocolActions implementation from the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42878
diff
changeset
|
665 | *****************************************************************************/ |
|
42878
5183064bcc28
Implement Purple.Protocol.get_action_menu in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42828
diff
changeset
|
666 | BirbActionMenu * |
|
5183064bcc28
Implement Purple.Protocol.get_action_menu in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42828
diff
changeset
|
667 | purple_demo_protocol_get_action_menu(G_GNUC_UNUSED PurpleProtocol *protocol, |
|
5183064bcc28
Implement Purple.Protocol.get_action_menu in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42828
diff
changeset
|
668 | G_GNUC_UNUSED PurpleAccount *account) |
|
5183064bcc28
Implement Purple.Protocol.get_action_menu in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42828
diff
changeset
|
669 | { |
|
5183064bcc28
Implement Purple.Protocol.get_action_menu in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42828
diff
changeset
|
670 | BirbActionMenu *action_menu = NULL; |
|
5183064bcc28
Implement Purple.Protocol.get_action_menu in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42828
diff
changeset
|
671 | GActionGroup *group = NULL; |
|
5183064bcc28
Implement Purple.Protocol.get_action_menu in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42828
diff
changeset
|
672 | GMenu *menu = NULL; |
|
5183064bcc28
Implement Purple.Protocol.get_action_menu in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42828
diff
changeset
|
673 | GMenu *section = NULL; |
|
5183064bcc28
Implement Purple.Protocol.get_action_menu in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42828
diff
changeset
|
674 | |
|
5183064bcc28
Implement Purple.Protocol.get_action_menu in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42828
diff
changeset
|
675 | action_menu = birb_action_menu_new(); |
|
5183064bcc28
Implement Purple.Protocol.get_action_menu in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42828
diff
changeset
|
676 | |
|
42881
f501f1a0ca6e
Remove the Purple.ProtocolActions implementation from the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42878
diff
changeset
|
677 | group = purple_demo_protocol_get_action_group(); |
|
42878
5183064bcc28
Implement Purple.Protocol.get_action_menu in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42828
diff
changeset
|
678 | birb_action_menu_add_action_group(action_menu, "prpl-demo", group); |
|
5183064bcc28
Implement Purple.Protocol.get_action_menu in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42828
diff
changeset
|
679 | g_clear_object(&group); |
|
5183064bcc28
Implement Purple.Protocol.get_action_menu in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42828
diff
changeset
|
680 | |
|
5183064bcc28
Implement Purple.Protocol.get_action_menu in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42828
diff
changeset
|
681 | menu = birb_action_menu_get_menu(action_menu); |
|
5183064bcc28
Implement Purple.Protocol.get_action_menu in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42828
diff
changeset
|
682 | |
|
42881
f501f1a0ca6e
Remove the Purple.ProtocolActions implementation from the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42878
diff
changeset
|
683 | section = purple_demo_protocol_get_menu(); |
|
42878
5183064bcc28
Implement Purple.Protocol.get_action_menu in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42828
diff
changeset
|
684 | g_menu_append_section(menu, NULL, G_MENU_MODEL(section)); |
|
5183064bcc28
Implement Purple.Protocol.get_action_menu in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42828
diff
changeset
|
685 | g_clear_object(§ion); |
|
5183064bcc28
Implement Purple.Protocol.get_action_menu in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42828
diff
changeset
|
686 | |
|
5183064bcc28
Implement Purple.Protocol.get_action_menu in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42828
diff
changeset
|
687 | return action_menu; |
|
5183064bcc28
Implement Purple.Protocol.get_action_menu in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42828
diff
changeset
|
688 | } |