Fri, 01 Apr 2022 01:09:23 -0500
Move PurpleProxyInfo from a boxed type to a GObject
As well as:
* Fix the namespace of the PurpleProxyType members.
* Remove the GNOME proxy detection code.
* Remove the Windows proxy detection code.
Testing Done:
Created an account and messed around with the proxy settings and verified they were saved and restored.
Reviewed at https://reviews.imfreedom.org/r/1368/
| 37460 | 1 | /* purple |
| 1 | 2 | * |
| 15884 | 3 | * Purple is the legal property of its developers, whose names are too numerous |
| 8046 | 4 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 5 | * source distribution. | |
| 1 | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify | |
| 8 | * it under the terms of the GNU General Public License as published by | |
| 9 | * the Free Software Foundation; either version 2 of the License, or | |
| 10 | * (at your option) any later version. | |
| 11 | * | |
| 12 | * This program is distributed in the hope that it will be useful, | |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 | * GNU General Public License for more details. | |
| 16 | * | |
| 17 | * You should have received a copy of the GNU General Public License | |
| 18 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19840
diff
changeset
|
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 1 | 20 | * |
| 21 | */ | |
| 22 | ||
|
40441
f23c7e772667
Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
Gary Kramlich <grim@reaperworld.com>
parents:
40058
diff
changeset
|
23 | #include <glib/gi18n-lib.h> |
|
f23c7e772667
Make sure we're not including the gettext macros in header files and deal with the repercussions of that.
Gary Kramlich <grim@reaperworld.com>
parents:
40058
diff
changeset
|
24 | |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
25 | #include "internal.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
26 | #include "debug.h" |
|
6621
2a18ef3e5224
[gaim-migrate @ 7145]
Robert McQueen <robot101@debian.org>
parents:
6320
diff
changeset
|
27 | #include "notify.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
28 | #include "prefs.h" |
| 1 | 29 | #include "proxy.h" |
|
37964
39fca28f1a6e
proxy: Use new purple_gio_socket_client_new() helper function
Mike Ruprecht <cmaiku@gmail.com>
parents:
37942
diff
changeset
|
30 | #include "purple-gio.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
31 | #include "util.h" |
| 3630 | 32 | |
|
37451
927a083a6c9f
This probably doesn't work, but it compiles (for now)
Gary Kramlich <grim@reaperworld.com>
parents:
37193
diff
changeset
|
33 | #include <gio/gio.h> |
|
39990
7fb53d5427a8
Use SoupURI to parse proxy environment variables.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39659
diff
changeset
|
34 | #include <libsoup/soup.h> |
|
37451
927a083a6c9f
This probably doesn't work, but it compiles (for now)
Gary Kramlich <grim@reaperworld.com>
parents:
37193
diff
changeset
|
35 | |
| 15884 | 36 | static PurpleProxyInfo *global_proxy_info = NULL; |
|
14165
0f09ac2220f4
[gaim-migrate @ 16734]
Mark Doliner <markdoliner@pidgin.im>
parents:
14161
diff
changeset
|
37 | |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
38 | /************************************************************************** |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
39 | * Global Proxy API |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
40 | **************************************************************************/ |
| 15884 | 41 | PurpleProxyInfo * |
| 42 | purple_global_proxy_get_info(void) | |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
43 | { |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
44 | return global_proxy_info; |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
45 | } |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
46 | |
|
25858
ec60fbe5a4ab
Patch from fqueze to add API for setting the global proxy settings. Fixes #7610.
Daniel Atallah <datallah@pidgin.im>
parents:
24866
diff
changeset
|
47 | void |
|
ec60fbe5a4ab
Patch from fqueze to add API for setting the global proxy settings. Fixes #7610.
Daniel Atallah <datallah@pidgin.im>
parents:
24866
diff
changeset
|
48 | purple_global_proxy_set_info(PurpleProxyInfo *info) |
|
ec60fbe5a4ab
Patch from fqueze to add API for setting the global proxy settings. Fixes #7610.
Daniel Atallah <datallah@pidgin.im>
parents:
24866
diff
changeset
|
49 | { |
|
ec60fbe5a4ab
Patch from fqueze to add API for setting the global proxy settings. Fixes #7610.
Daniel Atallah <datallah@pidgin.im>
parents:
24866
diff
changeset
|
50 | g_return_if_fail(info != NULL); |
|
ec60fbe5a4ab
Patch from fqueze to add API for setting the global proxy settings. Fixes #7610.
Daniel Atallah <datallah@pidgin.im>
parents:
24866
diff
changeset
|
51 | |
|
41318
56092ffeae95
Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents:
41211
diff
changeset
|
52 | g_clear_object(&global_proxy_info); |
|
25858
ec60fbe5a4ab
Patch from fqueze to add API for setting the global proxy settings. Fixes #7610.
Daniel Atallah <datallah@pidgin.im>
parents:
24866
diff
changeset
|
53 | |
|
ec60fbe5a4ab
Patch from fqueze to add API for setting the global proxy settings. Fixes #7610.
Daniel Atallah <datallah@pidgin.im>
parents:
24866
diff
changeset
|
54 | global_proxy_info = info; |
|
ec60fbe5a4ab
Patch from fqueze to add API for setting the global proxy settings. Fixes #7610.
Daniel Atallah <datallah@pidgin.im>
parents:
24866
diff
changeset
|
55 | } |
|
ec60fbe5a4ab
Patch from fqueze to add API for setting the global proxy settings. Fixes #7610.
Daniel Atallah <datallah@pidgin.im>
parents:
24866
diff
changeset
|
56 | |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
57 | /************************************************************************** |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
58 | * Proxy API |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
59 | **************************************************************************/ |
|
4366
d2b52a5ff6fc
[gaim-migrate @ 4632]
Nicolás Lichtmaier <nico@lichtmaier.com.ar>
parents:
3867
diff
changeset
|
60 | |
| 15884 | 61 | PurpleProxyInfo * |
| 62 | purple_proxy_get_setup(PurpleAccount *account) | |
|
1087
bc9c6b635358
[gaim-migrate @ 1097]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1057
diff
changeset
|
63 | { |
| 15884 | 64 | PurpleProxyInfo *gpi = NULL; |
|
6621
2a18ef3e5224
[gaim-migrate @ 7145]
Robert McQueen <robot101@debian.org>
parents:
6320
diff
changeset
|
65 | const gchar *tmp; |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
66 | |
|
15032
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15015
diff
changeset
|
67 | /* This is used as a fallback so we don't overwrite the selected proxy type */ |
| 15884 | 68 | static PurpleProxyInfo *tmp_none_proxy_info = NULL; |
|
15032
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15015
diff
changeset
|
69 | if (!tmp_none_proxy_info) { |
| 15884 | 70 | tmp_none_proxy_info = purple_proxy_info_new(); |
|
41318
56092ffeae95
Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents:
41211
diff
changeset
|
71 | purple_proxy_info_set_proxy_type(tmp_none_proxy_info, PURPLE_PROXY_TYPE_NONE); |
|
15032
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15015
diff
changeset
|
72 | } |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15015
diff
changeset
|
73 | |
| 15884 | 74 | if (account && purple_account_get_proxy_info(account) != NULL) { |
| 75 | gpi = purple_account_get_proxy_info(account); | |
|
41318
56092ffeae95
Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents:
41211
diff
changeset
|
76 | if (purple_proxy_info_get_proxy_type(gpi) == PURPLE_PROXY_TYPE_USE_GLOBAL) |
|
15041
18a6f6cdce33
[gaim-migrate @ 17758]
Daniel Atallah <datallah@pidgin.im>
parents:
15032
diff
changeset
|
77 | gpi = NULL; |
|
18a6f6cdce33
[gaim-migrate @ 17758]
Daniel Atallah <datallah@pidgin.im>
parents:
15032
diff
changeset
|
78 | } |
|
18a6f6cdce33
[gaim-migrate @ 17758]
Daniel Atallah <datallah@pidgin.im>
parents:
15032
diff
changeset
|
79 | if (gpi == NULL) { |
|
41318
56092ffeae95
Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents:
41211
diff
changeset
|
80 | gpi = purple_global_proxy_get_info(); |
|
15041
18a6f6cdce33
[gaim-migrate @ 17758]
Daniel Atallah <datallah@pidgin.im>
parents:
15032
diff
changeset
|
81 | } |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
82 | |
|
41318
56092ffeae95
Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents:
41211
diff
changeset
|
83 | if (purple_proxy_info_get_proxy_type(gpi) == PURPLE_PROXY_TYPE_USE_ENVVAR) { |
|
6621
2a18ef3e5224
[gaim-migrate @ 7145]
Robert McQueen <robot101@debian.org>
parents:
6320
diff
changeset
|
84 | if ((tmp = g_getenv("HTTP_PROXY")) != NULL || |
|
2a18ef3e5224
[gaim-migrate @ 7145]
Robert McQueen <robot101@debian.org>
parents:
6320
diff
changeset
|
85 | (tmp = g_getenv("http_proxy")) != NULL || |
|
34219
eee308def583
HTTP: get rid of purple_url_parse
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34218
diff
changeset
|
86 | (tmp = g_getenv("HTTPPROXY")) != NULL) |
|
eee308def583
HTTP: get rid of purple_url_parse
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34218
diff
changeset
|
87 | { |
|
41211
2e804c9c0919
Switch SoupURI to GUri
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41157
diff
changeset
|
88 | gchar *scheme, *host, *username, *password; |
|
2e804c9c0919
Switch SoupURI to GUri
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41157
diff
changeset
|
89 | gint port; |
|
2e804c9c0919
Switch SoupURI to GUri
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41157
diff
changeset
|
90 | GError *error = NULL; |
|
6621
2a18ef3e5224
[gaim-migrate @ 7145]
Robert McQueen <robot101@debian.org>
parents:
6320
diff
changeset
|
91 | |
| 9129 | 92 | /* http_proxy-format: |
| 9227 | 93 | * export http_proxy="http://user:passwd@your.proxy.server:port/" |
|
7652
d60ba2565661
[gaim-migrate @ 8296]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
7475
diff
changeset
|
94 | */ |
|
41211
2e804c9c0919
Switch SoupURI to GUri
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41157
diff
changeset
|
95 | if (!g_uri_split_with_user(tmp, G_URI_FLAGS_HAS_PASSWORD, &scheme, |
|
2e804c9c0919
Switch SoupURI to GUri
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41157
diff
changeset
|
96 | &username, &password, NULL, |
|
2e804c9c0919
Switch SoupURI to GUri
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41157
diff
changeset
|
97 | &host, &port, NULL, NULL, NULL, &error)) |
|
2e804c9c0919
Switch SoupURI to GUri
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41157
diff
changeset
|
98 | { |
|
2e804c9c0919
Switch SoupURI to GUri
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41157
diff
changeset
|
99 | purple_debug_warning("proxy", "Couldn't parse URL: %s: %s", tmp, error->message); |
|
2e804c9c0919
Switch SoupURI to GUri
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41157
diff
changeset
|
100 | g_error_free(error); |
|
2e804c9c0919
Switch SoupURI to GUri
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41157
diff
changeset
|
101 | return gpi; |
|
2e804c9c0919
Switch SoupURI to GUri
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41157
diff
changeset
|
102 | } |
|
2e804c9c0919
Switch SoupURI to GUri
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41157
diff
changeset
|
103 | if (!purple_strequal(scheme, "http")) { |
|
39990
7fb53d5427a8
Use SoupURI to parse proxy environment variables.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39659
diff
changeset
|
104 | purple_debug_warning("proxy", "Couldn't parse URL: %s", tmp); |
|
41211
2e804c9c0919
Switch SoupURI to GUri
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41157
diff
changeset
|
105 | g_free(username); |
|
2e804c9c0919
Switch SoupURI to GUri
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41157
diff
changeset
|
106 | g_free(password); |
|
2e804c9c0919
Switch SoupURI to GUri
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41157
diff
changeset
|
107 | g_free(host); |
|
34219
eee308def583
HTTP: get rid of purple_url_parse
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34218
diff
changeset
|
108 | return gpi; |
|
7652
d60ba2565661
[gaim-migrate @ 8296]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
7475
diff
changeset
|
109 | } |
|
34219
eee308def583
HTTP: get rid of purple_url_parse
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34218
diff
changeset
|
110 | |
|
41318
56092ffeae95
Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents:
41211
diff
changeset
|
111 | purple_proxy_info_set_hostname(gpi, host); |
|
56092ffeae95
Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents:
41211
diff
changeset
|
112 | purple_proxy_info_set_port(gpi, port); |
|
41211
2e804c9c0919
Switch SoupURI to GUri
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41157
diff
changeset
|
113 | purple_proxy_info_set_username(gpi, username); |
|
2e804c9c0919
Switch SoupURI to GUri
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41157
diff
changeset
|
114 | purple_proxy_info_set_password(gpi, password); |
|
39990
7fb53d5427a8
Use SoupURI to parse proxy environment variables.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39659
diff
changeset
|
115 | |
|
41211
2e804c9c0919
Switch SoupURI to GUri
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41157
diff
changeset
|
116 | g_free(host); |
|
2e804c9c0919
Switch SoupURI to GUri
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41157
diff
changeset
|
117 | g_free(username); |
|
2e804c9c0919
Switch SoupURI to GUri
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41157
diff
changeset
|
118 | g_free(password); |
|
34219
eee308def583
HTTP: get rid of purple_url_parse
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34218
diff
changeset
|
119 | |
|
eee308def583
HTTP: get rid of purple_url_parse
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34218
diff
changeset
|
120 | /* XXX: Do we want to skip this step if user/password/port were part of url? */ |
|
eee308def583
HTTP: get rid of purple_url_parse
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34218
diff
changeset
|
121 | if ((tmp = g_getenv("HTTP_PROXY_USER")) != NULL || |
|
eee308def583
HTTP: get rid of purple_url_parse
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34218
diff
changeset
|
122 | (tmp = g_getenv("http_proxy_user")) != NULL || |
|
eee308def583
HTTP: get rid of purple_url_parse
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34218
diff
changeset
|
123 | (tmp = g_getenv("HTTPPROXYUSER")) != NULL) |
|
eee308def583
HTTP: get rid of purple_url_parse
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34218
diff
changeset
|
124 | purple_proxy_info_set_username(gpi, tmp); |
|
eee308def583
HTTP: get rid of purple_url_parse
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34218
diff
changeset
|
125 | |
|
eee308def583
HTTP: get rid of purple_url_parse
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34218
diff
changeset
|
126 | if ((tmp = g_getenv("HTTP_PROXY_PASS")) != NULL || |
|
eee308def583
HTTP: get rid of purple_url_parse
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34218
diff
changeset
|
127 | (tmp = g_getenv("http_proxy_pass")) != NULL || |
|
eee308def583
HTTP: get rid of purple_url_parse
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34218
diff
changeset
|
128 | (tmp = g_getenv("HTTPPROXYPASS")) != NULL) |
|
eee308def583
HTTP: get rid of purple_url_parse
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34218
diff
changeset
|
129 | purple_proxy_info_set_password(gpi, tmp); |
|
eee308def583
HTTP: get rid of purple_url_parse
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34218
diff
changeset
|
130 | |
|
eee308def583
HTTP: get rid of purple_url_parse
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34218
diff
changeset
|
131 | if ((tmp = g_getenv("HTTP_PROXY_PORT")) != NULL || |
|
eee308def583
HTTP: get rid of purple_url_parse
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34218
diff
changeset
|
132 | (tmp = g_getenv("http_proxy_port")) != NULL || |
|
eee308def583
HTTP: get rid of purple_url_parse
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34218
diff
changeset
|
133 | (tmp = g_getenv("HTTPPROXYPORT")) != NULL) |
|
eee308def583
HTTP: get rid of purple_url_parse
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34218
diff
changeset
|
134 | purple_proxy_info_set_port(gpi, atoi(tmp)); |
|
10534
c28eef1b882a
[gaim-migrate @ 11866]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10320
diff
changeset
|
135 | } else { |
|
c28eef1b882a
[gaim-migrate @ 11866]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10320
diff
changeset
|
136 | /* no proxy environment variable found, don't use a proxy */ |
| 15884 | 137 | purple_debug_info("proxy", "No environment settings found, not using a proxy\n"); |
|
15032
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15015
diff
changeset
|
138 | gpi = tmp_none_proxy_info; |
|
6621
2a18ef3e5224
[gaim-migrate @ 7145]
Robert McQueen <robot101@debian.org>
parents:
6320
diff
changeset
|
139 | } |
|
2a18ef3e5224
[gaim-migrate @ 7145]
Robert McQueen <robot101@debian.org>
parents:
6320
diff
changeset
|
140 | |
|
2a18ef3e5224
[gaim-migrate @ 7145]
Robert McQueen <robot101@debian.org>
parents:
6320
diff
changeset
|
141 | } |
|
2a18ef3e5224
[gaim-migrate @ 7145]
Robert McQueen <robot101@debian.org>
parents:
6320
diff
changeset
|
142 | |
| 13515 | 143 | return gpi; |
| 144 | } | |
| 145 | ||
|
37532
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
146 | GProxyResolver * |
|
37965
b67fb3fb5f85
proxy: Add GError argument to purple_proxy_get_proxy_resolver()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37964
diff
changeset
|
147 | purple_proxy_get_proxy_resolver(PurpleAccount *account, GError **error) |
|
37532
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
148 | { |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
149 | PurpleProxyInfo *info = purple_proxy_get_setup(account); |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
150 | const gchar *protocol; |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
151 | const gchar *username; |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
152 | const gchar *password; |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
153 | gchar *auth; |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
154 | gchar *proxy; |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
155 | GProxyResolver *resolver; |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
156 | |
|
41318
56092ffeae95
Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents:
41211
diff
changeset
|
157 | if (purple_proxy_info_get_proxy_type(info) == PURPLE_PROXY_TYPE_NONE) { |
|
37942
33f8691a69df
proxy: don't use default resolver if direct connection is wanted
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37939
diff
changeset
|
158 | /* Return an empty simple resolver, which will resolve on direct |
|
33f8691a69df
proxy: don't use default resolver if direct connection is wanted
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37939
diff
changeset
|
159 | * connection. */ |
|
33f8691a69df
proxy: don't use default resolver if direct connection is wanted
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37939
diff
changeset
|
160 | return g_simple_proxy_resolver_new(NULL, NULL); |
|
37532
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
161 | } |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
162 | |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
163 | switch (purple_proxy_info_get_proxy_type(info)) |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
164 | { |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
165 | /* PURPLE_PROXY_NONE already handled above */ |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
166 | |
|
41318
56092ffeae95
Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents:
41211
diff
changeset
|
167 | case PURPLE_PROXY_TYPE_USE_ENVVAR: |
|
37532
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
168 | /* Intentional passthrough */ |
|
41318
56092ffeae95
Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents:
41211
diff
changeset
|
169 | case PURPLE_PROXY_TYPE_HTTP: |
|
37532
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
170 | protocol = "http"; |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
171 | break; |
|
41318
56092ffeae95
Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents:
41211
diff
changeset
|
172 | case PURPLE_PROXY_TYPE_SOCKS4: |
|
37532
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
173 | protocol = "socks4"; |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
174 | break; |
|
41318
56092ffeae95
Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents:
41211
diff
changeset
|
175 | case PURPLE_PROXY_TYPE_SOCKS5: |
|
37532
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
176 | /* Intentional passthrough */ |
|
41318
56092ffeae95
Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents:
41211
diff
changeset
|
177 | case PURPLE_PROXY_TYPE_TOR: |
|
37532
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
178 | protocol = "socks5"; |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
179 | break; |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
180 | |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
181 | default: |
|
37965
b67fb3fb5f85
proxy: Add GError argument to purple_proxy_get_proxy_resolver()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37964
diff
changeset
|
182 | g_set_error(error, PURPLE_CONNECTION_ERROR, |
|
b67fb3fb5f85
proxy: Add GError argument to purple_proxy_get_proxy_resolver()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37964
diff
changeset
|
183 | PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, |
|
b67fb3fb5f85
proxy: Add GError argument to purple_proxy_get_proxy_resolver()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37964
diff
changeset
|
184 | _("Invalid Proxy type (%d) specified"), |
|
37532
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
185 | purple_proxy_info_get_proxy_type(info)); |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
186 | return NULL; |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
187 | } |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
188 | |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
189 | |
|
41318
56092ffeae95
Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents:
41211
diff
changeset
|
190 | if (purple_proxy_info_get_hostname(info) == NULL || |
|
37532
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
191 | purple_proxy_info_get_port(info) <= 0) { |
|
37965
b67fb3fb5f85
proxy: Add GError argument to purple_proxy_get_proxy_resolver()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37964
diff
changeset
|
192 | g_set_error_literal(error, PURPLE_CONNECTION_ERROR, |
|
b67fb3fb5f85
proxy: Add GError argument to purple_proxy_get_proxy_resolver()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37964
diff
changeset
|
193 | PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, |
|
37532
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
194 | _("Either the host name or port number " |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
195 | "specified for your given proxy type is " |
|
37965
b67fb3fb5f85
proxy: Add GError argument to purple_proxy_get_proxy_resolver()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37964
diff
changeset
|
196 | "invalid.")); |
|
37532
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
197 | return NULL; |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
198 | } |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
199 | |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
200 | /* Everything checks out. Create and return the GProxyResolver */ |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
201 | |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
202 | username = purple_proxy_info_get_username(info); |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
203 | password = purple_proxy_info_get_password(info); |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
204 | |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
205 | /* Username and password are optional */ |
|
41157
f223b69f7da2
Fix some bugs with proxies for xmpp
Gary Kramlich <grim@reaperworld.com>
parents:
40654
diff
changeset
|
206 | if(username != NULL && *username != '\0') { |
|
f223b69f7da2
Fix some bugs with proxies for xmpp
Gary Kramlich <grim@reaperworld.com>
parents:
40654
diff
changeset
|
207 | if(password != NULL && *password != '\0') { |
|
f223b69f7da2
Fix some bugs with proxies for xmpp
Gary Kramlich <grim@reaperworld.com>
parents:
40654
diff
changeset
|
208 | auth = g_strdup_printf("%s:%s@", username, password); |
|
f223b69f7da2
Fix some bugs with proxies for xmpp
Gary Kramlich <grim@reaperworld.com>
parents:
40654
diff
changeset
|
209 | } else { |
|
f223b69f7da2
Fix some bugs with proxies for xmpp
Gary Kramlich <grim@reaperworld.com>
parents:
40654
diff
changeset
|
210 | auth = g_strdup_printf("%s@", username); |
|
f223b69f7da2
Fix some bugs with proxies for xmpp
Gary Kramlich <grim@reaperworld.com>
parents:
40654
diff
changeset
|
211 | } |
|
37532
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
212 | } else { |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
213 | auth = NULL; |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
214 | } |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
215 | |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
216 | proxy = g_strdup_printf("%s://%s%s:%i", protocol, |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
217 | auth != NULL ? auth : "", |
|
41318
56092ffeae95
Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents:
41211
diff
changeset
|
218 | purple_proxy_info_get_hostname(info), |
|
37532
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
219 | purple_proxy_info_get_port(info)); |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
220 | g_free(auth); |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
221 | |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
222 | resolver = g_simple_proxy_resolver_new(proxy, NULL); |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
223 | g_free(proxy); |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
224 | |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
225 | return resolver; |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
226 | } |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
227 | |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
228 | static void |
| 15884 | 229 | proxy_pref_cb(const char *name, PurplePrefType type, |
|
12816
5f93e09fa9a6
[gaim-migrate @ 15164]
Mark Doliner <markdoliner@pidgin.im>
parents:
12811
diff
changeset
|
230 | gconstpointer value, gpointer data) |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
231 | { |
| 15884 | 232 | PurpleProxyInfo *info = purple_global_proxy_get_info(); |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
233 | |
|
25859
b42be7bb9dac
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <darkrain42@pidgin.im>
parents:
24866
diff
changeset
|
234 | if (purple_strequal(name, "/purple/proxy/type")) { |
|
6001
1abbeff6571c
[gaim-migrate @ 6449]
Mark Doliner <markdoliner@pidgin.im>
parents:
5970
diff
changeset
|
235 | int proxytype; |
|
12816
5f93e09fa9a6
[gaim-migrate @ 15164]
Mark Doliner <markdoliner@pidgin.im>
parents:
12811
diff
changeset
|
236 | const char *type = value; |
|
6001
1abbeff6571c
[gaim-migrate @ 6449]
Mark Doliner <markdoliner@pidgin.im>
parents:
5970
diff
changeset
|
237 | |
|
25859
b42be7bb9dac
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <darkrain42@pidgin.im>
parents:
24866
diff
changeset
|
238 | if (purple_strequal(type, "none")) |
|
41318
56092ffeae95
Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents:
41211
diff
changeset
|
239 | proxytype = PURPLE_PROXY_TYPE_NONE; |
|
25859
b42be7bb9dac
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <darkrain42@pidgin.im>
parents:
24866
diff
changeset
|
240 | else if (purple_strequal(type, "http")) |
|
41318
56092ffeae95
Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents:
41211
diff
changeset
|
241 | proxytype = PURPLE_PROXY_TYPE_HTTP; |
|
25859
b42be7bb9dac
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <darkrain42@pidgin.im>
parents:
24866
diff
changeset
|
242 | else if (purple_strequal(type, "socks4")) |
|
41318
56092ffeae95
Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents:
41211
diff
changeset
|
243 | proxytype = PURPLE_PROXY_TYPE_SOCKS4; |
|
25859
b42be7bb9dac
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <darkrain42@pidgin.im>
parents:
24866
diff
changeset
|
244 | else if (purple_strequal(type, "socks5")) |
|
41318
56092ffeae95
Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents:
41211
diff
changeset
|
245 | proxytype = PURPLE_PROXY_TYPE_SOCKS5; |
|
31677
042eaab1468c
Add a new proxy type of "Tor". This is really just a SOCKS5 proxy, but can be
Daniel Atallah <datallah@pidgin.im>
parents:
30626
diff
changeset
|
246 | else if (purple_strequal(type, "tor")) |
|
41318
56092ffeae95
Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents:
41211
diff
changeset
|
247 | proxytype = PURPLE_PROXY_TYPE_TOR; |
|
25859
b42be7bb9dac
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <darkrain42@pidgin.im>
parents:
24866
diff
changeset
|
248 | else if (purple_strequal(type, "envvar")) |
|
41318
56092ffeae95
Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents:
41211
diff
changeset
|
249 | proxytype = PURPLE_PROXY_TYPE_USE_ENVVAR; |
|
6001
1abbeff6571c
[gaim-migrate @ 6449]
Mark Doliner <markdoliner@pidgin.im>
parents:
5970
diff
changeset
|
250 | else |
|
1abbeff6571c
[gaim-migrate @ 6449]
Mark Doliner <markdoliner@pidgin.im>
parents:
5970
diff
changeset
|
251 | proxytype = -1; |
|
1abbeff6571c
[gaim-migrate @ 6449]
Mark Doliner <markdoliner@pidgin.im>
parents:
5970
diff
changeset
|
252 | |
|
35378
5d9e2581005b
gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents:
35265
diff
changeset
|
253 | purple_proxy_info_set_proxy_type(info, proxytype); |
|
25859
b42be7bb9dac
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <darkrain42@pidgin.im>
parents:
24866
diff
changeset
|
254 | } else if (purple_strequal(name, "/purple/proxy/host")) |
|
41318
56092ffeae95
Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents:
41211
diff
changeset
|
255 | purple_proxy_info_set_hostname(info, value); |
|
25859
b42be7bb9dac
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <darkrain42@pidgin.im>
parents:
24866
diff
changeset
|
256 | else if (purple_strequal(name, "/purple/proxy/port")) |
| 15884 | 257 | purple_proxy_info_set_port(info, GPOINTER_TO_INT(value)); |
|
25859
b42be7bb9dac
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <darkrain42@pidgin.im>
parents:
24866
diff
changeset
|
258 | else if (purple_strequal(name, "/purple/proxy/username")) |
| 15884 | 259 | purple_proxy_info_set_username(info, value); |
|
25859
b42be7bb9dac
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
Paul Aurich <darkrain42@pidgin.im>
parents:
24866
diff
changeset
|
260 | else if (purple_strequal(name, "/purple/proxy/password")) |
| 15884 | 261 | purple_proxy_info_set_password(info, value); |
|
1087
bc9c6b635358
[gaim-migrate @ 1097]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1057
diff
changeset
|
262 | } |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
263 | |
|
14151
34427f138b1f
[gaim-migrate @ 16712]
Mark Doliner <markdoliner@pidgin.im>
parents:
14097
diff
changeset
|
264 | void * |
| 15884 | 265 | purple_proxy_get_handle() |
|
14151
34427f138b1f
[gaim-migrate @ 16712]
Mark Doliner <markdoliner@pidgin.im>
parents:
14097
diff
changeset
|
266 | { |
|
34427f138b1f
[gaim-migrate @ 16712]
Mark Doliner <markdoliner@pidgin.im>
parents:
14097
diff
changeset
|
267 | static int handle; |
|
34427f138b1f
[gaim-migrate @ 16712]
Mark Doliner <markdoliner@pidgin.im>
parents:
14097
diff
changeset
|
268 | |
|
34427f138b1f
[gaim-migrate @ 16712]
Mark Doliner <markdoliner@pidgin.im>
parents:
14097
diff
changeset
|
269 | return &handle; |
|
34427f138b1f
[gaim-migrate @ 16712]
Mark Doliner <markdoliner@pidgin.im>
parents:
14097
diff
changeset
|
270 | } |
|
34427f138b1f
[gaim-migrate @ 16712]
Mark Doliner <markdoliner@pidgin.im>
parents:
14097
diff
changeset
|
271 | |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
272 | void |
| 15884 | 273 | purple_proxy_init(void) |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
274 | { |
|
10087
e5b80a38939d
[gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9863
diff
changeset
|
275 | void *handle; |
|
e5b80a38939d
[gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9863
diff
changeset
|
276 | |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
277 | /* Initialize a default proxy info struct. */ |
| 15884 | 278 | global_proxy_info = purple_proxy_info_new(); |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
279 | |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
280 | /* Proxy */ |
|
16478
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
16037
diff
changeset
|
281 | purple_prefs_add_none("/purple/proxy"); |
|
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
16037
diff
changeset
|
282 | purple_prefs_add_string("/purple/proxy/type", "none"); |
|
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
16037
diff
changeset
|
283 | purple_prefs_add_string("/purple/proxy/host", ""); |
|
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
16037
diff
changeset
|
284 | purple_prefs_add_int("/purple/proxy/port", 0); |
|
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
16037
diff
changeset
|
285 | purple_prefs_add_string("/purple/proxy/username", ""); |
|
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
16037
diff
changeset
|
286 | purple_prefs_add_string("/purple/proxy/password", ""); |
|
25624
62b56bc39896
Implement support for resolving DNS via the SOCKS4 proxy in use.
Daniel Atallah <datallah@pidgin.im>
parents:
25623
diff
changeset
|
287 | purple_prefs_add_bool("/purple/proxy/socks4_remotedns", FALSE); |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
288 | |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
289 | /* Setup callbacks for the preferences. */ |
| 15884 | 290 | handle = purple_proxy_get_handle(); |
|
16478
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
16037
diff
changeset
|
291 | purple_prefs_connect_callback(handle, "/purple/proxy/type", proxy_pref_cb, |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13085
diff
changeset
|
292 | NULL); |
|
16478
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
16037
diff
changeset
|
293 | purple_prefs_connect_callback(handle, "/purple/proxy/host", proxy_pref_cb, |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13085
diff
changeset
|
294 | NULL); |
|
16478
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
16037
diff
changeset
|
295 | purple_prefs_connect_callback(handle, "/purple/proxy/port", proxy_pref_cb, |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13085
diff
changeset
|
296 | NULL); |
|
16478
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
16037
diff
changeset
|
297 | purple_prefs_connect_callback(handle, "/purple/proxy/username", |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13085
diff
changeset
|
298 | proxy_pref_cb, NULL); |
|
16478
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
16037
diff
changeset
|
299 | purple_prefs_connect_callback(handle, "/purple/proxy/password", |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13085
diff
changeset
|
300 | proxy_pref_cb, NULL); |
|
20053
68ce40196f8a
grab revision 6be36979d022284283217c2a32f2b812740cbbf3
Luke Schierer <lschiere@pidgin.im>
parents:
19985
diff
changeset
|
301 | |
|
68ce40196f8a
grab revision 6be36979d022284283217c2a32f2b812740cbbf3
Luke Schierer <lschiere@pidgin.im>
parents:
19985
diff
changeset
|
302 | /* Load the initial proxy settings */ |
|
20055
ca7144d5605f
grab revision 240d37f3b465527200f862ff3c0da77618ae32ae
Luke Schierer <lschiere@pidgin.im>
parents:
20053
diff
changeset
|
303 | purple_prefs_trigger_callback("/purple/proxy/type"); |
|
ca7144d5605f
grab revision 240d37f3b465527200f862ff3c0da77618ae32ae
Luke Schierer <lschiere@pidgin.im>
parents:
20053
diff
changeset
|
304 | purple_prefs_trigger_callback("/purple/proxy/host"); |
|
ca7144d5605f
grab revision 240d37f3b465527200f862ff3c0da77618ae32ae
Luke Schierer <lschiere@pidgin.im>
parents:
20053
diff
changeset
|
305 | purple_prefs_trigger_callback("/purple/proxy/port"); |
|
ca7144d5605f
grab revision 240d37f3b465527200f862ff3c0da77618ae32ae
Luke Schierer <lschiere@pidgin.im>
parents:
20053
diff
changeset
|
306 | purple_prefs_trigger_callback("/purple/proxy/username"); |
|
ca7144d5605f
grab revision 240d37f3b465527200f862ff3c0da77618ae32ae
Luke Schierer <lschiere@pidgin.im>
parents:
20053
diff
changeset
|
307 | purple_prefs_trigger_callback("/purple/proxy/password"); |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
308 | } |
|
10087
e5b80a38939d
[gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9863
diff
changeset
|
309 | |
|
14151
34427f138b1f
[gaim-migrate @ 16712]
Mark Doliner <markdoliner@pidgin.im>
parents:
14097
diff
changeset
|
310 | void |
| 15884 | 311 | purple_proxy_uninit(void) |
|
10087
e5b80a38939d
[gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9863
diff
changeset
|
312 | { |
|
28177
e62fe687ca6c
Clean up various file-scoped globals at uninit.
Paul Aurich <darkrain42@pidgin.im>
parents:
27943
diff
changeset
|
313 | purple_prefs_disconnect_by_handle(purple_proxy_get_handle()); |
|
e62fe687ca6c
Clean up various file-scoped globals at uninit.
Paul Aurich <darkrain42@pidgin.im>
parents:
27943
diff
changeset
|
314 | |
|
41318
56092ffeae95
Move PurpleProxyInfo from a boxed type to a GObject
Gary Kramlich <grim@reaperworld.com>
parents:
41211
diff
changeset
|
315 | g_clear_object(&global_proxy_info); |
|
10087
e5b80a38939d
[gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9863
diff
changeset
|
316 | } |