Fri, 04 Oct 2024 01:08:05 -0500
Remove Purple.Connection.error and its friends
This change means you need to call Purple.Account.set_error followed by
Purple.Account.disconnect. This will probably be cleaned up a bit in the future
but for now this lets us clean up a lot of old API.
Testing Done:
Connected demo and irc accounts. Verified that disconnects worked via the demo actions. Call in the turtles.
Reviewed at https://reviews.imfreedom.org/r/3566/
|
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); |
|
42998
9fae31173eb3
Remove Purple.Connection.error and its friends
Gary Kramlich <grim@reaperworld.com>
parents:
42988
diff
changeset
|
45 | PurpleConnectionErrorInfo *error_info = NULL; |
|
41459
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
46 | PurpleAccount *account = purple_connection_get_account(connection); |
|
42914
27c407608b6b
Update Purple.AddContactRequest to use a PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
42881
diff
changeset
|
47 | char *message = NULL; |
|
27c407608b6b
Update Purple.AddContactRequest to use a PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
42881
diff
changeset
|
48 | int timeout = 0; |
|
41459
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
49 | |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
50 | 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
|
51 | "reaping-time")); |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
52 | timeout--; |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
53 | 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
|
54 | PurpleContact *contact = NULL; |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
55 | PurpleContactManager *manager = NULL; |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
56 | |
|
41459
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
57 | 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
|
58 | GINT_TO_POINTER(timeout)); |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
59 | |
|
42204
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
60 | 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
|
61 | 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
|
62 | REAPER_BUDDY_NAME); |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
63 | |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
64 | 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
|
65 | 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
|
66 | 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
|
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 | |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
77 | message = g_strdup_printf(_(disconnect_str), REAPER_BUDDY_NAME); |
|
42998
9fae31173eb3
Remove Purple.Connection.error and its friends
Gary Kramlich <grim@reaperworld.com>
parents:
42988
diff
changeset
|
78 | error_info = purple_connection_error_info_new(error_code, message); |
|
41459
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
79 | g_free(message); |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
80 | |
|
42998
9fae31173eb3
Remove Purple.Connection.error and its friends
Gary Kramlich <grim@reaperworld.com>
parents:
42988
diff
changeset
|
81 | purple_account_set_error(account, error_info); |
|
9fae31173eb3
Remove Purple.Connection.error and its friends
Gary Kramlich <grim@reaperworld.com>
parents:
42988
diff
changeset
|
82 | purple_account_disconnect(account); |
|
9fae31173eb3
Remove Purple.Connection.error and its friends
Gary Kramlich <grim@reaperworld.com>
parents:
42988
diff
changeset
|
83 | |
|
41459
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
84 | return G_SOURCE_REMOVE; |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
85 | } |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
86 | |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
87 | static gboolean |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
88 | 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
|
89 | return purple_demo_protocol_failure_tick(data, |
|
41463
6b13615303cc
Add some custom connection errors
Gary Kramlich <grim@reaperworld.com>
parents:
41460
diff
changeset
|
90 | 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
|
91 | FATAL_TICK_STR, |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
92 | FATAL_TICK_PLURAL_STR, |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
93 | FATAL_DISCONNECT_STR); |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
94 | } |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
95 | |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
96 | static gboolean |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
97 | 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
|
98 | return purple_demo_protocol_failure_tick(data, |
|
41463
6b13615303cc
Add some custom connection errors
Gary Kramlich <grim@reaperworld.com>
parents:
41460
diff
changeset
|
99 | 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
|
100 | TEMPORARY_TICK_STR, |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
101 | TEMPORARY_TICK_PLURAL_STR, |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
102 | TEMPORARY_DISCONNECT_STR); |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
103 | } |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
104 | |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
105 | 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
|
106 | 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
|
107 | GVariant *parameter, |
|
42914
27c407608b6b
Update Purple.AddContactRequest to use a PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
42881
diff
changeset
|
108 | const char *tick_str, |
|
27c407608b6b
Update Purple.AddContactRequest to use a PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
42881
diff
changeset
|
109 | 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
|
110 | GSourceFunc cb) |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
111 | { |
|
42204
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
112 | 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
|
113 | PurpleAccount *account = NULL; |
|
41459
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
114 | 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
|
115 | PurpleContact *contact = NULL; |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
116 | 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
|
117 | 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
|
118 | |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
119 | 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
|
120 | 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
|
121 | 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
|
122 | return; |
|
41459
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
123 | } |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
124 | |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
125 | 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
|
126 | 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
|
127 | 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
|
128 | 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
|
129 | |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
130 | /* 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
|
131 | 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
|
132 | g_clear_object(&account); |
|
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 | return; |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
135 | } |
|
42291
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 | 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
|
138 | g_clear_object(&account); |
|
a86b7bcbb471
Make the purple_account_manager_find functions return transfer full.
Gary Kramlich <grim@reaperworld.com>
parents:
42204
diff
changeset
|
139 | |
|
41459
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
140 | return; |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
141 | } |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
142 | |
|
42204
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
143 | /* Find the reaper. */ |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
144 | 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
|
145 | 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
|
146 | account, |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
147 | REAPER_BUDDY_NAME); |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
148 | |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
149 | 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
|
150 | 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
|
151 | 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
|
152 | 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
|
153 | char *message = NULL; |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
154 | |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
155 | 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
|
156 | 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
|
157 | |
|
42747
801025bad2e1
Make PurplePresence final and other clean ups
Gary Kramlich <grim@reaperworld.com>
parents:
42652
diff
changeset
|
158 | 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
|
159 | 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
|
160 | g_free(message); |
|
56b8487d9020
Port the demo protocol's actions to the new status api
Gary Kramlich <grim@reaperworld.com>
parents:
42157
diff
changeset
|
161 | } |
|
41459
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
162 | |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
163 | 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
|
164 | 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
|
165 | 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
|
166 | |
|
a86b7bcbb471
Make the purple_account_manager_find functions return transfer full.
Gary Kramlich <grim@reaperworld.com>
parents:
42204
diff
changeset
|
167 | g_clear_object(&account); |
|
41459
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
168 | } |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
169 | |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
170 | static void |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
171 | 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
|
172 | GVariant *parameter, |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
173 | G_GNUC_UNUSED gpointer data) |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
174 | { |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
175 | 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
|
176 | TEMPORARY_TICK_STR, |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
177 | TEMPORARY_TICK_PLURAL_STR, |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
178 | 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
|
179 | } |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
180 | |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
181 | static void |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
182 | 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
|
183 | GVariant *parameter, |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
184 | G_GNUC_UNUSED gpointer data) |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
185 | { |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
186 | 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
|
187 | FATAL_TICK_STR, |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
188 | FATAL_TICK_PLURAL_STR, |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
189 | 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
|
190 | } |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
191 | |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
192 | /****************************************************************************** |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
193 | * 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
|
194 | *****************************************************************************/ |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
195 | static void |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
196 | 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
|
197 | PurpleRequestPage *page) |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
198 | { |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
199 | PurpleAccount *account = NULL; |
|
42140
beba61bbdf19
Convert PurpleRequestFieldList into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42139
diff
changeset
|
200 | 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
|
201 | GList *list = NULL; |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
202 | 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
|
203 | GString *info = NULL; |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
204 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
205 | 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
|
206 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
207 | 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
|
208 | 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
|
209 | 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
|
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 | "multiline-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, _("\tMasked 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 | "masked-string")); |
|
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, _("\tAlphanumeric 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, |
|
118067ca0367
Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42127
diff
changeset
|
217 | "alphanumeric")); |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
218 | 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
|
219 | 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
|
220 | 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
|
221 | 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
|
222 | 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
|
223 | 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
|
224 | _("TRUE") : _("FALSE")); |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
225 | |
|
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(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
|
227 | |
|
42128
118067ca0367
Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42127
diff
changeset
|
228 | 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
|
229 | 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
|
230 | |
|
42140
beba61bbdf19
Convert PurpleRequestFieldList into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42139
diff
changeset
|
231 | 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
|
232 | "list")); |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
233 | 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
|
234 | if(list != NULL) { |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
235 | 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
|
236 | } else { |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
237 | tmp = _("(unset)"); |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
238 | } |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
239 | 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
|
240 | |
|
42140
beba61bbdf19
Convert PurpleRequestFieldList into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42139
diff
changeset
|
241 | 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
|
242 | "multilist")); |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
243 | 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
|
244 | 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
|
245 | while(list != NULL) { |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
246 | 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
|
247 | 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
|
248 | list->next != NULL ? ", " : ""); |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
249 | list = list->next; |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
250 | } |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
251 | 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
|
252 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
253 | 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
|
254 | |
|
42128
118067ca0367
Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42127
diff
changeset
|
255 | 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
|
256 | 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
|
257 | 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
|
258 | |
|
984f8dfabb47
Update the protocols to use get id and username directly on PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents:
42752
diff
changeset
|
259 | 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
|
260 | 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
|
261 | } else { |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
262 | tmp = _("(unset)"); |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
263 | } |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
264 | 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
|
265 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
266 | 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
|
267 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
268 | 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
|
269 | } |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
270 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
271 | static void |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
272 | 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
|
273 | 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
|
274 | { |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
275 | 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
|
276 | } |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
277 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
278 | static void |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
279 | 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
|
280 | GVariant *parameter, |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
281 | 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
|
282 | { |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
283 | PurpleConnection *connection = NULL; |
|
42914
27c407608b6b
Update Purple.AddContactRequest to use a PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
42881
diff
changeset
|
284 | 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
|
285 | PurpleAccountManager *manager = NULL; |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
286 | PurpleAccount *account = NULL; |
|
42128
118067ca0367
Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42127
diff
changeset
|
287 | PurpleRequestPage *page = NULL; |
|
42127
18acb99a0fa6
Convert PurpleRequestGroup into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42105
diff
changeset
|
288 | 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
|
289 | 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
|
290 | PurpleRequestField *field = NULL; |
|
42139
c053558f1236
Make PurpleRequestFieldChoice into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42135
diff
changeset
|
291 | PurpleRequestFieldChoice *choice_field = NULL; |
|
42140
beba61bbdf19
Convert PurpleRequestFieldList into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42139
diff
changeset
|
292 | 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
|
293 | GBytes *icon = NULL; |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
294 | 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
|
295 | 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
|
296 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
297 | 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
|
298 | 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
|
299 | 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
|
300 | return; |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
301 | } |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
302 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
303 | 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
|
304 | 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
|
305 | 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
|
306 | 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
|
307 | |
|
42128
118067ca0367
Convert PurpleRequestPage into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42127
diff
changeset
|
308 | 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
|
309 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
310 | /* 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
|
311 | 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
|
312 | 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
|
313 | |
|
42157
a4b3376be353
demo: Toggle sensitivity of fields in requests demo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42154
diff
changeset
|
314 | 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
|
315 | 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
|
316 | _("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
|
317 | 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
|
318 | |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
319 | 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
|
320 | _("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
|
321 | 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
|
322 | 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
|
323 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
324 | 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
|
325 | _("default"), FALSE); |
|
42154
2557742988dc
Remove tracking of required fields
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42149
diff
changeset
|
326 | 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
|
327 | 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
|
328 | 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
|
329 | 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
|
330 | _("A multiline string"), |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
331 | _("default"), TRUE); |
|
42127
18acb99a0fa6
Convert PurpleRequestGroup into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42105
diff
changeset
|
332 | 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
|
333 | 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
|
334 | 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
|
335 | _("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
|
336 | FALSE); |
|
42135
1a89a067a0d5
Add a PurpleRequestFieldString subclass
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42128
diff
changeset
|
337 | 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
|
338 | TRUE); |
|
42157
a4b3376be353
demo: Toggle sensitivity of fields in requests demo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42154
diff
changeset
|
339 | 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
|
340 | 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
|
341 | 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
|
342 | _("An alphanumeric string"), |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
343 | _("default"), FALSE); |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
344 | 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
|
345 | 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
|
346 | NULL, NULL); |
|
42157
a4b3376be353
demo: Toggle sensitivity of fields in requests demo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42154
diff
changeset
|
347 | 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
|
348 | 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
|
349 | 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
|
350 | _("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
|
351 | 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
|
352 | 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
|
353 | NULL, NULL); |
|
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 | 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
|
357 | 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
|
358 | 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
|
359 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
360 | /* 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
|
361 | 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
|
362 | 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
|
363 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
364 | 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
|
365 | _("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
|
366 | 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
|
367 | 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
|
368 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
369 | 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
|
370 | 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
|
371 | 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
|
372 | 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
|
373 | 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
|
374 | 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
|
375 | 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
|
376 | 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
|
377 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
378 | 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
|
379 | 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
|
380 | 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
|
381 | 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
|
382 | 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
|
383 | 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
|
384 | 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
|
385 | 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
|
386 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
387 | 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
|
388 | 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
|
389 | 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
|
390 | 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
|
391 | 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
|
392 | 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
|
393 | 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
|
394 | 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
|
395 | 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
|
396 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
397 | /* 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
|
398 | 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
|
399 | 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
|
400 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
401 | 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
|
402 | _("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
|
403 | 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
|
404 | 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
|
405 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
406 | 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
|
407 | "/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
|
408 | 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
|
409 | 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
|
410 | 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
|
411 | 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
|
412 | 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
|
413 | 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
|
414 | 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
|
415 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
416 | 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
|
417 | account); |
|
42157
a4b3376be353
demo: Toggle sensitivity of fields in requests demo
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42154
diff
changeset
|
418 | 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
|
419 | 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
|
420 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
421 | 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
|
422 | _("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
|
423 | _("OK"), |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
424 | 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
|
425 | _("Cancel"), |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
426 | 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
|
427 | 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
|
428 | NULL); |
|
42291
a86b7bcbb471
Make the purple_account_manager_find functions return transfer full.
Gary Kramlich <grim@reaperworld.com>
parents:
42204
diff
changeset
|
429 | |
|
a86b7bcbb471
Make the purple_account_manager_find functions return transfer full.
Gary Kramlich <grim@reaperworld.com>
parents:
42204
diff
changeset
|
430 | 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
|
431 | } |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
432 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
433 | /****************************************************************************** |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
434 | * Contact action implementations |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
435 | *****************************************************************************/ |
|
42914
27c407608b6b
Update Purple.AddContactRequest to use a PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
42881
diff
changeset
|
436 | 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
|
437 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
438 | static void |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
439 | 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
|
440 | GVariant *parameter, |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
441 | 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
|
442 | { |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
443 | PurpleAccount *account = NULL; |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
444 | 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
|
445 | PurpleAddContactRequest *request = NULL; |
|
42914
27c407608b6b
Update Purple.AddContactRequest to use a PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
42881
diff
changeset
|
446 | PurpleContact *contact = NULL; |
|
27c407608b6b
Update Purple.AddContactRequest to use a PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
42881
diff
changeset
|
447 | 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
|
448 | PurpleNotification *notification = NULL; |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
449 | 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
|
450 | PurpleTags *tags = NULL; |
|
42914
27c407608b6b
Update Purple.AddContactRequest to use a PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
42881
diff
changeset
|
451 | 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
|
452 | 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
|
453 | 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
|
454 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
455 | 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
|
456 | 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
|
457 | 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
|
458 | |
|
42914
27c407608b6b
Update Purple.AddContactRequest to use a PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
42881
diff
changeset
|
459 | contact_manager = purple_contact_manager_get_default(); |
|
27c407608b6b
Update Purple.AddContactRequest to use a PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
42881
diff
changeset
|
460 | 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
|
461 | contact_ids[counter]); |
|
27c407608b6b
Update Purple.AddContactRequest to use a PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
42881
diff
changeset
|
462 | |
|
42956
445c8ac8139f
Add some messages to the Demo contacts that are used for AddContactRequest notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42930
diff
changeset
|
463 | 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
|
464 | 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
|
465 | |
|
42914
27c407608b6b
Update Purple.AddContactRequest to use a PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
42881
diff
changeset
|
466 | 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
|
467 | 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
|
468 | 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
|
469 | } |
|
445c8ac8139f
Add some messages to the Demo contacts that are used for AddContactRequest notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42930
diff
changeset
|
470 | |
|
42930
2f883972e245
Update the Demo protocol plugin for the Purple.Notification deprecations
Gary Kramlich <grim@reaperworld.com>
parents:
42914
diff
changeset
|
471 | 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
|
472 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
473 | 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
|
474 | 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
|
475 | |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
476 | counter++; |
|
42914
27c407608b6b
Update Purple.AddContactRequest to use a PurpleContact
Gary Kramlich <grim@reaperworld.com>
parents:
42881
diff
changeset
|
477 | 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
|
478 | counter = 0; |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
479 | } |
|
42291
a86b7bcbb471
Make the purple_account_manager_find functions return transfer full.
Gary Kramlich <grim@reaperworld.com>
parents:
42204
diff
changeset
|
480 | |
|
42638
81ef32d85e5a
Fix transfer annotation of purple_notification_manager_add
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42635
diff
changeset
|
481 | 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
|
482 | 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
|
483 | } |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
484 | |
|
42635
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
485 | 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
|
486 | "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
|
487 | "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
|
488 | "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
|
489 | "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
|
490 | "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
|
491 | }; |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
492 | |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
493 | static void |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
494 | 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
|
495 | GVariant *parameter, |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
496 | 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
|
497 | { |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
498 | 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
|
499 | 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
|
500 | 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
|
501 | 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
|
502 | 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
|
503 | 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
|
504 | |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
505 | 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
|
506 | 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
|
507 | 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
|
508 | |
|
42988
c2357ee36551
Replace Purple.Notification.new_generic with Purple.Notification.new
Gary Kramlich <grim@reaperworld.com>
parents:
42959
diff
changeset
|
509 | 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
|
510 | 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
|
511 | |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
512 | 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
|
513 | 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
|
514 | |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
515 | counter++; |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
516 | 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
|
517 | counter = 0; |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
518 | } |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
519 | |
|
42638
81ef32d85e5a
Fix transfer annotation of purple_notification_manager_add
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42635
diff
changeset
|
520 | 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
|
521 | 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
|
522 | } |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
523 | |
|
42959
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
524 | 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
|
525 | |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
526 | 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
|
527 | 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
|
528 | 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
|
529 | 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
|
530 | { |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
531 | 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
|
532 | 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
|
533 | 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
|
534 | 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
|
535 | 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
|
536 | 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
|
537 | 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
|
538 | 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
|
539 | 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
|
540 | 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
|
541 | 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
|
542 | |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
543 | 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
|
544 | 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
|
545 | 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
|
546 | |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
547 | 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
|
548 | 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
|
549 | 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
|
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 | 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
|
552 | 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
|
553 | |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
554 | 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
|
555 | 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
|
556 | 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
|
557 | } |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
558 | |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
559 | 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
|
560 | request); |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
561 | 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
|
562 | 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
|
563 | |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
564 | counter++; |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
565 | 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
|
566 | 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
|
567 | } |
|
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 | 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
|
570 | 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
|
571 | } |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
572 | |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
573 | /****************************************************************************** |
|
42881
f501f1a0ca6e
Remove the Purple.ProtocolActions implementation from the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42878
diff
changeset
|
574 | * Helpers |
|
41459
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
575 | *****************************************************************************/ |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
576 | static GActionGroup * |
|
42881
f501f1a0ca6e
Remove the Purple.ProtocolActions implementation from the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42878
diff
changeset
|
577 | 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
|
578 | GSimpleActionGroup *group = NULL; |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
579 | GActionEntry entries[] = { |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
580 | { |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
581 | .name = "temporary-failure", |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
582 | .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
|
583 | .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
|
584 | }, { |
|
41459
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
585 | .name = "fatal-failure", |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
586 | .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
|
587 | .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
|
588 | }, { |
|
42635
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
589 | .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
|
590 | .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
|
591 | .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
|
592 | }, { |
|
41517
5bafe75d3907
Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
41463
diff
changeset
|
593 | .name = "remote-add", |
|
5bafe75d3907
Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
41463
diff
changeset
|
594 | .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
|
595 | .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
|
596 | }, { |
|
42959
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
597 | .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
|
598 | .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
|
599 | .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
|
600 | }, { |
|
42101
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
601 | .name = "request-fields", |
|
f22bea74160d
Add demo of requests API to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42004
diff
changeset
|
602 | .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
|
603 | .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
|
604 | } |
|
41459
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
605 | }; |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
606 | 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
|
607 | |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
608 | 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
|
609 | 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
|
610 | NULL); |
|
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 | return G_ACTION_GROUP(group); |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
613 | } |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
614 | |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
615 | static GMenu * |
|
42881
f501f1a0ca6e
Remove the Purple.ProtocolActions implementation from the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42878
diff
changeset
|
616 | 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
|
617 | GMenu *menu = NULL; |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
618 | GMenuItem *item = NULL; |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
619 | |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
620 | menu = g_menu_new(); |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
621 | |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
622 | 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
|
623 | "prpl-demo.temporary-failure"); |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
624 | 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
|
625 | "account"); |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
626 | 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
|
627 | g_object_unref(item); |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
628 | |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
629 | 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
|
630 | "prpl-demo.fatal-failure"); |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
631 | 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
|
632 | "account"); |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
633 | 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
|
634 | g_object_unref(item); |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
635 | |
|
42635
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
636 | 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
|
637 | "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
|
638 | 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
|
639 | "account"); |
|
8bc965216427
Add a protocol action to the demo protocol to add generic notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
640 | 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
|
641 | 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
|
642 | |
|
41517
5bafe75d3907
Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
41463
diff
changeset
|
643 | 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
|
644 | "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
|
645 | 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
|
646 | "account"); |
|
5bafe75d3907
Replace the request_add Account UiOp with a new AddContact notification
Gary Kramlich <grim@reaperworld.com>
parents:
41463
diff
changeset
|
647 | 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
|
648 | 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
|
649 | |
|
42959
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
650 | 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
|
651 | "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
|
652 | 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
|
653 | "account"); |
|
f1b48841d33e
Add an account action to the Demo protocol plugin to create authorization requests
Gary Kramlich <grim@reaperworld.com>
parents:
42956
diff
changeset
|
654 | 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
|
655 | 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
|
656 | |
|
42752
cc8312cb5017
Remove all request options except fields from the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42747
diff
changeset
|
657 | 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
|
658 | 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
|
659 | "account"); |
|
42752
cc8312cb5017
Remove all request options except fields from the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42747
diff
changeset
|
660 | 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
|
661 | 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
|
662 | |
|
41459
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
663 | return menu; |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
664 | } |
|
53a9d24d5be2
Add some protocol actions to demo protocol
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff
changeset
|
665 | |
|
42881
f501f1a0ca6e
Remove the Purple.ProtocolActions implementation from the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42878
diff
changeset
|
666 | /****************************************************************************** |
|
f501f1a0ca6e
Remove the Purple.ProtocolActions implementation from the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42878
diff
changeset
|
667 | * Internal API |
|
f501f1a0ca6e
Remove the Purple.ProtocolActions implementation from the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42878
diff
changeset
|
668 | *****************************************************************************/ |
|
42878
5183064bcc28
Implement Purple.Protocol.get_action_menu in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42828
diff
changeset
|
669 | BirbActionMenu * |
|
5183064bcc28
Implement Purple.Protocol.get_action_menu in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42828
diff
changeset
|
670 | 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
|
671 | 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
|
672 | { |
|
5183064bcc28
Implement Purple.Protocol.get_action_menu in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42828
diff
changeset
|
673 | 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
|
674 | GActionGroup *group = NULL; |
|
5183064bcc28
Implement Purple.Protocol.get_action_menu in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42828
diff
changeset
|
675 | GMenu *menu = NULL; |
|
5183064bcc28
Implement Purple.Protocol.get_action_menu in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42828
diff
changeset
|
676 | GMenu *section = NULL; |
|
5183064bcc28
Implement Purple.Protocol.get_action_menu in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42828
diff
changeset
|
677 | |
|
5183064bcc28
Implement Purple.Protocol.get_action_menu in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42828
diff
changeset
|
678 | 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
|
679 | |
|
42881
f501f1a0ca6e
Remove the Purple.ProtocolActions implementation from the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42878
diff
changeset
|
680 | 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
|
681 | 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
|
682 | 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
|
683 | |
|
5183064bcc28
Implement Purple.Protocol.get_action_menu in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42828
diff
changeset
|
684 | 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
|
685 | |
|
42881
f501f1a0ca6e
Remove the Purple.ProtocolActions implementation from the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42878
diff
changeset
|
686 | 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
|
687 | 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
|
688 | 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
|
689 | |
|
5183064bcc28
Implement Purple.Protocol.get_action_menu in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42828
diff
changeset
|
690 | return action_menu; |
|
5183064bcc28
Implement Purple.Protocol.get_action_menu in the Demo protocol plugin
Gary Kramlich <grim@reaperworld.com>
parents:
42828
diff
changeset
|
691 | } |