Thu, 11 Apr 2024 21:32:59 -0500
Remove PurpleConnectionUiOps as they are no longer used
Testing Done:
Checked in with the turtles.
Reviewed at https://reviews.imfreedom.org/r/3090/
|
42529
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
2 | * Purple - Internet Messaging Library |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * This program is free software; you can redistribute it and/or modify |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * the Free Software Foundation; either version 2 of the License, or |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * (at your option) any later version. |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * GNU General Public License for more details. |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * along with this program; if not, see <https://www.gnu.org/licenses/>. |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | */ |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | #include <glib/gi18n-lib.h> |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
20 | |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | #include "purplexmppprotocol.h" |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 | |
|
42546
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
23 | #include "purplexmppconnection.h" |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
24 | #include "purplexmppconstants.h" |
|
42646
b82b5609c044
Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents:
42579
diff
changeset
|
25 | #include "purplexmppcore.h" |
|
42546
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
26 | |
|
42529
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
27 | struct _PurpleXmppProtocol { |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
28 | PurpleProtocol parent; |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
29 | }; |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
30 | |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
31 | /****************************************************************************** |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
32 | * PurpleProtocol Implementation |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
33 | *****************************************************************************/ |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 | static GList * |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | purple_xmpp_protocol_get_user_splits(G_GNUC_UNUSED PurpleProtocol *protocol) { |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 | PurpleAccountUserSplit *split = NULL; |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 | GList *splits = NULL; |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
38 | |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
39 | split = purple_account_user_split_new(_("Server"), NULL, '@'); |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
40 | splits = g_list_append(splits, split); |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
42 | return splits; |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
43 | } |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
44 | |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
45 | static GList * |
|
42546
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
46 | purple_xmpp_protocol_get_account_options(G_GNUC_UNUSED PurpleProtocol *protocol) |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
47 | { |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
48 | PurpleAccountOption *option = NULL; |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
49 | PurpleKeyValuePair *pair = NULL; |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
50 | GList *options = NULL; |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
51 | GList *items = NULL; |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
52 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
53 | option = purple_account_option_string_new(_("Resource"), |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
54 | PURPLE_XMPP_OPTION_RESOURCE, |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
55 | NULL); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
56 | options = g_list_append(options, option); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
57 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
58 | option = purple_account_option_string_new(_("Server"), |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
59 | PURPLE_XMPP_OPTION_SERVER, NULL); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
60 | options = g_list_append(options, option); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
61 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
62 | option = purple_account_option_int_new(_("Port"), PURPLE_XMPP_OPTION_PORT, |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
63 | PURPLE_XMPP_DEFAULT_PORT_TLS); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
64 | options = g_list_append(options, option); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
65 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
66 | pair = purple_key_value_pair_new(_("Direct TLS"), PURPLE_XMPP_TLS_DIRECT); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
67 | items = g_list_append(items, pair); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
68 | pair = purple_key_value_pair_new(_("STARTTLS"), PURPLE_XMPP_TLS_STARTTLS); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
69 | items = g_list_append(items, pair); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
70 | pair = purple_key_value_pair_new(_("None"), PURPLE_XMPP_TLS_NONE); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
71 | items = g_list_append(items, pair); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
72 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
73 | option = purple_account_option_list_new(_("TLS Mode"), |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
74 | PURPLE_XMPP_OPTION_TLS_MODE, |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
75 | items); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
76 | options = g_list_append(options, option); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
77 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
78 | option = purple_account_option_string_new(_("SASL login name"), |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
79 | PURPLE_XMPP_OPTION_SASL_LOGIN_NAME, |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
80 | NULL); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
81 | options = g_list_append(options, option); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
82 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
83 | option = purple_account_option_string_new(_("SASL mechanisms"), |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
84 | PURPLE_XMPP_OPTION_SASL_MECHANISMS, |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
85 | NULL); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
86 | options = g_list_append(options, option); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
87 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
88 | option = purple_account_option_bool_new(_("Allow plaintext SASL auth over " |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
89 | "unencrypted connection"), |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
90 | PURPLE_XMPP_OPTION_PLAIN_SASL_IN_CLEAR, |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
91 | FALSE); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
92 | options = g_list_append(options, option); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
93 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
94 | return options; |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
95 | } |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
96 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
97 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
98 | static GList * |
|
42529
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
99 | purple_xmpp_protocol_status_types(G_GNUC_UNUSED PurpleProtocol *protocol, |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
100 | G_GNUC_UNUSED PurpleAccount *account) |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
101 | { |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
102 | PurpleStatusType *type = NULL; |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
103 | GList *types = NULL; |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
104 | |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
105 | type = purple_status_type_new(PURPLE_STATUS_AVAILABLE, NULL, NULL, TRUE); |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
106 | types = g_list_append(types, type); |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
107 | |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
108 | type = purple_status_type_new(PURPLE_STATUS_OFFLINE, NULL, NULL, TRUE); |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
109 | types = g_list_append(types, type); |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
110 | |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
111 | return types; |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
112 | } |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
113 | |
|
42646
b82b5609c044
Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents:
42579
diff
changeset
|
114 | static void |
|
b82b5609c044
Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents:
42579
diff
changeset
|
115 | purple_xmpp_protocol_can_connect_async(PurpleProtocol *protocol, |
|
b82b5609c044
Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents:
42579
diff
changeset
|
116 | G_GNUC_UNUSED PurpleAccount *account, |
|
b82b5609c044
Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents:
42579
diff
changeset
|
117 | GCancellable *cancellable, |
|
b82b5609c044
Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents:
42579
diff
changeset
|
118 | GAsyncReadyCallback callback, |
|
b82b5609c044
Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents:
42579
diff
changeset
|
119 | gpointer data) |
|
b82b5609c044
Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents:
42579
diff
changeset
|
120 | { |
|
b82b5609c044
Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents:
42579
diff
changeset
|
121 | GTask *task = NULL; |
|
b82b5609c044
Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents:
42579
diff
changeset
|
122 | GNetworkMonitor *monitor = NULL; |
|
b82b5609c044
Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents:
42579
diff
changeset
|
123 | GNetworkConnectivity connectivity = 0; |
|
b82b5609c044
Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents:
42579
diff
changeset
|
124 | |
|
b82b5609c044
Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents:
42579
diff
changeset
|
125 | task = g_task_new(protocol, cancellable, callback, data); |
|
b82b5609c044
Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents:
42579
diff
changeset
|
126 | |
|
b82b5609c044
Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents:
42579
diff
changeset
|
127 | /* Since we could be connecting to localhost, we only need to verify that |
|
b82b5609c044
Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents:
42579
diff
changeset
|
128 | * our connectivity is at least G_NETWORK_CONNECTIVITY_LOCAL. |
|
b82b5609c044
Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents:
42579
diff
changeset
|
129 | */ |
|
b82b5609c044
Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents:
42579
diff
changeset
|
130 | monitor = g_network_monitor_get_default(); |
|
b82b5609c044
Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents:
42579
diff
changeset
|
131 | connectivity = g_network_monitor_get_connectivity(monitor); |
|
b82b5609c044
Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents:
42579
diff
changeset
|
132 | |
|
b82b5609c044
Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents:
42579
diff
changeset
|
133 | if(connectivity >= G_NETWORK_CONNECTIVITY_LOCAL) { |
|
b82b5609c044
Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents:
42579
diff
changeset
|
134 | g_task_return_boolean(task, TRUE); |
|
b82b5609c044
Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents:
42579
diff
changeset
|
135 | } else { |
|
b82b5609c044
Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents:
42579
diff
changeset
|
136 | g_task_return_new_error(task, PURPLE_XMPP_DOMAIN, 0, |
|
b82b5609c044
Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents:
42579
diff
changeset
|
137 | _("Network connection not detected.")); |
|
b82b5609c044
Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents:
42579
diff
changeset
|
138 | } |
|
b82b5609c044
Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents:
42579
diff
changeset
|
139 | |
|
b82b5609c044
Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents:
42579
diff
changeset
|
140 | g_clear_object(&task); |
|
b82b5609c044
Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents:
42579
diff
changeset
|
141 | } |
|
b82b5609c044
Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents:
42579
diff
changeset
|
142 | |
|
b82b5609c044
Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents:
42579
diff
changeset
|
143 | static gboolean |
|
b82b5609c044
Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents:
42579
diff
changeset
|
144 | purple_xmpp_protocol_can_connect_finish(G_GNUC_UNUSED PurpleProtocol *protocol, |
|
b82b5609c044
Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents:
42579
diff
changeset
|
145 | GAsyncResult *result, |
|
b82b5609c044
Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents:
42579
diff
changeset
|
146 | GError **error) |
|
b82b5609c044
Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents:
42579
diff
changeset
|
147 | { |
|
b82b5609c044
Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents:
42579
diff
changeset
|
148 | return g_task_propagate_boolean(G_TASK(result), error); |
|
b82b5609c044
Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents:
42579
diff
changeset
|
149 | } |
|
b82b5609c044
Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents:
42579
diff
changeset
|
150 | |
|
42546
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
151 | static PurpleConnection * |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
152 | purple_xmpp_protocol_create_connection(PurpleProtocol *protocol, |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
153 | PurpleAccount *account, |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
154 | const char *password, |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
155 | G_GNUC_UNUSED GError **error) |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
156 | { |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
157 | return g_object_new( |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
158 | PURPLE_XMPP_TYPE_CONNECTION, |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
159 | "protocol", protocol, |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
160 | "account", account, |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
161 | "password", password, |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
162 | NULL); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
163 | } |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
164 | |
|
42529
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
165 | /****************************************************************************** |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
166 | * GObject Implementation |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
167 | *****************************************************************************/ |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
168 | G_DEFINE_DYNAMIC_TYPE_EXTENDED( |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
169 | PurpleXmppProtocol, |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
170 | purple_xmpp_protocol, |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
171 | PURPLE_TYPE_PROTOCOL, |
|
42579
f1ce6abbf4d1
Define all final types as such for protocols
Gary Kramlich <grim@reaperworld.com>
parents:
42546
diff
changeset
|
172 | G_TYPE_FLAG_FINAL, |
|
f1ce6abbf4d1
Define all final types as such for protocols
Gary Kramlich <grim@reaperworld.com>
parents:
42546
diff
changeset
|
173 | {}) |
|
42529
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
174 | |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
175 | static void |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
176 | purple_xmpp_protocol_init(G_GNUC_UNUSED PurpleXmppProtocol *protocol) { |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
177 | } |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
178 | |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
179 | static void |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
180 | purple_xmpp_protocol_class_finalize(G_GNUC_UNUSED PurpleXmppProtocolClass *klass) { |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
181 | } |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
182 | |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
183 | static void |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
184 | purple_xmpp_protocol_class_init(PurpleXmppProtocolClass *klass) { |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
185 | PurpleProtocolClass *protocol_class = PURPLE_PROTOCOL_CLASS(klass); |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
186 | |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
187 | protocol_class->get_user_splits = purple_xmpp_protocol_get_user_splits; |
|
42546
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
188 | protocol_class->get_account_options = purple_xmpp_protocol_get_account_options; |
|
42529
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
189 | protocol_class->status_types = purple_xmpp_protocol_status_types; |
|
42646
b82b5609c044
Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents:
42579
diff
changeset
|
190 | protocol_class->can_connect_async = purple_xmpp_protocol_can_connect_async; |
|
b82b5609c044
Use PurpleProtocol.can_connect_async in the login process
Gary Kramlich <grim@reaperworld.com>
parents:
42579
diff
changeset
|
191 | protocol_class->can_connect_finish = purple_xmpp_protocol_can_connect_finish; |
|
42546
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
42529
diff
changeset
|
192 | protocol_class->create_connection = purple_xmpp_protocol_create_connection; |
|
42529
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
193 | } |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
194 | |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
195 | /****************************************************************************** |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
196 | * Internal API |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
197 | *****************************************************************************/ |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
198 | void |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
199 | purple_xmpp_protocol_register(GPluginNativePlugin *plugin) { |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
200 | purple_xmpp_protocol_register_type(G_TYPE_MODULE(plugin)); |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
201 | } |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
202 | |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
203 | PurpleProtocol * |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
204 | purple_xmpp_protocol_new(void) { |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
205 | return g_object_new( |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
206 | PURPLE_XMPP_TYPE_PROTOCOL, |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
207 | "id", "prpl-xmpp", |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
208 | "name", "XMPP", |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
209 | "description", _("Modern Extensible Messaging and Presence Protocol."), |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
210 | "icon-name", "im-xmpp", |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
211 | "icon-resource-path", "/im/pidgin/libpurple/protocols/xmpp/icons", |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
212 | "options", OPT_PROTO_PASSWORD_OPTIONAL, |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
213 | NULL); |
|
f00a798a38a6
Stub out our new modern XMPP implementation
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
214 | } |