libpurple/purpleauthorizationrequest.c

Tue, 19 Mar 2024 00:53:11 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Tue, 19 Mar 2024 00:53:11 -0500
changeset 42646
b82b5609c044
parent 42613
780d7efe37c2
child 42767
8cf1d11b59c1
permissions
-rw-r--r--

Use PurpleProtocol.can_connect_async in the login process

Also implement it for all the new protocol plugins.

Testing Done:
Attempted connections for the new bonjour, ircv3, and new xmpp accounts and verified them made it past the checks.
Attempted and ircv3 account with a bad DNS name and verified it failed in the `can_reach_async` functions.
Also ran with the turtles.

Reviewed at https://reviews.imfreedom.org/r/3005/

41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /*
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 * Purple - Internet Messaging Library
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 *
42594
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
5 * Purple is the legal property of its developers, whose names are too numerous
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
6 * to list here. Please refer to the COPYRIGHT file distributed with this
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
7 * source distribution.
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 *
42594
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
9 * This library is free software; you can redistribute it and/or modify it
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
10 * under the terms of the GNU General Public License as published by the Free
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
11 * Software Foundation; either version 2 of the License, or (at your option)
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
12 * any later version.
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 *
42594
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
14 * This library is distributed in the hope that it will be useful, but WITHOUT
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
17 * more details.
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
18 *
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
19 * You should have received a copy of the GNU General Public License along with
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42584
diff changeset
20 * this library; if not, see <https://www.gnu.org/licenses/>.
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21 */
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23 #include "purpleauthorizationrequest.h"
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
25 struct _PurpleAuthorizationRequest {
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26 GObject parent;
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28 PurpleAccount *account;
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30 gchar *username;
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
31 gchar *alias;
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32 gchar *message;
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
33 gboolean add;
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35 /* This tracks whether _accept or _deny have been called. */
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36 gboolean handled;
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37 };
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39 enum {
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40 SIG_ACCEPTED,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41 SIG_DENIED,
42584
687260353985 Make signal and property enums and initializers consistent
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42576
diff changeset
42 N_SIGNALS,
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43 };
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44 static guint signals[N_SIGNALS] = {0, };
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46 enum {
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
47 PROP_0,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48 PROP_ACCOUNT,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49 PROP_USERNAME,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
50 PROP_ALIAS,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
51 PROP_MESSAGE,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52 PROP_ADD,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 N_PROPERTIES,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
54 };
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55 static GParamSpec *properties[N_PROPERTIES] = {NULL, };
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56
42576
ab1ca778ddb2 Make sure all of the final types in libpurple are defined as such
Gary Kramlich <grim@reaperworld.com>
parents: 41960
diff changeset
57 G_DEFINE_FINAL_TYPE(PurpleAuthorizationRequest, purple_authorization_request,
ab1ca778ddb2 Make sure all of the final types in libpurple are defined as such
Gary Kramlich <grim@reaperworld.com>
parents: 41960
diff changeset
58 G_TYPE_OBJECT)
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60 /******************************************************************************
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
61 * Helpers
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
62 *****************************************************************************/
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63 static void
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
64 purple_authorization_request_set_account(PurpleAuthorizationRequest *request,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
65 PurpleAccount *account)
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
66 {
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
67 g_return_if_fail(PURPLE_IS_AUTHORIZATION_REQUEST(request));
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
68 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
69
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
70 if(g_set_object(&request->account, account)) {
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
71 g_object_notify_by_pspec(G_OBJECT(request), properties[PROP_ACCOUNT]);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
72 }
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
73 }
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
74
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
75 static void
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
76 purple_authorization_request_set_username(PurpleAuthorizationRequest *request,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
77 const gchar *username)
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
78 {
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
79 g_return_if_fail(PURPLE_IS_AUTHORIZATION_REQUEST(request));
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
80
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
81 g_free(request->username);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
82 request->username = g_strdup(username);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
83
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
84 g_object_notify_by_pspec(G_OBJECT(request), properties[PROP_USERNAME]);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
85 }
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
86
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
87 /******************************************************************************
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
88 * GObject Implementation
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
89 *****************************************************************************/
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
90 static void
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
91 purple_authorization_request_get_property(GObject *obj, guint param_id,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
92 GValue *value, GParamSpec *pspec)
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
93 {
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
94 PurpleAuthorizationRequest *request = PURPLE_AUTHORIZATION_REQUEST(obj);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
95
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
96 switch(param_id) {
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
97 case PROP_ACCOUNT:
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
98 g_value_set_object(value,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
99 purple_authorization_request_get_account(request));
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
100 break;
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
101 case PROP_USERNAME:
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
102 g_value_set_string(value,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
103 purple_authorization_request_get_username(request));
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
104 break;
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
105 case PROP_ALIAS:
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
106 g_value_set_string(value,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
107 purple_authorization_request_get_alias(request));
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
108 break;
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
109 case PROP_MESSAGE:
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
110 g_value_set_string(value,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
111 purple_authorization_request_get_message(request));
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
112 break;
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
113 case PROP_ADD:
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
114 g_value_set_boolean(value,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
115 purple_authorization_request_get_add(request));
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
116 break;
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
117 default:
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
118 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
119 break;
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
120 }
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
121 }
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
122
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
123 static void
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
124 purple_authorization_request_set_property(GObject *obj, guint param_id,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
125 const GValue *value,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
126 GParamSpec *pspec)
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
127 {
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
128 PurpleAuthorizationRequest *request = PURPLE_AUTHORIZATION_REQUEST(obj);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
129
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
130 switch(param_id) {
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
131 case PROP_ACCOUNT:
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
132 purple_authorization_request_set_account(request,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
133 g_value_get_object(value));
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
134 break;
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
135 case PROP_USERNAME:
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
136 purple_authorization_request_set_username(request,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
137 g_value_get_string(value));
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
138 break;
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
139 case PROP_ALIAS:
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
140 purple_authorization_request_set_alias(request,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
141 g_value_get_string(value));
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
142 break;
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
143 case PROP_MESSAGE:
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
144 purple_authorization_request_set_message(request,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
145 g_value_get_string(value));
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
146 break;
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
147 case PROP_ADD:
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
148 purple_authorization_request_set_add(request,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
149 g_value_get_boolean(value));
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
150 break;
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
151 default:
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
152 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
153 break;
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
154 }
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
155 }
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
156
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
157 static void
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
158 purple_authorization_request_dispose(GObject *obj) {
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
159 PurpleAuthorizationRequest *request = PURPLE_AUTHORIZATION_REQUEST(obj);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
160
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
161 g_clear_object(&request->account);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
162
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
163 G_OBJECT_CLASS(purple_authorization_request_parent_class)->dispose(obj);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
164 }
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
165
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
166 static void
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
167 purple_authorization_request_finalize(GObject *obj) {
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
168 PurpleAuthorizationRequest *request = PURPLE_AUTHORIZATION_REQUEST(obj);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
169
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
170 g_clear_pointer(&request->username, g_free);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
171 g_clear_pointer(&request->alias, g_free);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
172 g_clear_pointer(&request->message, g_free);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
173
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
174 G_OBJECT_CLASS(purple_authorization_request_parent_class)->finalize(obj);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
175 }
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
176
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
177 static void
41960
c8a4853205e3 Bump C standard to C99 for libpurple files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41646
diff changeset
178 purple_authorization_request_init(G_GNUC_UNUSED PurpleAuthorizationRequest *request)
c8a4853205e3 Bump C standard to C99 for libpurple files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41646
diff changeset
179 {
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
180 }
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
181
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
182 static void
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
183 purple_authorization_request_class_init(PurpleAuthorizationRequestClass *klass)
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
184 {
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
185 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
186
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
187 obj_class->get_property = purple_authorization_request_get_property;
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
188 obj_class->set_property = purple_authorization_request_set_property;
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
189 obj_class->dispose = purple_authorization_request_dispose;
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
190 obj_class->finalize = purple_authorization_request_finalize;
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
191
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
192 /**
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
193 * PurpleAuthorizationRequest::accepted:
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
194 * @request: The [class@AuthorizationRequest] instance.
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
195 *
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
196 * Emitted when the user has accepted @request. This is typically emitted
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
197 * by the user interface calling [method@AuthorizationRequest.accept].
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
198 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
199 * Since: 3.0
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
200 */
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
201 signals[SIG_ACCEPTED] = g_signal_new_class_handler(
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
202 "accepted",
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
203 G_OBJECT_CLASS_TYPE(klass),
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
204 G_SIGNAL_RUN_LAST,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
205 NULL,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
206 NULL,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
207 NULL,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
208 NULL,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
209 G_TYPE_NONE,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
210 0);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
211
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
212 /**
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
213 * PurpleAuthorizationRequest::denied:
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
214 * @request: The [class@AuthorizationRequest] instance.
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
215 * @message: (nullable): An optional denial message.
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
216 *
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
217 * Emitted when the user has denied @request. This is typically emitted
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
218 * by the user interface calling [method@AuthorizationRequest.deny].
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
219 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
220 * Since: 3.0
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
221 */
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
222 signals[SIG_DENIED] = g_signal_new_class_handler(
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
223 "denied",
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
224 G_OBJECT_CLASS_TYPE(klass),
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
225 G_SIGNAL_RUN_LAST,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
226 NULL,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
227 NULL,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
228 NULL,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
229 NULL,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
230 G_TYPE_NONE,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
231 1,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
232 G_TYPE_STRING);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
233
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
234 /**
41646
df5560078186 Improve request documentation
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41514
diff changeset
235 * PurpleAuthorizationRequest:account:
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
236 *
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
237 * The account that this authorization request is for.
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
238 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
239 * Since: 3.0
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
240 */
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
241 properties[PROP_ACCOUNT] = g_param_spec_object(
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
242 "account", "account",
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
243 "The account for this authorization request",
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
244 PURPLE_TYPE_ACCOUNT,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
245 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
246
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
247 /**
41646
df5560078186 Improve request documentation
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41514
diff changeset
248 * PurpleAuthorizationRequest:username:
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
249 *
41646
df5560078186 Improve request documentation
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41514
diff changeset
250 * The username of the remote user that is requesting authorization.
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
251 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
252 * Since: 3.0
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
253 */
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
254 properties[PROP_USERNAME] = g_param_spec_string(
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
255 "username", "username",
41646
df5560078186 Improve request documentation
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41514
diff changeset
256 "The username of the remote user that is requesting authorization",
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
257 NULL,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
258 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
259
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
260 /**
41646
df5560078186 Improve request documentation
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41514
diff changeset
261 * PurpleAuthorizationRequest:alias:
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
262 *
41646
df5560078186 Improve request documentation
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41514
diff changeset
263 * The alias of the remote user that is requesting authorization.
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
264 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
265 * Since: 3.0
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
266 */
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
267 properties[PROP_ALIAS] = g_param_spec_string(
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
268 "alias", "alias",
41646
df5560078186 Improve request documentation
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41514
diff changeset
269 "The alias of the remote user that is requesting authorization",
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
270 NULL,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
271 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
272
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
273 /**
41646
df5560078186 Improve request documentation
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41514
diff changeset
274 * PurpleAuthorizationRequest:message:
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
275 *
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
276 * The optional message sent from the remote user.
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
277 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
278 * Since: 3.0
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
279 */
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
280 properties[PROP_MESSAGE] = g_param_spec_string(
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
281 "message", "message",
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
282 "The optional message sent by the remote user",
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
283 NULL,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
284 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
285
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
286 /**
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
287 * PurpleAuthorizationRequest:add:
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
288 *
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
289 * Whether or not the user interface should ask the end user to add the
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
290 * remote user after accepting the end user's friend request.
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
291 *
42613
780d7efe37c2 Remove the micro version from since tags for libpurple part 2
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
292 * Since: 3.0
41514
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
293 */
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
294 properties[PROP_ADD] = g_param_spec_boolean(
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
295 "add", "add",
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
296 "Whether or not to add the remote user back",
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
297 FALSE,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
298 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
299
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
300 g_object_class_install_properties(obj_class, N_PROPERTIES, properties);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
301 }
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
302
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
303 /******************************************************************************
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
304 * Public API
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
305 *****************************************************************************/
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
306 PurpleAuthorizationRequest *
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
307 purple_authorization_request_new(PurpleAccount *account, const gchar *username)
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
308 {
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
309 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
310 g_return_val_if_fail(username != NULL, NULL);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
311
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
312 return g_object_new(
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
313 PURPLE_TYPE_AUTHORIZATION_REQUEST,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
314 "account", account,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
315 "username", username,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
316 NULL);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
317 }
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
318
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
319 PurpleAccount *
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
320 purple_authorization_request_get_account(PurpleAuthorizationRequest *request) {
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
321 g_return_val_if_fail(PURPLE_IS_AUTHORIZATION_REQUEST(request), NULL);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
322
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
323 return request->account;
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
324 }
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
325
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
326 const gchar *
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
327 purple_authorization_request_get_username(PurpleAuthorizationRequest *request)
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
328 {
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
329 g_return_val_if_fail(PURPLE_IS_AUTHORIZATION_REQUEST(request), NULL);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
330
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
331 return request->username;
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
332 }
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
333
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
334 void
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
335 purple_authorization_request_set_alias(PurpleAuthorizationRequest *request,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
336 const gchar *alias)
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
337 {
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
338 g_return_if_fail(PURPLE_IS_AUTHORIZATION_REQUEST(request));
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
339
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
340 g_free(request->alias);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
341 request->alias = g_strdup(alias);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
342
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
343 g_object_notify_by_pspec(G_OBJECT(request), properties[PROP_ALIAS]);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
344 }
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
345
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
346 const gchar *
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
347 purple_authorization_request_get_alias(PurpleAuthorizationRequest *request) {
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
348 g_return_val_if_fail(PURPLE_IS_AUTHORIZATION_REQUEST(request), NULL);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
349
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
350 return request->alias;
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
351 }
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
352
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
353 void
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
354 purple_authorization_request_set_message(PurpleAuthorizationRequest *request,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
355 const gchar *message)
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
356 {
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
357 g_return_if_fail(PURPLE_IS_AUTHORIZATION_REQUEST(request));
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
358
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
359 g_free(request->message);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
360 request->message = g_strdup(message);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
361
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
362 g_object_notify_by_pspec(G_OBJECT(request), properties[PROP_MESSAGE]);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
363 }
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
364
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
365 const gchar *
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
366 purple_authorization_request_get_message(PurpleAuthorizationRequest *request) {
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
367 g_return_val_if_fail(PURPLE_IS_AUTHORIZATION_REQUEST(request), NULL);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
368
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
369 return request->message;
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
370 }
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
371
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
372 void
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
373 purple_authorization_request_set_add(PurpleAuthorizationRequest *request,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
374 gboolean add)
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
375 {
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
376 g_return_if_fail(PURPLE_IS_AUTHORIZATION_REQUEST(request));
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
377
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
378 request->add = add;
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
379
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
380 g_object_notify_by_pspec(G_OBJECT(request), properties[PROP_ADD]);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
381 }
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
382
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
383 gboolean
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
384 purple_authorization_request_get_add(PurpleAuthorizationRequest *request) {
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
385 g_return_val_if_fail(PURPLE_IS_AUTHORIZATION_REQUEST(request), FALSE);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
386
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
387 return request->add;
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
388 }
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
389
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
390 void
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
391 purple_authorization_request_accept(PurpleAuthorizationRequest *request) {
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
392 g_return_if_fail(PURPLE_IS_AUTHORIZATION_REQUEST(request));
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
393
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
394 /* Calling this multiple times is a programming error. */
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
395 g_return_if_fail(request->handled == FALSE);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
396
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
397 request->handled = TRUE;
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
398
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
399 g_signal_emit(request, signals[SIG_ACCEPTED], 0);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
400 }
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
401
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
402 void
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
403 purple_authorization_request_deny(PurpleAuthorizationRequest *request,
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
404 const gchar *message)
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
405 {
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
406 g_return_if_fail(PURPLE_IS_AUTHORIZATION_REQUEST(request));
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
407
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
408 /* Calling this multiple times is a programming error. */
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
409 g_return_if_fail(request->handled == FALSE);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
410
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
411 request->handled = TRUE;
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
412
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
413 g_signal_emit(request, signals[SIG_DENIED], 0, message);
a96768bacb59 Create PurpleAuthorizationRequest and use it for notifications.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
414 }

mercurial