Sun, 03 Nov 2024 00:05:44 -0500
remove purple3-url-handler.desktop.in.in
The application that did the launching was removed long ago. Also this should
be implemented by the user interfaces and they might provide separate files to
groups schemas as well.
Testing Done:
Called in the turtles.
Reviewed at https://reviews.imfreedom.org/r/3640/
|
42546
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
2 | * Purple - Internet Messaging Library |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * This program is free software; you can redistribute it and/or modify |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * the Free Software Foundation; either version 2 of the License, or |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * (at your option) any later version. |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * GNU General Public License for more details. |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * along with this program; if not, see <https://www.gnu.org/licenses/>. |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | */ |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | #include <glib/gi18n-lib.h> |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
20 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | #include <xeme.h> |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
23 | #include "purplexmppconnection.h" |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
24 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
25 | #include "purplexmppconstants.h" |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
26 | #include "purplexmppcore.h" |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
27 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
28 | struct _PurpleXmppConnection { |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
29 | PurpleConnection parent; |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
30 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
31 | XemeConnection *xeme_connection; |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
32 | XemeOutputStream *output; |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
33 | }; |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 | |
|
42579
f1ce6abbf4d1
Define all final types as such for protocols
Gary Kramlich <grim@reaperworld.com>
parents:
42546
diff
changeset
|
35 | G_DEFINE_DYNAMIC_TYPE_EXTENDED(PurpleXmppConnection, purple_xmpp_connection, |
|
f1ce6abbf4d1
Define all final types as such for protocols
Gary Kramlich <grim@reaperworld.com>
parents:
42546
diff
changeset
|
36 | PURPLE_TYPE_CONNECTION, G_TYPE_FLAG_FINAL, {}) |
|
42546
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
38 | /****************************************************************************** |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
39 | * Callbacks |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
40 | *****************************************************************************/ |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | static void |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
42 | purple_xmpp_connection_connect_cb(GObject *source, GAsyncResult *result, |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
43 | gpointer data) |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
44 | { |
|
43042
8135b5752cec
Update the protocols to the new connection state api
Gary Kramlich <grim@reaperworld.com>
parents:
43006
diff
changeset
|
45 | PurpleXmppConnection *xmpp_connection = data; |
|
8135b5752cec
Update the protocols to the new connection state api
Gary Kramlich <grim@reaperworld.com>
parents:
43006
diff
changeset
|
46 | PurpleAccount *account = NULL; |
|
8135b5752cec
Update the protocols to the new connection state api
Gary Kramlich <grim@reaperworld.com>
parents:
43006
diff
changeset
|
47 | PurpleConnection *connection = data; |
|
42546
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
48 | XemeOutputStream *output = NULL; |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
49 | GError *error = NULL; |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
50 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
51 | output = xeme_connection_connect_finish(XEME_CONNECTION(source), result, |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
52 | &error); |
|
43042
8135b5752cec
Update the protocols to the new connection state api
Gary Kramlich <grim@reaperworld.com>
parents:
43006
diff
changeset
|
53 | |
|
8135b5752cec
Update the protocols to the new connection state api
Gary Kramlich <grim@reaperworld.com>
parents:
43006
diff
changeset
|
54 | account = purple_connection_get_account(connection); |
|
42546
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
55 | if(error != NULL) { |
|
43006
b9cbf5cb2003
Update the protocols now that Purple.Account:error is a GLib.Error
Gary Kramlich <grim@reaperworld.com>
parents:
43002
diff
changeset
|
56 | purple_account_disconnect_with_error(account, error); |
|
42546
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
57 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
58 | return; |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
59 | } |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
60 | |
|
43042
8135b5752cec
Update the protocols to the new connection state api
Gary Kramlich <grim@reaperworld.com>
parents:
43006
diff
changeset
|
61 | xmpp_connection->output = output; |
|
42546
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
62 | |
|
43042
8135b5752cec
Update the protocols to the new connection state api
Gary Kramlich <grim@reaperworld.com>
parents:
43006
diff
changeset
|
63 | purple_account_connected(account); |
|
42546
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
64 | } |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
65 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
66 | /****************************************************************************** |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
67 | * PurpleConnection Implementation |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
68 | *****************************************************************************/ |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
69 | static gboolean |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
70 | purple_xmpp_connection_connect(PurpleConnection *purple_connection, |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
71 | GError **error) |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
72 | { |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
73 | PurpleXmppConnection *connection = NULL; |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
74 | PurpleAccount *account = NULL; |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
75 | XemeInputStream *input = NULL; |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
76 | XemeTlsMode xeme_tls_mode = XEME_TLS_MODE_DIRECT_TLS; |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
77 | GCancellable *cancellable = NULL; |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
78 | GError *local_error = NULL; |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
79 | GProxyResolver *resolver = NULL; |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
80 | const char *resource = NULL; |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
81 | const char *server = NULL; |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
82 | const char *tls_mode = NULL; |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
83 | const char *username = NULL; |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
84 | guint16 port = PURPLE_XMPP_DEFAULT_PORT_TLS; |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
85 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
86 | g_return_val_if_fail(PURPLE_XMPP_IS_CONNECTION(purple_connection), FALSE); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
87 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
88 | connection = PURPLE_XMPP_CONNECTION(purple_connection); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
89 | cancellable = purple_connection_get_cancellable(purple_connection); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
90 | account = purple_connection_get_account(purple_connection); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
91 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
92 | /* Figure out what proxy resolver to use. */ |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
93 | resolver = purple_proxy_get_proxy_resolver(account, &local_error); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
94 | if(!G_IS_PROXY_RESOLVER(resolver) || local_error != NULL) { |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
95 | if(local_error == NULL) { |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
96 | local_error = g_error_new(PURPLE_XMPP_DOMAIN, 0, "unknown error"); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
97 | } |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
98 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
99 | g_propagate_error(error, local_error); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
100 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
101 | g_clear_object(&resolver); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
102 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
103 | return FALSE; |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
104 | } |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
105 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
106 | /* Grab some more information that we need. */ |
|
42803
984f8dfabb47
Update the protocols to use get id and username directly on PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents:
42794
diff
changeset
|
107 | username = purple_account_get_username(account); |
|
42546
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
108 | connection->xeme_connection = xeme_connection_new(username); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
109 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
110 | /* If we have a resource, tell the xeme connection about it. */ |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
111 | resource = purple_account_get_string(account, PURPLE_XMPP_OPTION_RESOURCE, |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
112 | NULL); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
113 | if(!purple_strempty(resource)) { |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
114 | xeme_connection_set_resource(connection->xeme_connection, resource); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
115 | } |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
116 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
117 | /* If we have a server, tell the xeme connection about it. */ |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
118 | server = purple_account_get_string(account, PURPLE_XMPP_OPTION_SERVER, |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
119 | NULL); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
120 | if(!purple_strempty(server)) { |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
121 | xeme_connection_set_server(connection->xeme_connection, server); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
122 | } |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
123 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
124 | /* Set whatever port we have on our xeme connection. */ |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
125 | port = purple_account_get_int(account, PURPLE_XMPP_OPTION_PORT, |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
126 | PURPLE_XMPP_DEFAULT_PORT_TLS); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
127 | xeme_connection_set_port(connection->xeme_connection, port); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
128 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
129 | /* Figure out what if any TLS we're doing. This is initialized to direct |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
130 | * tls above, so if we don't know which to use, that's what we'll end up |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
131 | * using. Doing so should avoid possible accidental leaks. |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
132 | */ |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
133 | tls_mode = purple_account_get_string(account, PURPLE_XMPP_OPTION_TLS_MODE, |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
134 | PURPLE_XMPP_TLS_DIRECT); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
135 | if(purple_strequal(tls_mode, PURPLE_XMPP_TLS_DIRECT)) { |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
136 | xeme_tls_mode = XEME_TLS_MODE_DIRECT_TLS; |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
137 | } else if(purple_strequal(tls_mode, PURPLE_XMPP_TLS_STARTTLS)) { |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
138 | xeme_tls_mode = XEME_TLS_MODE_START_TLS; |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
139 | } else if(purple_strequal(tls_mode, PURPLE_XMPP_TLS_NONE)) { |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
140 | xeme_tls_mode = XEME_TLS_MODE_NONE; |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
141 | } |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
142 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
143 | xeme_connection_set_tls_mode(connection->xeme_connection, xeme_tls_mode); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
144 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
145 | input = xeme_input_stream_new(); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
146 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
147 | /* Finally start connecting!! */ |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
148 | xeme_connection_connect_async(connection->xeme_connection, input, resolver, |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
149 | cancellable, purple_xmpp_connection_connect_cb, |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
150 | connection); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
151 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
152 | g_clear_object(&input); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
153 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
154 | return TRUE; |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
155 | } |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
156 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
157 | static gboolean |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
158 | purple_xmpp_connection_disconnect(PurpleConnection *purple_connection, |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
159 | GError **error) |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
160 | { |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
161 | PurpleXmppConnection *connection = NULL; |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
162 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
163 | g_return_val_if_fail(PURPLE_XMPP_IS_CONNECTION(purple_connection), FALSE); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
164 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
165 | connection = PURPLE_XMPP_CONNECTION(purple_connection); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
166 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
167 | return xeme_connection_close(connection->xeme_connection, error); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
168 | } |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
169 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
170 | /****************************************************************************** |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
171 | * GObject Implementation |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
172 | *****************************************************************************/ |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
173 | static void |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
174 | purple_xmpp_connection_dispose(GObject *obj) { |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
175 | PurpleXmppConnection *connection = PURPLE_XMPP_CONNECTION(obj); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
176 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
177 | g_clear_object(&connection->xeme_connection); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
178 | g_clear_object(&connection->output); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
179 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
180 | G_OBJECT_CLASS(purple_xmpp_connection_parent_class)->dispose(obj); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
181 | } |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
182 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
183 | static void |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
184 | purple_xmpp_connection_init(G_GNUC_UNUSED PurpleXmppConnection *connection) { |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
185 | } |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
186 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
187 | static void |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
188 | purple_xmpp_connection_class_init(PurpleXmppConnectionClass *klass) { |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
189 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
190 | PurpleConnectionClass *connection_class = PURPLE_CONNECTION_CLASS(klass); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
191 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
192 | obj_class->dispose = purple_xmpp_connection_dispose; |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
193 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
194 | connection_class->connect = purple_xmpp_connection_connect; |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
195 | connection_class->disconnect = purple_xmpp_connection_disconnect; |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
196 | } |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
197 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
198 | static void |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
199 | purple_xmpp_connection_class_finalize(G_GNUC_UNUSED PurpleXmppConnectionClass *klass) { |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
200 | } |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
201 | |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
202 | /****************************************************************************** |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
203 | * Internal API |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
204 | *****************************************************************************/ |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
205 | void |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
206 | purple_xmpp_connection_register(GPluginNativePlugin *plugin) { |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
207 | purple_xmpp_connection_register_type(G_TYPE_MODULE(plugin)); |
|
a8a644e3e561
start of the new xmpp's connection
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
208 | } |