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