Tue, 14 Dec 2021 01:55:51 -0600
Switch SoupURI to GUri
The former has been removed from libsoup 3, and the latter only added to GLib 2.66, but we depend on that version now. So in most cases we can simply replace it directly.
Testing Done:
Compiled against libsoup 2 and 3.
Reviewed at https://reviews.imfreedom.org/r/1185/
| 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 | |
|
32299
106311e19d3a
Hide PurpleProxyInfo struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32297
diff
changeset
|
36 | struct _PurpleProxyInfo |
|
106311e19d3a
Hide PurpleProxyInfo struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32297
diff
changeset
|
37 | { |
|
35462
901dfa763f15
Fix some gtk-doc warnings till proxy.c
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
38 | PurpleProxyType type; /* The proxy type. */ |
|
901dfa763f15
Fix some gtk-doc warnings till proxy.c
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
39 | |
|
901dfa763f15
Fix some gtk-doc warnings till proxy.c
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
40 | char *host; /* The host. */ |
|
901dfa763f15
Fix some gtk-doc warnings till proxy.c
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
41 | int port; /* The port number. */ |
|
901dfa763f15
Fix some gtk-doc warnings till proxy.c
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
42 | char *username; /* The username. */ |
|
901dfa763f15
Fix some gtk-doc warnings till proxy.c
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
43 | char *password; /* The password. */ |
|
32299
106311e19d3a
Hide PurpleProxyInfo struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32297
diff
changeset
|
44 | }; |
|
106311e19d3a
Hide PurpleProxyInfo struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32297
diff
changeset
|
45 | |
| 15884 | 46 | static PurpleProxyInfo *global_proxy_info = NULL; |
|
14165
0f09ac2220f4
[gaim-migrate @ 16734]
Mark Doliner <markdoliner@pidgin.im>
parents:
14161
diff
changeset
|
47 | |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
48 | /************************************************************************** |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
49 | * Proxy structure API |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
50 | **************************************************************************/ |
| 15884 | 51 | PurpleProxyInfo * |
| 52 | purple_proxy_info_new(void) | |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
53 | { |
| 15884 | 54 | return g_new0(PurpleProxyInfo, 1); |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
55 | } |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
56 | |
|
39386
3fd7e834749f
libpurple: Make PurpleProxyInfo a boxed type
Mike Ruprecht <cmaiku@gmail.com>
parents:
38356
diff
changeset
|
57 | static PurpleProxyInfo * |
|
3fd7e834749f
libpurple: Make PurpleProxyInfo a boxed type
Mike Ruprecht <cmaiku@gmail.com>
parents:
38356
diff
changeset
|
58 | purple_proxy_info_copy(PurpleProxyInfo *info) |
|
3fd7e834749f
libpurple: Make PurpleProxyInfo a boxed type
Mike Ruprecht <cmaiku@gmail.com>
parents:
38356
diff
changeset
|
59 | { |
|
3fd7e834749f
libpurple: Make PurpleProxyInfo a boxed type
Mike Ruprecht <cmaiku@gmail.com>
parents:
38356
diff
changeset
|
60 | PurpleProxyInfo *copy; |
|
3fd7e834749f
libpurple: Make PurpleProxyInfo a boxed type
Mike Ruprecht <cmaiku@gmail.com>
parents:
38356
diff
changeset
|
61 | |
|
3fd7e834749f
libpurple: Make PurpleProxyInfo a boxed type
Mike Ruprecht <cmaiku@gmail.com>
parents:
38356
diff
changeset
|
62 | g_return_val_if_fail(info != NULL, NULL); |
|
3fd7e834749f
libpurple: Make PurpleProxyInfo a boxed type
Mike Ruprecht <cmaiku@gmail.com>
parents:
38356
diff
changeset
|
63 | |
|
3fd7e834749f
libpurple: Make PurpleProxyInfo a boxed type
Mike Ruprecht <cmaiku@gmail.com>
parents:
38356
diff
changeset
|
64 | copy = purple_proxy_info_new(); |
|
3fd7e834749f
libpurple: Make PurpleProxyInfo a boxed type
Mike Ruprecht <cmaiku@gmail.com>
parents:
38356
diff
changeset
|
65 | copy->type = info->type; |
|
3fd7e834749f
libpurple: Make PurpleProxyInfo a boxed type
Mike Ruprecht <cmaiku@gmail.com>
parents:
38356
diff
changeset
|
66 | copy->host = g_strdup(info->host); |
|
3fd7e834749f
libpurple: Make PurpleProxyInfo a boxed type
Mike Ruprecht <cmaiku@gmail.com>
parents:
38356
diff
changeset
|
67 | copy->port = info->port; |
|
3fd7e834749f
libpurple: Make PurpleProxyInfo a boxed type
Mike Ruprecht <cmaiku@gmail.com>
parents:
38356
diff
changeset
|
68 | copy->username = g_strdup(info->username); |
|
3fd7e834749f
libpurple: Make PurpleProxyInfo a boxed type
Mike Ruprecht <cmaiku@gmail.com>
parents:
38356
diff
changeset
|
69 | copy->password = g_strdup(info->password); |
|
3fd7e834749f
libpurple: Make PurpleProxyInfo a boxed type
Mike Ruprecht <cmaiku@gmail.com>
parents:
38356
diff
changeset
|
70 | |
|
39462
1fcf9a1f920e
Fix broken PurpleProxyInfo copying.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39386
diff
changeset
|
71 | return copy; |
|
39386
3fd7e834749f
libpurple: Make PurpleProxyInfo a boxed type
Mike Ruprecht <cmaiku@gmail.com>
parents:
38356
diff
changeset
|
72 | } |
|
3fd7e834749f
libpurple: Make PurpleProxyInfo a boxed type
Mike Ruprecht <cmaiku@gmail.com>
parents:
38356
diff
changeset
|
73 | |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
74 | void |
| 15884 | 75 | purple_proxy_info_destroy(PurpleProxyInfo *info) |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
76 | { |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
77 | g_return_if_fail(info != NULL); |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
78 | |
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13991
diff
changeset
|
79 | g_free(info->host); |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13991
diff
changeset
|
80 | g_free(info->username); |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13991
diff
changeset
|
81 | g_free(info->password); |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
82 | |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
83 | g_free(info); |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
84 | } |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
85 | |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
86 | void |
|
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
|
87 | purple_proxy_info_set_proxy_type(PurpleProxyInfo *info, PurpleProxyType type) |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
88 | { |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
89 | g_return_if_fail(info != NULL); |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
90 | |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
91 | info->type = type; |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
92 | } |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
93 | |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
94 | void |
| 15884 | 95 | purple_proxy_info_set_host(PurpleProxyInfo *info, const char *host) |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
96 | { |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
97 | g_return_if_fail(info != NULL); |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
98 | |
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13991
diff
changeset
|
99 | g_free(info->host); |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14030
diff
changeset
|
100 | info->host = g_strdup(host); |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
101 | } |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
102 | |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
103 | void |
| 15884 | 104 | purple_proxy_info_set_port(PurpleProxyInfo *info, int port) |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
105 | { |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
106 | g_return_if_fail(info != NULL); |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
107 | |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
108 | info->port = port; |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
109 | } |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
110 | |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
111 | void |
| 15884 | 112 | purple_proxy_info_set_username(PurpleProxyInfo *info, const char *username) |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
113 | { |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
114 | g_return_if_fail(info != NULL); |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
115 | |
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13991
diff
changeset
|
116 | g_free(info->username); |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14030
diff
changeset
|
117 | info->username = g_strdup(username); |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
118 | } |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
119 | |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
120 | void |
| 15884 | 121 | purple_proxy_info_set_password(PurpleProxyInfo *info, const char *password) |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
122 | { |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
123 | g_return_if_fail(info != NULL); |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
124 | |
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13991
diff
changeset
|
125 | g_free(info->password); |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
14030
diff
changeset
|
126 | info->password = g_strdup(password); |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
127 | } |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
128 | |
| 15884 | 129 | PurpleProxyType |
|
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
|
130 | purple_proxy_info_get_proxy_type(const PurpleProxyInfo *info) |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
131 | { |
| 15884 | 132 | g_return_val_if_fail(info != NULL, PURPLE_PROXY_NONE); |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
133 | |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
134 | return info->type; |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
135 | } |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
136 | |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
137 | const char * |
| 15884 | 138 | purple_proxy_info_get_host(const PurpleProxyInfo *info) |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
139 | { |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
140 | g_return_val_if_fail(info != NULL, NULL); |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
141 | |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
142 | return info->host; |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
143 | } |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
144 | |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
145 | int |
| 15884 | 146 | purple_proxy_info_get_port(const PurpleProxyInfo *info) |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
147 | { |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
148 | g_return_val_if_fail(info != NULL, 0); |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
149 | |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
150 | return info->port; |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
151 | } |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
152 | |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
153 | const char * |
| 15884 | 154 | purple_proxy_info_get_username(const PurpleProxyInfo *info) |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
155 | { |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
156 | g_return_val_if_fail(info != NULL, NULL); |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
157 | |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
158 | return info->username; |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
159 | } |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
160 | |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
161 | const char * |
| 15884 | 162 | purple_proxy_info_get_password(const PurpleProxyInfo *info) |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
163 | { |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
164 | g_return_val_if_fail(info != NULL, NULL); |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
165 | |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
166 | return info->password; |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
167 | } |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
168 | |
|
39386
3fd7e834749f
libpurple: Make PurpleProxyInfo a boxed type
Mike Ruprecht <cmaiku@gmail.com>
parents:
38356
diff
changeset
|
169 | G_DEFINE_BOXED_TYPE(PurpleProxyInfo, purple_proxy_info, |
|
3fd7e834749f
libpurple: Make PurpleProxyInfo a boxed type
Mike Ruprecht <cmaiku@gmail.com>
parents:
38356
diff
changeset
|
170 | purple_proxy_info_copy, purple_proxy_info_destroy); |
|
3fd7e834749f
libpurple: Make PurpleProxyInfo a boxed type
Mike Ruprecht <cmaiku@gmail.com>
parents:
38356
diff
changeset
|
171 | |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
172 | /************************************************************************** |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
173 | * Global Proxy API |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
174 | **************************************************************************/ |
| 15884 | 175 | PurpleProxyInfo * |
| 176 | purple_global_proxy_get_info(void) | |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
177 | { |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
178 | return global_proxy_info; |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
179 | } |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
180 | |
|
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
|
181 | 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
|
182 | 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
|
183 | { |
|
ec60fbe5a4ab
Patch from fqueze to add API for setting the global proxy settings. Fixes #7610.
Daniel Atallah <datallah@pidgin.im>
parents:
24866
diff
changeset
|
184 | 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
|
185 | |
|
ec60fbe5a4ab
Patch from fqueze to add API for setting the global proxy settings. Fixes #7610.
Daniel Atallah <datallah@pidgin.im>
parents:
24866
diff
changeset
|
186 | purple_proxy_info_destroy(global_proxy_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
|
187 | |
|
ec60fbe5a4ab
Patch from fqueze to add API for setting the global proxy settings. Fixes #7610.
Daniel Atallah <datallah@pidgin.im>
parents:
24866
diff
changeset
|
188 | 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
|
189 | } |
|
ec60fbe5a4ab
Patch from fqueze to add API for setting the global proxy settings. Fixes #7610.
Daniel Atallah <datallah@pidgin.im>
parents:
24866
diff
changeset
|
190 | |
|
32136
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
191 | |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
192 | /* index in gproxycmds below, keep them in sync */ |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
193 | #define GNOME_PROXY_MODE 0 |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
194 | #define GNOME_PROXY_USE_SAME_PROXY 1 |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
195 | #define GNOME_PROXY_SOCKS_HOST 2 |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
196 | #define GNOME_PROXY_SOCKS_PORT 3 |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
197 | #define GNOME_PROXY_HTTP_HOST 4 |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
198 | #define GNOME_PROXY_HTTP_PORT 5 |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
199 | #define GNOME_PROXY_HTTP_USER 6 |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
200 | #define GNOME_PROXY_HTTP_PASS 7 |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
201 | #define GNOME2_CMDS 0 |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
202 | #define GNOME3_CMDS 1 |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
203 | |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
204 | /* detect proxy settings for gnome2/gnome3 */ |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
205 | static const char* gproxycmds[][2] = { |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
206 | { "gconftool-2 -g /system/proxy/mode" , "gsettings get org.gnome.system.proxy mode" }, |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
207 | { "gconftool-2 -g /system/http_proxy/use_same_proxy", "gsettings get org.gnome.system.proxy use-same-proxy" }, |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
208 | { "gconftool-2 -g /system/proxy/socks_host", "gsettings get org.gnome.system.proxy.socks host" }, |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
209 | { "gconftool-2 -g /system/proxy/socks_port", "gsettings get org.gnome.system.proxy.socks port" }, |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
210 | { "gconftool-2 -g /system/http_proxy/host", "gsettings get org.gnome.system.proxy.http host" }, |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
211 | { "gconftool-2 -g /system/http_proxy/port", "gsettings get org.gnome.system.proxy.http port"}, |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
212 | { "gconftool-2 -g /system/http_proxy/authentication_user", "gsettings get org.gnome.system.proxy.http authentication-user" }, |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
213 | { "gconftool-2 -g /system/http_proxy/authentication_password", "gsettings get org.gnome.system.proxy.http authentication-password" }, |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
214 | }; |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
215 | |
|
35462
901dfa763f15
Fix some gtk-doc warnings till proxy.c
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
216 | /* |
|
901dfa763f15
Fix some gtk-doc warnings till proxy.c
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
217 | * purple_gnome_proxy_get_parameter: |
|
901dfa763f15
Fix some gtk-doc warnings till proxy.c
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
218 | * @parameter: One of the GNOME_PROXY_x constants defined above |
|
901dfa763f15
Fix some gtk-doc warnings till proxy.c
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
219 | * @gnome_version: GNOME2_CMDS or GNOME3_CMDS |
|
901dfa763f15
Fix some gtk-doc warnings till proxy.c
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
220 | * |
|
32136
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
221 | * This is a utility function used to retrieve proxy parameter values from |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
222 | * GNOME 2/3 environment. |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
223 | * |
|
35462
901dfa763f15
Fix some gtk-doc warnings till proxy.c
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
224 | * Returns: The value of requested proxy parameter |
|
32136
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
225 | */ |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
226 | static char * |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
227 | purple_gnome_proxy_get_parameter(guint8 parameter, guint8 gnome_version) |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
228 | { |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
229 | gchar *param, *err; |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
230 | size_t param_len; |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
231 | |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
232 | if (parameter > GNOME_PROXY_HTTP_PASS) |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
233 | return NULL; |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
234 | if (gnome_version > GNOME3_CMDS) |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
235 | return NULL; |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
236 | |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
237 | if (!g_spawn_command_line_sync(gproxycmds[parameter][gnome_version], |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
238 | ¶m, &err, NULL, NULL)) |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
239 | return NULL; |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
240 | g_free(err); |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
241 | |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
242 | g_strstrip(param); |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
243 | if (param[0] == '\'' || param[0] == '\"') { |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
244 | param_len = strlen(param); |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
245 | memmove(param, param + 1, param_len); /* copy last \0 too */ |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
246 | --param_len; |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
247 | if (param_len > 0 && (param[param_len - 1] == '\'' || param[param_len - 1] == '\"')) |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
248 | param[param_len - 1] = '\0'; |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
249 | g_strstrip(param); |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
250 | } |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
251 | |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
252 | return param; |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
253 | } |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
254 | |
| 15884 | 255 | static PurpleProxyInfo * |
| 256 | purple_gnome_proxy_get_info(void) | |
| 11878 | 257 | { |
| 15884 | 258 | static PurpleProxyInfo info = {0, NULL, 0, NULL, NULL}; |
|
24156
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
259 | gboolean use_same_proxy = FALSE; |
|
32136
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
260 | gchar *tmp; |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
261 | guint8 gnome_version = GNOME3_CMDS; |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
262 | |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
263 | tmp = g_find_program_in_path("gsettings"); |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
264 | if (tmp == NULL) { |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
265 | tmp = g_find_program_in_path("gconftool-2"); |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
266 | gnome_version = GNOME2_CMDS; |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
267 | } |
|
22554
dff2ca00b045
Short circuit and return out of the function early if gconftool-2
Mark Doliner <markdoliner@pidgin.im>
parents:
22553
diff
changeset
|
268 | if (tmp == NULL) |
|
dff2ca00b045
Short circuit and return out of the function early if gconftool-2
Mark Doliner <markdoliner@pidgin.im>
parents:
22553
diff
changeset
|
269 | return purple_global_proxy_get_info(); |
|
12156
58a027264d6c
[gaim-migrate @ 14457]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11878
diff
changeset
|
270 | |
|
22554
dff2ca00b045
Short circuit and return out of the function early if gconftool-2
Mark Doliner <markdoliner@pidgin.im>
parents:
22553
diff
changeset
|
271 | g_free(tmp); |
|
12156
58a027264d6c
[gaim-migrate @ 14457]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11878
diff
changeset
|
272 | |
|
22555
04cfb0cf0974
Improve our error handling of Gnome proxy settings.
Mark Doliner <markdoliner@pidgin.im>
parents:
22554
diff
changeset
|
273 | /* Check whether to use a proxy. */ |
|
32136
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
274 | tmp = purple_gnome_proxy_get_parameter(GNOME_PROXY_MODE, gnome_version); |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
275 | if (!tmp) |
|
22554
dff2ca00b045
Short circuit and return out of the function early if gconftool-2
Mark Doliner <markdoliner@pidgin.im>
parents:
22553
diff
changeset
|
276 | return purple_global_proxy_get_info(); |
|
32136
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
277 | |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
278 | if (purple_strequal(tmp, "none")) { |
|
22554
dff2ca00b045
Short circuit and return out of the function early if gconftool-2
Mark Doliner <markdoliner@pidgin.im>
parents:
22553
diff
changeset
|
279 | info.type = PURPLE_PROXY_NONE; |
|
12156
58a027264d6c
[gaim-migrate @ 14457]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11878
diff
changeset
|
280 | g_free(tmp); |
| 11878 | 281 | return &info; |
| 282 | } | |
|
22555
04cfb0cf0974
Improve our error handling of Gnome proxy settings.
Mark Doliner <markdoliner@pidgin.im>
parents:
22554
diff
changeset
|
283 | |
|
32136
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
284 | if (!purple_strequal(tmp, "manual")) { |
|
22555
04cfb0cf0974
Improve our error handling of Gnome proxy settings.
Mark Doliner <markdoliner@pidgin.im>
parents:
22554
diff
changeset
|
285 | /* Unknown setting. Fallback to using our global proxy settings. */ |
|
22554
dff2ca00b045
Short circuit and return out of the function early if gconftool-2
Mark Doliner <markdoliner@pidgin.im>
parents:
22553
diff
changeset
|
286 | g_free(tmp); |
|
dff2ca00b045
Short circuit and return out of the function early if gconftool-2
Mark Doliner <markdoliner@pidgin.im>
parents:
22553
diff
changeset
|
287 | return purple_global_proxy_get_info(); |
|
dff2ca00b045
Short circuit and return out of the function early if gconftool-2
Mark Doliner <markdoliner@pidgin.im>
parents:
22553
diff
changeset
|
288 | } |
|
12156
58a027264d6c
[gaim-migrate @ 14457]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11878
diff
changeset
|
289 | |
|
22554
dff2ca00b045
Short circuit and return out of the function early if gconftool-2
Mark Doliner <markdoliner@pidgin.im>
parents:
22553
diff
changeset
|
290 | g_free(tmp); |
|
22555
04cfb0cf0974
Improve our error handling of Gnome proxy settings.
Mark Doliner <markdoliner@pidgin.im>
parents:
22554
diff
changeset
|
291 | |
|
22560
510c8edb3854
Bring back the lines that free info.whatever on subsequent calls to
Mark Doliner <markdoliner@pidgin.im>
parents:
22559
diff
changeset
|
292 | /* Free the old fields */ |
|
37426
6fd4989b77e4
The last of the NULL-checks before free()
Michael McConville <mmcco@mykolab.com>
parents:
37193
diff
changeset
|
293 | g_free(info.host); |
|
6fd4989b77e4
The last of the NULL-checks before free()
Michael McConville <mmcco@mykolab.com>
parents:
37193
diff
changeset
|
294 | info.host = NULL; |
|
6fd4989b77e4
The last of the NULL-checks before free()
Michael McConville <mmcco@mykolab.com>
parents:
37193
diff
changeset
|
295 | g_free(info.username); |
|
6fd4989b77e4
The last of the NULL-checks before free()
Michael McConville <mmcco@mykolab.com>
parents:
37193
diff
changeset
|
296 | info.username = NULL; |
|
6fd4989b77e4
The last of the NULL-checks before free()
Michael McConville <mmcco@mykolab.com>
parents:
37193
diff
changeset
|
297 | g_free(info.password); |
|
6fd4989b77e4
The last of the NULL-checks before free()
Michael McConville <mmcco@mykolab.com>
parents:
37193
diff
changeset
|
298 | info.password = NULL; |
|
22560
510c8edb3854
Bring back the lines that free info.whatever on subsequent calls to
Mark Doliner <markdoliner@pidgin.im>
parents:
22559
diff
changeset
|
299 | |
|
32136
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
300 | tmp = purple_gnome_proxy_get_parameter(GNOME_PROXY_USE_SAME_PROXY, gnome_version); |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
301 | if (!tmp) |
|
22554
dff2ca00b045
Short circuit and return out of the function early if gconftool-2
Mark Doliner <markdoliner@pidgin.im>
parents:
22553
diff
changeset
|
302 | return purple_global_proxy_get_info(); |
|
32136
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
303 | |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
304 | if (purple_strequal(tmp, "true")) |
|
24156
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
305 | use_same_proxy = TRUE; |
|
32136
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
306 | |
|
24156
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
307 | g_free(tmp); |
|
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
308 | |
|
24315
98e4a5f1d662
Fix a double free. Fixes #7047
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
24298
diff
changeset
|
309 | if (!use_same_proxy) { |
|
32136
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
310 | info.host = purple_gnome_proxy_get_parameter(GNOME_PROXY_SOCKS_HOST, gnome_version); |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
311 | if (!info.host) |
|
24315
98e4a5f1d662
Fix a double free. Fixes #7047
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
24298
diff
changeset
|
312 | return purple_global_proxy_get_info(); |
|
98e4a5f1d662
Fix a double free. Fixes #7047
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
24298
diff
changeset
|
313 | } |
|
24156
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
314 | |
|
24315
98e4a5f1d662
Fix a double free. Fixes #7047
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
24298
diff
changeset
|
315 | if (!use_same_proxy && (info.host != NULL) && (*info.host != '\0')) { |
|
24156
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
316 | info.type = PURPLE_PROXY_SOCKS5; |
|
32136
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
317 | tmp = purple_gnome_proxy_get_parameter(GNOME_PROXY_SOCKS_PORT, gnome_version); |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
318 | if (!tmp) { |
|
24156
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
319 | g_free(info.host); |
|
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
320 | info.host = NULL; |
|
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
321 | return purple_global_proxy_get_info(); |
|
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
322 | } |
|
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
323 | info.port = atoi(tmp); |
|
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
324 | g_free(tmp); |
|
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
325 | } else { |
|
22555
04cfb0cf0974
Improve our error handling of Gnome proxy settings.
Mark Doliner <markdoliner@pidgin.im>
parents:
22554
diff
changeset
|
326 | g_free(info.host); |
|
32136
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
327 | info.host = purple_gnome_proxy_get_parameter(GNOME_PROXY_HTTP_HOST, gnome_version); |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
328 | if (!info.host) |
|
24156
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
329 | return purple_global_proxy_get_info(); |
|
24316
88c65c05a21e
Some minor cleanup; removal of unnecessary frees and setting stuff to NULL
Daniel Atallah <datallah@pidgin.im>
parents:
24315
diff
changeset
|
330 | |
|
24156
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
331 | /* If we get this far then we know we're using an HTTP proxy */ |
|
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
332 | info.type = PURPLE_PROXY_HTTP; |
| 11878 | 333 | |
|
24156
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
334 | if (*info.host == '\0') |
|
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
335 | { |
|
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
336 | purple_debug_info("proxy", "Gnome proxy settings are set to " |
|
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
337 | "'manual' but no suitable proxy server is specified. Using " |
|
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
338 | "Pidgin's proxy settings instead.\n"); |
|
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
339 | g_free(info.host); |
|
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
340 | info.host = NULL; |
|
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
341 | return purple_global_proxy_get_info(); |
|
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
342 | } |
|
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
343 | |
|
32136
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
344 | info.username = purple_gnome_proxy_get_parameter(GNOME_PROXY_HTTP_USER, gnome_version); |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
345 | if (!info.username) |
|
24156
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
346 | { |
|
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
347 | g_free(info.host); |
|
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
348 | info.host = NULL; |
|
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
349 | return purple_global_proxy_get_info(); |
|
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
350 | } |
|
32136
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
351 | |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
352 | info.password = purple_gnome_proxy_get_parameter(GNOME_PROXY_HTTP_PASS, gnome_version); |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
353 | if (!info.password) |
|
24156
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
354 | { |
|
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
355 | g_free(info.host); |
|
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
356 | info.host = NULL; |
|
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
357 | g_free(info.username); |
|
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
358 | info.username = NULL; |
|
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
359 | return purple_global_proxy_get_info(); |
|
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
360 | } |
|
32136
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
361 | |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
362 | tmp = purple_gnome_proxy_get_parameter(GNOME_PROXY_HTTP_PORT, gnome_version); |
|
98a6cc751323
Add support for reading GNOME3 proxy settings.
Mihai Serban <mihai.serban@gmail.com>
parents:
32129
diff
changeset
|
363 | if (!tmp) |
|
24156
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
364 | { |
|
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
365 | g_free(info.host); |
|
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
366 | info.host = NULL; |
|
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
367 | g_free(info.username); |
|
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
368 | info.username = NULL; |
|
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
369 | g_free(info.password); |
|
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
370 | info.password = NULL; |
|
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
371 | return purple_global_proxy_get_info(); |
|
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
372 | } |
|
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
373 | info.port = atoi(tmp); |
|
6c7631ae7571
Use SOCKS proxy if specified when running in GNOME
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
23532
diff
changeset
|
374 | g_free(tmp); |
|
22555
04cfb0cf0974
Improve our error handling of Gnome proxy settings.
Mark Doliner <markdoliner@pidgin.im>
parents:
22554
diff
changeset
|
375 | } |
| 11878 | 376 | |
|
22554
dff2ca00b045
Short circuit and return out of the function early if gconftool-2
Mark Doliner <markdoliner@pidgin.im>
parents:
22553
diff
changeset
|
377 | return &info; |
| 11878 | 378 | } |
|
24171
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
379 | |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
380 | #ifdef _WIN32 |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
381 | |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
382 | typedef BOOL (CALLBACK* LPFNWINHTTPGETIEPROXYCONFIG)(/*IN OUT*/ WINHTTP_CURRENT_USER_IE_PROXY_CONFIG* pProxyConfig); |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
383 | |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
384 | /* This modifies "host" in-place evilly */ |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
385 | static void |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
386 | _proxy_fill_hostinfo(PurpleProxyInfo *info, char *host, int default_port) |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
387 | { |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
388 | int port = default_port; |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
389 | char *d; |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
390 | |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
391 | d = g_strrstr(host, ":"); |
|
30057
ab9790d588f9
Fix an invalid memory deref with Windows proxy settings when there's no ":port"
Marten Klencke <mklencke@gmx.net>
parents:
29365
diff
changeset
|
392 | if (d) { |
|
24171
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
393 | *d = '\0'; |
|
30057
ab9790d588f9
Fix an invalid memory deref with Windows proxy settings when there's no ":port"
Marten Klencke <mklencke@gmx.net>
parents:
29365
diff
changeset
|
394 | |
|
ab9790d588f9
Fix an invalid memory deref with Windows proxy settings when there's no ":port"
Marten Klencke <mklencke@gmx.net>
parents:
29365
diff
changeset
|
395 | d++; |
|
ab9790d588f9
Fix an invalid memory deref with Windows proxy settings when there's no ":port"
Marten Klencke <mklencke@gmx.net>
parents:
29365
diff
changeset
|
396 | if (*d) |
|
ab9790d588f9
Fix an invalid memory deref with Windows proxy settings when there's no ":port"
Marten Klencke <mklencke@gmx.net>
parents:
29365
diff
changeset
|
397 | sscanf(d, "%d", &port); |
|
ab9790d588f9
Fix an invalid memory deref with Windows proxy settings when there's no ":port"
Marten Klencke <mklencke@gmx.net>
parents:
29365
diff
changeset
|
398 | |
|
ab9790d588f9
Fix an invalid memory deref with Windows proxy settings when there's no ":port"
Marten Klencke <mklencke@gmx.net>
parents:
29365
diff
changeset
|
399 | if (port == 0) |
|
ab9790d588f9
Fix an invalid memory deref with Windows proxy settings when there's no ":port"
Marten Klencke <mklencke@gmx.net>
parents:
29365
diff
changeset
|
400 | port = default_port; |
|
ab9790d588f9
Fix an invalid memory deref with Windows proxy settings when there's no ":port"
Marten Klencke <mklencke@gmx.net>
parents:
29365
diff
changeset
|
401 | } |
|
24171
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
402 | |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
403 | purple_proxy_info_set_host(info, host); |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
404 | purple_proxy_info_set_port(info, port); |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
405 | } |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
406 | |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
407 | static PurpleProxyInfo * |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
408 | purple_win32_proxy_get_info(void) |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
409 | { |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
410 | static LPFNWINHTTPGETIEPROXYCONFIG MyWinHttpGetIEProxyConfig = NULL; |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
411 | static gboolean loaded = FALSE; |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
412 | static PurpleProxyInfo info = {0, NULL, 0, NULL, NULL}; |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
413 | |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
414 | WINHTTP_CURRENT_USER_IE_PROXY_CONFIG ie_proxy_config; |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
415 | |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
416 | if (!loaded) { |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
417 | loaded = TRUE; |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
418 | MyWinHttpGetIEProxyConfig = (LPFNWINHTTPGETIEPROXYCONFIG) |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
419 | wpurple_find_and_loadproc("winhttp.dll", "WinHttpGetIEProxyConfigForCurrentUser"); |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
420 | if (!MyWinHttpGetIEProxyConfig) |
|
27497
2dc5a0e0c4c2
Increase the logging level of some debugging messages that seemed to be a
Mauro Brasil <mauro.brasil@tqi.com.br>
parents:
27249
diff
changeset
|
421 | purple_debug_warning("proxy", "Unable to read Windows Proxy Settings.\n"); |
|
24171
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
422 | } |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
423 | |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
424 | if (!MyWinHttpGetIEProxyConfig) |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
425 | return NULL; |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
426 | |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
427 | ZeroMemory(&ie_proxy_config, sizeof(ie_proxy_config)); |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
428 | if (!MyWinHttpGetIEProxyConfig(&ie_proxy_config)) { |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
429 | purple_debug_error("proxy", "Error reading Windows Proxy Settings(%lu).\n", GetLastError()); |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
430 | return NULL; |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
431 | } |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
432 | |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
433 | /* We can't do much if it is autodetect*/ |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
434 | if (ie_proxy_config.fAutoDetect) { |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
435 | purple_debug_error("proxy", "Windows Proxy Settings set to autodetect (not supported).\n"); |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
436 | |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
437 | /* TODO: For 3.0.0 we'll revisit this (maybe)*/ |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
438 | |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
439 | return NULL; |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
440 | |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
441 | } else if (ie_proxy_config.lpszProxy) { |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
442 | gchar *proxy_list = g_utf16_to_utf8(ie_proxy_config.lpszProxy, -1, |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
443 | NULL, NULL, NULL); |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
444 | |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
445 | /* We can't do anything about the bypass list, as we don't have the url */ |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
446 | /* TODO: For 3.0.0 we'll revisit this*/ |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
447 | |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
448 | /* There are proxy settings for several protocols */ |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
449 | if (proxy_list && *proxy_list) { |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
450 | char *specific = NULL, *tmp; |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
451 | |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
452 | /* If there is only a global proxy, which means "HTTP" */ |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
453 | if (!strchr(proxy_list, ';') || (specific = g_strstr_len(proxy_list, -1, "http=")) != NULL) { |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
454 | |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
455 | if (specific) { |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
456 | specific += strlen("http="); |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
457 | tmp = strchr(specific, ';'); |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
458 | if (tmp) |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
459 | *tmp = '\0'; |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
460 | /* specific now points the proxy server (and port) */ |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
461 | } else |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
462 | specific = proxy_list; |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
463 | |
|
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
|
464 | purple_proxy_info_set_proxy_type(&info, PURPLE_PROXY_HTTP); |
|
24171
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
465 | _proxy_fill_hostinfo(&info, specific, 80); |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
466 | /* TODO: is there a way to set the username/password? */ |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
467 | purple_proxy_info_set_username(&info, NULL); |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
468 | purple_proxy_info_set_password(&info, NULL); |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
469 | |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
470 | purple_debug_info("proxy", "Windows Proxy Settings: HTTP proxy: '%s:%d'.\n", |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
471 | purple_proxy_info_get_host(&info), |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
472 | purple_proxy_info_get_port(&info)); |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
473 | |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
474 | } else if ((specific = g_strstr_len(proxy_list, -1, "socks=")) != NULL) { |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
475 | |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
476 | specific += strlen("socks="); |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
477 | tmp = strchr(specific, ';'); |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
478 | if (tmp) |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
479 | *tmp = '\0'; |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
480 | /* specific now points the proxy server (and port) */ |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
481 | |
|
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
|
482 | purple_proxy_info_set_proxy_type(&info, PURPLE_PROXY_SOCKS5); |
|
24171
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
483 | _proxy_fill_hostinfo(&info, specific, 1080); |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
484 | /* TODO: is there a way to set the username/password? */ |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
485 | purple_proxy_info_set_username(&info, NULL); |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
486 | purple_proxy_info_set_password(&info, NULL); |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
487 | |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
488 | purple_debug_info("proxy", "Windows Proxy Settings: SOCKS5 proxy: '%s:%d'.\n", |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
489 | purple_proxy_info_get_host(&info), |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
490 | purple_proxy_info_get_port(&info)); |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
491 | |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
492 | } else { |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
493 | |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
494 | purple_debug_info("proxy", "Windows Proxy Settings: No supported proxy specified.\n"); |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
495 | |
|
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
|
496 | purple_proxy_info_set_proxy_type(&info, PURPLE_PROXY_NONE); |
|
24171
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
497 | |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
498 | } |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
499 | } |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
500 | |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
501 | /* TODO: Fix API to be able look at proxy bypass settings */ |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
502 | |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
503 | g_free(proxy_list); |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
504 | } else { |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
505 | purple_debug_info("proxy", "No Windows proxy set.\n"); |
|
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
|
506 | purple_proxy_info_set_proxy_type(&info, PURPLE_PROXY_NONE); |
|
24171
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
507 | } |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
508 | |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
509 | if (ie_proxy_config.lpszAutoConfigUrl) |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
510 | GlobalFree(ie_proxy_config.lpszAutoConfigUrl); |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
511 | if (ie_proxy_config.lpszProxy) |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
512 | GlobalFree(ie_proxy_config.lpszProxy); |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
513 | if (ie_proxy_config.lpszProxyBypass) |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
514 | GlobalFree(ie_proxy_config.lpszProxyBypass); |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
515 | |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
516 | return &info; |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
517 | } |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
518 | #endif |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
519 | |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
520 | |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
521 | /************************************************************************** |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
522 | * Proxy API |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
523 | **************************************************************************/ |
|
4366
d2b52a5ff6fc
[gaim-migrate @ 4632]
Nicolás Lichtmaier <nico@lichtmaier.com.ar>
parents:
3867
diff
changeset
|
524 | |
| 15884 | 525 | PurpleProxyInfo * |
| 526 | purple_proxy_get_setup(PurpleAccount *account) | |
|
1087
bc9c6b635358
[gaim-migrate @ 1097]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1057
diff
changeset
|
527 | { |
| 15884 | 528 | PurpleProxyInfo *gpi = NULL; |
|
6621
2a18ef3e5224
[gaim-migrate @ 7145]
Robert McQueen <robot101@debian.org>
parents:
6320
diff
changeset
|
529 | const gchar *tmp; |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
530 | |
|
15032
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15015
diff
changeset
|
531 | /* This is used as a fallback so we don't overwrite the selected proxy type */ |
| 15884 | 532 | static PurpleProxyInfo *tmp_none_proxy_info = NULL; |
|
15032
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15015
diff
changeset
|
533 | if (!tmp_none_proxy_info) { |
| 15884 | 534 | tmp_none_proxy_info = purple_proxy_info_new(); |
|
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
|
535 | purple_proxy_info_set_proxy_type(tmp_none_proxy_info, PURPLE_PROXY_NONE); |
|
15032
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15015
diff
changeset
|
536 | } |
|
65a111aba7a8
[gaim-migrate @ 17749]
Daniel Atallah <datallah@pidgin.im>
parents:
15015
diff
changeset
|
537 | |
| 15884 | 538 | if (account && purple_account_get_proxy_info(account) != NULL) { |
| 539 | gpi = purple_account_get_proxy_info(account); | |
|
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
|
540 | if (purple_proxy_info_get_proxy_type(gpi) == PURPLE_PROXY_USE_GLOBAL) |
|
15041
18a6f6cdce33
[gaim-migrate @ 17758]
Daniel Atallah <datallah@pidgin.im>
parents:
15032
diff
changeset
|
541 | gpi = NULL; |
|
18a6f6cdce33
[gaim-migrate @ 17758]
Daniel Atallah <datallah@pidgin.im>
parents:
15032
diff
changeset
|
542 | } |
|
18a6f6cdce33
[gaim-migrate @ 17758]
Daniel Atallah <datallah@pidgin.im>
parents:
15032
diff
changeset
|
543 | if (gpi == NULL) { |
| 15884 | 544 | if (purple_running_gnome()) |
| 545 | gpi = purple_gnome_proxy_get_info(); | |
|
15041
18a6f6cdce33
[gaim-migrate @ 17758]
Daniel Atallah <datallah@pidgin.im>
parents:
15032
diff
changeset
|
546 | else |
| 15884 | 547 | gpi = purple_global_proxy_get_info(); |
|
15041
18a6f6cdce33
[gaim-migrate @ 17758]
Daniel Atallah <datallah@pidgin.im>
parents:
15032
diff
changeset
|
548 | } |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
549 | |
|
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
|
550 | if (purple_proxy_info_get_proxy_type(gpi) == PURPLE_PROXY_USE_ENVVAR) { |
|
6621
2a18ef3e5224
[gaim-migrate @ 7145]
Robert McQueen <robot101@debian.org>
parents:
6320
diff
changeset
|
551 | if ((tmp = g_getenv("HTTP_PROXY")) != NULL || |
|
2a18ef3e5224
[gaim-migrate @ 7145]
Robert McQueen <robot101@debian.org>
parents:
6320
diff
changeset
|
552 | (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
|
553 | (tmp = g_getenv("HTTPPROXY")) != NULL) |
|
eee308def583
HTTP: get rid of purple_url_parse
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34218
diff
changeset
|
554 | { |
|
41211
2e804c9c0919
Switch SoupURI to GUri
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41157
diff
changeset
|
555 | gchar *scheme, *host, *username, *password; |
|
2e804c9c0919
Switch SoupURI to GUri
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41157
diff
changeset
|
556 | gint port; |
|
2e804c9c0919
Switch SoupURI to GUri
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41157
diff
changeset
|
557 | GError *error = NULL; |
|
6621
2a18ef3e5224
[gaim-migrate @ 7145]
Robert McQueen <robot101@debian.org>
parents:
6320
diff
changeset
|
558 | |
| 9129 | 559 | /* http_proxy-format: |
| 9227 | 560 | * 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
|
561 | */ |
|
41211
2e804c9c0919
Switch SoupURI to GUri
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41157
diff
changeset
|
562 | 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
|
563 | &username, &password, NULL, |
|
2e804c9c0919
Switch SoupURI to GUri
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41157
diff
changeset
|
564 | &host, &port, NULL, NULL, NULL, &error)) |
|
2e804c9c0919
Switch SoupURI to GUri
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41157
diff
changeset
|
565 | { |
|
2e804c9c0919
Switch SoupURI to GUri
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41157
diff
changeset
|
566 | 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
|
567 | g_error_free(error); |
|
2e804c9c0919
Switch SoupURI to GUri
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41157
diff
changeset
|
568 | return gpi; |
|
2e804c9c0919
Switch SoupURI to GUri
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41157
diff
changeset
|
569 | } |
|
2e804c9c0919
Switch SoupURI to GUri
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41157
diff
changeset
|
570 | 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
|
571 | 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
|
572 | g_free(username); |
|
2e804c9c0919
Switch SoupURI to GUri
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41157
diff
changeset
|
573 | g_free(password); |
|
2e804c9c0919
Switch SoupURI to GUri
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41157
diff
changeset
|
574 | g_free(host); |
|
34219
eee308def583
HTTP: get rid of purple_url_parse
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34218
diff
changeset
|
575 | return gpi; |
|
7652
d60ba2565661
[gaim-migrate @ 8296]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
7475
diff
changeset
|
576 | } |
|
34219
eee308def583
HTTP: get rid of purple_url_parse
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34218
diff
changeset
|
577 | |
|
41211
2e804c9c0919
Switch SoupURI to GUri
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41157
diff
changeset
|
578 | purple_proxy_info_set_host(gpi, host); |
|
2e804c9c0919
Switch SoupURI to GUri
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41157
diff
changeset
|
579 | purple_proxy_info_set_username(gpi, username); |
|
2e804c9c0919
Switch SoupURI to GUri
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41157
diff
changeset
|
580 | purple_proxy_info_set_password(gpi, password); |
|
2e804c9c0919
Switch SoupURI to GUri
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41157
diff
changeset
|
581 | purple_proxy_info_set_port(gpi, port); |
|
39990
7fb53d5427a8
Use SoupURI to parse proxy environment variables.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39659
diff
changeset
|
582 | |
|
41211
2e804c9c0919
Switch SoupURI to GUri
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41157
diff
changeset
|
583 | g_free(host); |
|
2e804c9c0919
Switch SoupURI to GUri
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41157
diff
changeset
|
584 | g_free(username); |
|
2e804c9c0919
Switch SoupURI to GUri
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41157
diff
changeset
|
585 | g_free(password); |
|
34219
eee308def583
HTTP: get rid of purple_url_parse
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34218
diff
changeset
|
586 | |
|
eee308def583
HTTP: get rid of purple_url_parse
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34218
diff
changeset
|
587 | /* 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
|
588 | 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
|
589 | (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
|
590 | (tmp = g_getenv("HTTPPROXYUSER")) != NULL) |
|
eee308def583
HTTP: get rid of purple_url_parse
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34218
diff
changeset
|
591 | 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
|
592 | |
|
eee308def583
HTTP: get rid of purple_url_parse
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34218
diff
changeset
|
593 | 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
|
594 | (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
|
595 | (tmp = g_getenv("HTTPPROXYPASS")) != NULL) |
|
eee308def583
HTTP: get rid of purple_url_parse
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34218
diff
changeset
|
596 | 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
|
597 | |
|
eee308def583
HTTP: get rid of purple_url_parse
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34218
diff
changeset
|
598 | 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
|
599 | (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
|
600 | (tmp = g_getenv("HTTPPROXYPORT")) != NULL) |
|
eee308def583
HTTP: get rid of purple_url_parse
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34218
diff
changeset
|
601 | purple_proxy_info_set_port(gpi, atoi(tmp)); |
|
10534
c28eef1b882a
[gaim-migrate @ 11866]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10320
diff
changeset
|
602 | } else { |
|
24171
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
603 | #ifdef _WIN32 |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
604 | PurpleProxyInfo *wgpi; |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
605 | if ((wgpi = purple_win32_proxy_get_info()) != NULL) |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
606 | return wgpi; |
|
d976cc3db118
Add support for reading SOCKS proxy information from the Windows proxy settings.
Daniel Atallah <datallah@pidgin.im>
parents:
24156
diff
changeset
|
607 | #endif |
|
10534
c28eef1b882a
[gaim-migrate @ 11866]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10320
diff
changeset
|
608 | /* no proxy environment variable found, don't use a proxy */ |
| 15884 | 609 | 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
|
610 | gpi = tmp_none_proxy_info; |
|
6621
2a18ef3e5224
[gaim-migrate @ 7145]
Robert McQueen <robot101@debian.org>
parents:
6320
diff
changeset
|
611 | } |
|
2a18ef3e5224
[gaim-migrate @ 7145]
Robert McQueen <robot101@debian.org>
parents:
6320
diff
changeset
|
612 | |
|
2a18ef3e5224
[gaim-migrate @ 7145]
Robert McQueen <robot101@debian.org>
parents:
6320
diff
changeset
|
613 | } |
|
2a18ef3e5224
[gaim-migrate @ 7145]
Robert McQueen <robot101@debian.org>
parents:
6320
diff
changeset
|
614 | |
| 13515 | 615 | return gpi; |
| 616 | } | |
| 617 | ||
|
37532
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
618 | GProxyResolver * |
|
37965
b67fb3fb5f85
proxy: Add GError argument to purple_proxy_get_proxy_resolver()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37964
diff
changeset
|
619 | 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
|
620 | { |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
621 | 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
|
622 | const gchar *protocol; |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
623 | const gchar *username; |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
624 | const gchar *password; |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
625 | gchar *auth; |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
626 | gchar *proxy; |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
627 | GProxyResolver *resolver; |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
628 | |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
629 | if (purple_proxy_info_get_proxy_type(info) == PURPLE_PROXY_NONE) { |
|
37942
33f8691a69df
proxy: don't use default resolver if direct connection is wanted
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37939
diff
changeset
|
630 | /* 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
|
631 | * connection. */ |
|
33f8691a69df
proxy: don't use default resolver if direct connection is wanted
Jakub Adam <jakub.adam@ktknet.cz>
parents:
37939
diff
changeset
|
632 | 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
|
633 | } |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
634 | |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
635 | 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
|
636 | { |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
637 | /* 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
|
638 | |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
639 | case PURPLE_PROXY_USE_ENVVAR: |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
640 | /* Intentional passthrough */ |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
641 | case PURPLE_PROXY_HTTP: |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
642 | protocol = "http"; |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
643 | break; |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
644 | case PURPLE_PROXY_SOCKS4: |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
645 | protocol = "socks4"; |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
646 | break; |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
647 | case PURPLE_PROXY_SOCKS5: |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
648 | /* Intentional passthrough */ |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
649 | case PURPLE_PROXY_TOR: |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
650 | protocol = "socks5"; |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
651 | break; |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
652 | |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
653 | default: |
|
37965
b67fb3fb5f85
proxy: Add GError argument to purple_proxy_get_proxy_resolver()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37964
diff
changeset
|
654 | 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
|
655 | 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
|
656 | _("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
|
657 | 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
|
658 | return NULL; |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
659 | } |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
660 | |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
661 | |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
662 | if (purple_proxy_info_get_host(info) == NULL || |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
663 | 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
|
664 | 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
|
665 | 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
|
666 | _("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
|
667 | "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
|
668 | "invalid.")); |
|
37532
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
669 | return NULL; |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
670 | } |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
671 | |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
672 | /* 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
|
673 | |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
674 | 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
|
675 | 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
|
676 | |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
677 | /* Username and password are optional */ |
|
41157
f223b69f7da2
Fix some bugs with proxies for xmpp
Gary Kramlich <grim@reaperworld.com>
parents:
40654
diff
changeset
|
678 | if(username != NULL && *username != '\0') { |
|
f223b69f7da2
Fix some bugs with proxies for xmpp
Gary Kramlich <grim@reaperworld.com>
parents:
40654
diff
changeset
|
679 | if(password != NULL && *password != '\0') { |
|
f223b69f7da2
Fix some bugs with proxies for xmpp
Gary Kramlich <grim@reaperworld.com>
parents:
40654
diff
changeset
|
680 | 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
|
681 | } else { |
|
f223b69f7da2
Fix some bugs with proxies for xmpp
Gary Kramlich <grim@reaperworld.com>
parents:
40654
diff
changeset
|
682 | auth = g_strdup_printf("%s@", username); |
|
f223b69f7da2
Fix some bugs with proxies for xmpp
Gary Kramlich <grim@reaperworld.com>
parents:
40654
diff
changeset
|
683 | } |
|
37532
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
684 | } else { |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
685 | auth = NULL; |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
686 | } |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
687 | |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
688 | 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
|
689 | auth != NULL ? auth : "", |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
690 | purple_proxy_info_get_host(info), |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
691 | 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
|
692 | g_free(auth); |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
693 | |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
694 | 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
|
695 | g_free(proxy); |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
696 | |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
697 | return resolver; |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
698 | } |
|
5aaf2d93e7e3
Implement function to get a GProxyResolver with an account's settings
Mike Ruprecht <cmaiku@gmail.com>
parents:
37518
diff
changeset
|
699 | |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
700 | static void |
| 15884 | 701 | proxy_pref_cb(const char *name, PurplePrefType type, |
|
12816
5f93e09fa9a6
[gaim-migrate @ 15164]
Mark Doliner <markdoliner@pidgin.im>
parents:
12811
diff
changeset
|
702 | gconstpointer value, gpointer data) |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
703 | { |
| 15884 | 704 | PurpleProxyInfo *info = purple_global_proxy_get_info(); |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
705 | |
|
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
|
706 | if (purple_strequal(name, "/purple/proxy/type")) { |
|
6001
1abbeff6571c
[gaim-migrate @ 6449]
Mark Doliner <markdoliner@pidgin.im>
parents:
5970
diff
changeset
|
707 | int proxytype; |
|
12816
5f93e09fa9a6
[gaim-migrate @ 15164]
Mark Doliner <markdoliner@pidgin.im>
parents:
12811
diff
changeset
|
708 | const char *type = value; |
|
6001
1abbeff6571c
[gaim-migrate @ 6449]
Mark Doliner <markdoliner@pidgin.im>
parents:
5970
diff
changeset
|
709 | |
|
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
|
710 | if (purple_strequal(type, "none")) |
| 15884 | 711 | proxytype = PURPLE_PROXY_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
|
712 | else if (purple_strequal(type, "http")) |
| 15884 | 713 | proxytype = PURPLE_PROXY_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
|
714 | else if (purple_strequal(type, "socks4")) |
| 15884 | 715 | proxytype = PURPLE_PROXY_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
|
716 | else if (purple_strequal(type, "socks5")) |
| 15884 | 717 | proxytype = PURPLE_PROXY_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
|
718 | else if (purple_strequal(type, "tor")) |
|
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
|
719 | proxytype = PURPLE_PROXY_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
|
720 | else if (purple_strequal(type, "envvar")) |
| 15884 | 721 | proxytype = PURPLE_PROXY_USE_ENVVAR; |
|
6001
1abbeff6571c
[gaim-migrate @ 6449]
Mark Doliner <markdoliner@pidgin.im>
parents:
5970
diff
changeset
|
722 | else |
|
1abbeff6571c
[gaim-migrate @ 6449]
Mark Doliner <markdoliner@pidgin.im>
parents:
5970
diff
changeset
|
723 | proxytype = -1; |
|
1abbeff6571c
[gaim-migrate @ 6449]
Mark Doliner <markdoliner@pidgin.im>
parents:
5970
diff
changeset
|
724 | |
|
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
|
725 | 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
|
726 | } else if (purple_strequal(name, "/purple/proxy/host")) |
| 15884 | 727 | purple_proxy_info_set_host(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
|
728 | else if (purple_strequal(name, "/purple/proxy/port")) |
| 15884 | 729 | 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
|
730 | else if (purple_strequal(name, "/purple/proxy/username")) |
| 15884 | 731 | 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
|
732 | else if (purple_strequal(name, "/purple/proxy/password")) |
| 15884 | 733 | purple_proxy_info_set_password(info, value); |
|
1087
bc9c6b635358
[gaim-migrate @ 1097]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
1057
diff
changeset
|
734 | } |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
735 | |
|
14151
34427f138b1f
[gaim-migrate @ 16712]
Mark Doliner <markdoliner@pidgin.im>
parents:
14097
diff
changeset
|
736 | void * |
| 15884 | 737 | purple_proxy_get_handle() |
|
14151
34427f138b1f
[gaim-migrate @ 16712]
Mark Doliner <markdoliner@pidgin.im>
parents:
14097
diff
changeset
|
738 | { |
|
34427f138b1f
[gaim-migrate @ 16712]
Mark Doliner <markdoliner@pidgin.im>
parents:
14097
diff
changeset
|
739 | static int handle; |
|
34427f138b1f
[gaim-migrate @ 16712]
Mark Doliner <markdoliner@pidgin.im>
parents:
14097
diff
changeset
|
740 | |
|
34427f138b1f
[gaim-migrate @ 16712]
Mark Doliner <markdoliner@pidgin.im>
parents:
14097
diff
changeset
|
741 | return &handle; |
|
34427f138b1f
[gaim-migrate @ 16712]
Mark Doliner <markdoliner@pidgin.im>
parents:
14097
diff
changeset
|
742 | } |
|
34427f138b1f
[gaim-migrate @ 16712]
Mark Doliner <markdoliner@pidgin.im>
parents:
14097
diff
changeset
|
743 | |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
744 | void |
| 15884 | 745 | purple_proxy_init(void) |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
746 | { |
|
10087
e5b80a38939d
[gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9863
diff
changeset
|
747 | void *handle; |
|
e5b80a38939d
[gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9863
diff
changeset
|
748 | |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
749 | /* Initialize a default proxy info struct. */ |
| 15884 | 750 | global_proxy_info = purple_proxy_info_new(); |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
751 | |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
752 | /* 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
|
753 | 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
|
754 | 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
|
755 | 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
|
756 | 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
|
757 | 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
|
758 | 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
|
759 | purple_prefs_add_bool("/purple/proxy/socks4_remotedns", FALSE); |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
760 | |
|
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
761 | /* Setup callbacks for the preferences. */ |
| 15884 | 762 | 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
|
763 | 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
|
764 | 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
|
765 | 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
|
766 | 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
|
767 | 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
|
768 | 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
|
769 | purple_prefs_connect_callback(handle, "/purple/proxy/username", |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13085
diff
changeset
|
770 | 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
|
771 | purple_prefs_connect_callback(handle, "/purple/proxy/password", |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13085
diff
changeset
|
772 | proxy_pref_cb, NULL); |
|
20053
68ce40196f8a
grab revision 6be36979d022284283217c2a32f2b812740cbbf3
Luke Schierer <lschiere@pidgin.im>
parents:
19985
diff
changeset
|
773 | |
|
68ce40196f8a
grab revision 6be36979d022284283217c2a32f2b812740cbbf3
Luke Schierer <lschiere@pidgin.im>
parents:
19985
diff
changeset
|
774 | /* Load the initial proxy settings */ |
|
20055
ca7144d5605f
grab revision 240d37f3b465527200f862ff3c0da77618ae32ae
Luke Schierer <lschiere@pidgin.im>
parents:
20053
diff
changeset
|
775 | purple_prefs_trigger_callback("/purple/proxy/type"); |
|
ca7144d5605f
grab revision 240d37f3b465527200f862ff3c0da77618ae32ae
Luke Schierer <lschiere@pidgin.im>
parents:
20053
diff
changeset
|
776 | purple_prefs_trigger_callback("/purple/proxy/host"); |
|
ca7144d5605f
grab revision 240d37f3b465527200f862ff3c0da77618ae32ae
Luke Schierer <lschiere@pidgin.im>
parents:
20053
diff
changeset
|
777 | purple_prefs_trigger_callback("/purple/proxy/port"); |
|
ca7144d5605f
grab revision 240d37f3b465527200f862ff3c0da77618ae32ae
Luke Schierer <lschiere@pidgin.im>
parents:
20053
diff
changeset
|
778 | purple_prefs_trigger_callback("/purple/proxy/username"); |
|
ca7144d5605f
grab revision 240d37f3b465527200f862ff3c0da77618ae32ae
Luke Schierer <lschiere@pidgin.im>
parents:
20053
diff
changeset
|
779 | purple_prefs_trigger_callback("/purple/proxy/password"); |
|
5681
514fbc5374dc
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
780 | } |
|
10087
e5b80a38939d
[gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9863
diff
changeset
|
781 | |
|
14151
34427f138b1f
[gaim-migrate @ 16712]
Mark Doliner <markdoliner@pidgin.im>
parents:
14097
diff
changeset
|
782 | void |
| 15884 | 783 | purple_proxy_uninit(void) |
|
10087
e5b80a38939d
[gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9863
diff
changeset
|
784 | { |
|
28177
e62fe687ca6c
Clean up various file-scoped globals at uninit.
Paul Aurich <darkrain42@pidgin.im>
parents:
27943
diff
changeset
|
785 | 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
|
786 | |
|
e62fe687ca6c
Clean up various file-scoped globals at uninit.
Paul Aurich <darkrain42@pidgin.im>
parents:
27943
diff
changeset
|
787 | purple_proxy_info_destroy(global_proxy_info); |
|
e62fe687ca6c
Clean up various file-scoped globals at uninit.
Paul Aurich <darkrain42@pidgin.im>
parents:
27943
diff
changeset
|
788 | global_proxy_info = NULL; |
|
10087
e5b80a38939d
[gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9863
diff
changeset
|
789 | } |