Fri, 10 Mar 2023 16:37:41 -0600
Make PurpleRequestFieldChoice into a GObject
This also does an `hg cp`, though with all the renaming of the parameter names, maybe that wasn't as useful for tracking the diff.
I wonder if this should implement `GListModel`, but the values are currently arbitrary pointers, so it won't work right now.
Testing Done:
Compiled and opened Request Fields from Demo protocol.
Reviewed at https://reviews.imfreedom.org/r/2335/
|
20147
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
1 | /* purple |
| 8231 | 2 | * |
| 15884 | 3 | * Purple is the legal property of its developers, whose names are too numerous |
| 8231 | 4 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 5 | * source distribution. | |
| 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:
19832
diff
changeset
|
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 8231 | 20 | */ |
| 21 | ||
|
8245
c1397ca0a619
[gaim-migrate @ 8968]
Herman Bloggs <herman@bluedigits.com>
parents:
8240
diff
changeset
|
22 | #include "internal.h" |
|
40439
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40264
diff
changeset
|
23 | #include "purpleprivate.h" |
| 8231 | 24 | |
|
37450
703722d83214
Update network.c for the dns code removal
Gary Kramlich <grim@reaperworld.com>
parents:
36031
diff
changeset
|
25 | #include <gio/gio.h> |
|
703722d83214
Update network.c for the dns code removal
Gary Kramlich <grim@reaperworld.com>
parents:
36031
diff
changeset
|
26 | |
|
41682
289867067994
Clean up a bunch of stuff in internal.h
Gary Kramlich <grim@reaperworld.com>
parents:
41153
diff
changeset
|
27 | #include <fcntl.h> |
|
289867067994
Clean up a bunch of stuff in internal.h
Gary Kramlich <grim@reaperworld.com>
parents:
41153
diff
changeset
|
28 | |
|
13156
539a637c61dc
[gaim-migrate @ 15518]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
13131
diff
changeset
|
29 | #ifndef _WIN32 |
|
23352
9714223ca7a7
A patch from Peter O'Gorman at The Written Word, Inc. to fix various
Peter O'Gorman <pogma@thewrittenword.com>
parents:
23185
diff
changeset
|
30 | #include <arpa/nameser.h> |
| 14864 | 31 | #include <resolv.h> |
| 32 | #include <netinet/in.h> | |
|
13156
539a637c61dc
[gaim-migrate @ 15518]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
13131
diff
changeset
|
33 | #include <net/if.h> |
|
14784
3a82321f46f2
[gaim-migrate @ 17476]
Daniel Atallah <datallah@pidgin.im>
parents:
14758
diff
changeset
|
34 | #else |
|
3a82321f46f2
[gaim-migrate @ 17476]
Daniel Atallah <datallah@pidgin.im>
parents:
14758
diff
changeset
|
35 | #include <nspapi.h> |
|
13156
539a637c61dc
[gaim-migrate @ 15518]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
13131
diff
changeset
|
36 | #endif |
|
539a637c61dc
[gaim-migrate @ 15518]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
13131
diff
changeset
|
37 | |
|
539a637c61dc
[gaim-migrate @ 15518]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
13131
diff
changeset
|
38 | /* Solaris */ |
|
539a637c61dc
[gaim-migrate @ 15518]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
13131
diff
changeset
|
39 | #if defined (__SVR4) && defined (__sun) |
|
539a637c61dc
[gaim-migrate @ 15518]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
13131
diff
changeset
|
40 | #include <sys/sockio.h> |
|
539a637c61dc
[gaim-migrate @ 15518]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
13131
diff
changeset
|
41 | #endif |
|
539a637c61dc
[gaim-migrate @ 15518]
Thomas Butter <tbutter@users.sourceforge.net>
parents:
13131
diff
changeset
|
42 | |
| 8231 | 43 | #include "debug.h" |
| 44 | #include "account.h" | |
| 45 | #include "network.h" | |
| 46 | #include "prefs.h" | |
| 47 | ||
|
37488
88afe246144e
First stab at replacing network-manager with gio, this probably breaks win32, need to test and see
Gary Kramlich <grim@reaperworld.com>
parents:
37466
diff
changeset
|
48 | static gboolean force_online = FALSE; |
|
24999
84d597b7e7c6
Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@pidgin.im>
parents:
24519
diff
changeset
|
49 | |
| 8231 | 50 | void |
| 15884 | 51 | purple_network_set_public_ip(const char *ip) |
| 8231 | 52 | { |
| 53 | g_return_if_fail(ip != NULL); | |
| 54 | ||
|
8838
c23227da7b4a
[gaim-migrate @ 9604]
Mark Doliner <markdoliner@pidgin.im>
parents:
8834
diff
changeset
|
55 | /* XXX - Ensure the IP address is valid */ |
|
c23227da7b4a
[gaim-migrate @ 9604]
Mark Doliner <markdoliner@pidgin.im>
parents:
8834
diff
changeset
|
56 | |
|
16478
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
16035
diff
changeset
|
57 | purple_prefs_set_string("/purple/network/public_ip", ip); |
| 8231 | 58 | } |
| 59 | ||
| 60 | const char * | |
| 15884 | 61 | purple_network_get_public_ip(void) |
| 8231 | 62 | { |
|
16478
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
16035
diff
changeset
|
63 | return purple_prefs_get_string("/purple/network/public_ip"); |
| 8231 | 64 | } |
| 65 | ||
|
40110
bc2b94f2595a
Make purple_network_get_my_ip_from_gio return non-const.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40107
diff
changeset
|
66 | static gchar * |
|
40107
6320c272e8b2
xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40017
diff
changeset
|
67 | purple_network_get_local_system_ip_from_gio(GSocketConnection *sockconn) |
|
6320c272e8b2
xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40017
diff
changeset
|
68 | { |
|
6320c272e8b2
xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40017
diff
changeset
|
69 | GSocketAddress *addr; |
|
6320c272e8b2
xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40017
diff
changeset
|
70 | GInetSocketAddress *inetsockaddr; |
|
40110
bc2b94f2595a
Make purple_network_get_my_ip_from_gio return non-const.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40107
diff
changeset
|
71 | gchar *ip; |
|
40107
6320c272e8b2
xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40017
diff
changeset
|
72 | |
|
6320c272e8b2
xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40017
diff
changeset
|
73 | addr = g_socket_connection_get_local_address(sockconn, NULL); |
|
6320c272e8b2
xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40017
diff
changeset
|
74 | if ((inetsockaddr = G_INET_SOCKET_ADDRESS(addr)) != NULL) { |
|
6320c272e8b2
xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40017
diff
changeset
|
75 | GInetAddress *inetaddr = |
|
6320c272e8b2
xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40017
diff
changeset
|
76 | g_inet_socket_address_get_address(inetsockaddr); |
|
6320c272e8b2
xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40017
diff
changeset
|
77 | if (g_inet_address_get_family(inetaddr) == G_SOCKET_FAMILY_IPV4 && |
|
6320c272e8b2
xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40017
diff
changeset
|
78 | !g_inet_address_get_is_loopback(inetaddr)) { |
|
40110
bc2b94f2595a
Make purple_network_get_my_ip_from_gio return non-const.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40107
diff
changeset
|
79 | ip = g_inet_address_to_string(inetaddr); |
|
bc2b94f2595a
Make purple_network_get_my_ip_from_gio return non-const.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40107
diff
changeset
|
80 | g_object_unref(addr); |
|
bc2b94f2595a
Make purple_network_get_my_ip_from_gio return non-const.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40107
diff
changeset
|
81 | return ip; |
|
40107
6320c272e8b2
xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40017
diff
changeset
|
82 | } |
|
6320c272e8b2
xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40017
diff
changeset
|
83 | } |
|
6320c272e8b2
xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40017
diff
changeset
|
84 | g_object_unref(addr); |
|
6320c272e8b2
xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40017
diff
changeset
|
85 | |
|
40110
bc2b94f2595a
Make purple_network_get_my_ip_from_gio return non-const.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40107
diff
changeset
|
86 | return g_strdup("0.0.0.0"); |
|
40107
6320c272e8b2
xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40017
diff
changeset
|
87 | } |
|
6320c272e8b2
xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40017
diff
changeset
|
88 | |
|
35462
901dfa763f15
Fix some gtk-doc warnings till proxy.c
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
89 | /* |
|
901dfa763f15
Fix some gtk-doc warnings till proxy.c
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
90 | * purple_network_is_ipv4: |
|
901dfa763f15
Fix some gtk-doc warnings till proxy.c
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
91 | * @hostname: The hostname to be verified. |
|
901dfa763f15
Fix some gtk-doc warnings till proxy.c
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
92 | * |
|
33894
7e3ea8475aad
Get rid of useless form of purple_network_ip_atoi
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33883
diff
changeset
|
93 | * Checks, if specified hostname is valid ipv4 address. |
|
7e3ea8475aad
Get rid of useless form of purple_network_ip_atoi
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33883
diff
changeset
|
94 | * |
|
35462
901dfa763f15
Fix some gtk-doc warnings till proxy.c
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
95 | * Returns: TRUE, if the hostname is valid. |
|
33894
7e3ea8475aad
Get rid of useless form of purple_network_ip_atoi
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33883
diff
changeset
|
96 | */ |
|
7e3ea8475aad
Get rid of useless form of purple_network_ip_atoi
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33883
diff
changeset
|
97 | static gboolean |
|
7e3ea8475aad
Get rid of useless form of purple_network_ip_atoi
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33883
diff
changeset
|
98 | purple_network_is_ipv4(const gchar *hostname) |
|
7e3ea8475aad
Get rid of useless form of purple_network_ip_atoi
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33883
diff
changeset
|
99 | { |
|
7e3ea8475aad
Get rid of useless form of purple_network_ip_atoi
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33883
diff
changeset
|
100 | g_return_val_if_fail(hostname != NULL, FALSE); |
|
7e3ea8475aad
Get rid of useless form of purple_network_ip_atoi
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33883
diff
changeset
|
101 | |
|
7e3ea8475aad
Get rid of useless form of purple_network_ip_atoi
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33883
diff
changeset
|
102 | /* We don't accept ipv6 here. */ |
|
7e3ea8475aad
Get rid of useless form of purple_network_ip_atoi
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33883
diff
changeset
|
103 | if (strchr(hostname, ':') != NULL) |
|
7e3ea8475aad
Get rid of useless form of purple_network_ip_atoi
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33883
diff
changeset
|
104 | return FALSE; |
|
7e3ea8475aad
Get rid of useless form of purple_network_ip_atoi
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33883
diff
changeset
|
105 | |
|
7e3ea8475aad
Get rid of useless form of purple_network_ip_atoi
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33883
diff
changeset
|
106 | return g_hostname_is_ip_address(hostname); |
|
7e3ea8475aad
Get rid of useless form of purple_network_ip_atoi
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33883
diff
changeset
|
107 | } |
|
7e3ea8475aad
Get rid of useless form of purple_network_ip_atoi
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33883
diff
changeset
|
108 | |
|
40663
2453bef0abe7
Cleanup local IP getters
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40659
diff
changeset
|
109 | void |
|
2453bef0abe7
Cleanup local IP getters
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40659
diff
changeset
|
110 | purple_network_discover_my_ip(void) |
| 8231 | 111 | { |
|
12686
ec3e7c4ff045
[gaim-migrate @ 15029]
Richard Laager <rlaager@pidgin.im>
parents:
11424
diff
changeset
|
112 | const char *ip = NULL; |
|
8834
0a798e3d2b84
[gaim-migrate @ 9598]
Mark Doliner <markdoliner@pidgin.im>
parents:
8251
diff
changeset
|
113 | |
|
0a798e3d2b84
[gaim-migrate @ 9598]
Mark Doliner <markdoliner@pidgin.im>
parents:
8251
diff
changeset
|
114 | /* Check if the user specified an IP manually */ |
|
16478
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
16035
diff
changeset
|
115 | if (!purple_prefs_get_bool("/purple/network/auto_ip")) { |
| 15884 | 116 | ip = purple_network_get_public_ip(); |
|
15116
037b787407ba
[gaim-migrate @ 17838]
Mark Doliner <markdoliner@pidgin.im>
parents:
14959
diff
changeset
|
117 | /* Make sure the IP address entered by the user is valid */ |
|
40663
2453bef0abe7
Cleanup local IP getters
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40659
diff
changeset
|
118 | if (ip != NULL && purple_network_is_ipv4(ip)) { |
|
2453bef0abe7
Cleanup local IP getters
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40659
diff
changeset
|
119 | return; |
|
2453bef0abe7
Cleanup local IP getters
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40659
diff
changeset
|
120 | } |
|
2453bef0abe7
Cleanup local IP getters
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40659
diff
changeset
|
121 | } |
| 8231 | 122 | } |
| 123 | ||
|
40110
bc2b94f2595a
Make purple_network_get_my_ip_from_gio return non-const.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40107
diff
changeset
|
124 | gchar * |
|
40107
6320c272e8b2
xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40017
diff
changeset
|
125 | purple_network_get_my_ip_from_gio(GSocketConnection *sockconn) |
|
6320c272e8b2
xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40017
diff
changeset
|
126 | { |
|
6320c272e8b2
xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40017
diff
changeset
|
127 | /* Check if the user specified an IP manually */ |
|
6320c272e8b2
xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40017
diff
changeset
|
128 | if (!purple_prefs_get_bool("/purple/network/auto_ip")) { |
|
42118
97bc84c5233e
Remove our stun code
Gary Kramlich <grim@reaperworld.com>
parents:
42032
diff
changeset
|
129 | const gchar *ip = NULL; |
|
97bc84c5233e
Remove our stun code
Gary Kramlich <grim@reaperworld.com>
parents:
42032
diff
changeset
|
130 | |
|
40107
6320c272e8b2
xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40017
diff
changeset
|
131 | ip = purple_network_get_public_ip(); |
|
42118
97bc84c5233e
Remove our stun code
Gary Kramlich <grim@reaperworld.com>
parents:
42032
diff
changeset
|
132 | |
|
40107
6320c272e8b2
xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40017
diff
changeset
|
133 | /* Make sure the IP address entered by the user is valid */ |
|
6320c272e8b2
xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40017
diff
changeset
|
134 | if ((ip != NULL) && (purple_network_is_ipv4(ip))) { |
|
40110
bc2b94f2595a
Make purple_network_get_my_ip_from_gio return non-const.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40107
diff
changeset
|
135 | return g_strdup(ip); |
|
40107
6320c272e8b2
xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40017
diff
changeset
|
136 | } |
|
6320c272e8b2
xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40017
diff
changeset
|
137 | } |
|
6320c272e8b2
xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40017
diff
changeset
|
138 | |
|
6320c272e8b2
xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40017
diff
changeset
|
139 | /* Just fetch the IP of the local system */ |
|
6320c272e8b2
xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40017
diff
changeset
|
140 | return purple_network_get_local_system_ip_from_gio(sockconn); |
|
6320c272e8b2
xmpp: Convert unencrypted connections to pure GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40017
diff
changeset
|
141 | } |
|
11391
d172e72988cc
[gaim-migrate @ 13620]
Adam Warrington <awarring@users.sourceforge.net>
parents:
11336
diff
changeset
|
142 | |
| 14758 | 143 | gboolean |
| 15884 | 144 | purple_network_is_available(void) |
| 14758 | 145 | { |
|
37488
88afe246144e
First stab at replacing network-manager with gio, this probably breaks win32, need to test and see
Gary Kramlich <grim@reaperworld.com>
parents:
37466
diff
changeset
|
146 | if(force_online) { |
|
24999
84d597b7e7c6
Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@pidgin.im>
parents:
24519
diff
changeset
|
147 | return TRUE; |
|
23041
58661da65e36
Changes suggested by QuLogic to fix my broken changes to the NetworkManager
Richard Laager <rlaager@pidgin.im>
parents:
23040
diff
changeset
|
148 | } |
|
24519
d4af3d043211
Improve our NetworkManager support in a couple of ways:
Richard Laager <rlaager@pidgin.im>
parents:
24044
diff
changeset
|
149 | |
|
37488
88afe246144e
First stab at replacing network-manager with gio, this probably breaks win32, need to test and see
Gary Kramlich <grim@reaperworld.com>
parents:
37466
diff
changeset
|
150 | return g_network_monitor_get_network_available(g_network_monitor_get_default()); |
| 14758 | 151 | } |
| 152 | ||
|
24999
84d597b7e7c6
Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@pidgin.im>
parents:
24519
diff
changeset
|
153 | void |
|
41840
fe350460fb1c
Remove C99-obsoleted constructs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41828
diff
changeset
|
154 | purple_network_force_online(void) |
|
24999
84d597b7e7c6
Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@pidgin.im>
parents:
24519
diff
changeset
|
155 | { |
|
84d597b7e7c6
Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@pidgin.im>
parents:
24519
diff
changeset
|
156 | force_online = TRUE; |
| 14758 | 157 | } |
|
23039
c9b53691fe42
A patch from QuLogic to replace the libnm_glib calls with straight DBus
Richard Laager <rlaager@pidgin.im>
parents:
22735
diff
changeset
|
158 | |
|
36028
fc5300cb3617
Get rid of fair amount of copy-pasta and coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35991
diff
changeset
|
159 | gboolean |
|
fc5300cb3617
Get rid of fair amount of copy-pasta and coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35991
diff
changeset
|
160 | _purple_network_set_common_socket_flags(int fd) |
|
fc5300cb3617
Get rid of fair amount of copy-pasta and coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35991
diff
changeset
|
161 | { |
|
fc5300cb3617
Get rid of fair amount of copy-pasta and coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35991
diff
changeset
|
162 | int flags; |
|
fc5300cb3617
Get rid of fair amount of copy-pasta and coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35991
diff
changeset
|
163 | gboolean succ = TRUE; |
|
fc5300cb3617
Get rid of fair amount of copy-pasta and coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35991
diff
changeset
|
164 | |
|
fc5300cb3617
Get rid of fair amount of copy-pasta and coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35991
diff
changeset
|
165 | g_return_val_if_fail(fd >= 0, FALSE); |
|
fc5300cb3617
Get rid of fair amount of copy-pasta and coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35991
diff
changeset
|
166 | |
|
fc5300cb3617
Get rid of fair amount of copy-pasta and coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35991
diff
changeset
|
167 | flags = fcntl(fd, F_GETFL); |
|
fc5300cb3617
Get rid of fair amount of copy-pasta and coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35991
diff
changeset
|
168 | |
|
fc5300cb3617
Get rid of fair amount of copy-pasta and coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35991
diff
changeset
|
169 | if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) != 0) { |
|
fc5300cb3617
Get rid of fair amount of copy-pasta and coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35991
diff
changeset
|
170 | purple_debug_warning("network", |
|
fc5300cb3617
Get rid of fair amount of copy-pasta and coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35991
diff
changeset
|
171 | "Couldn't set O_NONBLOCK flag\n"); |
|
fc5300cb3617
Get rid of fair amount of copy-pasta and coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35991
diff
changeset
|
172 | succ = FALSE; |
|
fc5300cb3617
Get rid of fair amount of copy-pasta and coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35991
diff
changeset
|
173 | } |
|
fc5300cb3617
Get rid of fair amount of copy-pasta and coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35991
diff
changeset
|
174 | |
|
fc5300cb3617
Get rid of fair amount of copy-pasta and coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35991
diff
changeset
|
175 | #ifndef _WIN32 |
|
fc5300cb3617
Get rid of fair amount of copy-pasta and coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35991
diff
changeset
|
176 | if (fcntl(fd, F_SETFD, FD_CLOEXEC) != 0) { |
|
fc5300cb3617
Get rid of fair amount of copy-pasta and coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35991
diff
changeset
|
177 | purple_debug_warning("network", |
|
fc5300cb3617
Get rid of fair amount of copy-pasta and coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35991
diff
changeset
|
178 | "Couldn't set FD_CLOEXEC flag\n"); |
|
fc5300cb3617
Get rid of fair amount of copy-pasta and coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35991
diff
changeset
|
179 | succ = FALSE; |
|
fc5300cb3617
Get rid of fair amount of copy-pasta and coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35991
diff
changeset
|
180 | } |
|
fc5300cb3617
Get rid of fair amount of copy-pasta and coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35991
diff
changeset
|
181 | #endif |
|
fc5300cb3617
Get rid of fair amount of copy-pasta and coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35991
diff
changeset
|
182 | |
|
fc5300cb3617
Get rid of fair amount of copy-pasta and coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35991
diff
changeset
|
183 | return succ; |
|
fc5300cb3617
Get rid of fair amount of copy-pasta and coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35991
diff
changeset
|
184 | } |
|
fc5300cb3617
Get rid of fair amount of copy-pasta and coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35991
diff
changeset
|
185 | |
| 8231 | 186 | void |
| 15884 | 187 | purple_network_init(void) |
| 8231 | 188 | { |
|
16478
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
16035
diff
changeset
|
189 | purple_prefs_add_none ("/purple/network"); |
|
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
16035
diff
changeset
|
190 | purple_prefs_add_bool ("/purple/network/auto_ip", TRUE); |
|
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
16035
diff
changeset
|
191 | purple_prefs_add_string("/purple/network/public_ip", ""); |
|
21810
0b5181178201
Allow UPnP and NAT-PMP port mapping to be disabled via a pref. This means that UPnP discovery will not occur if this new pref and the "Autodetect IP Address" pref are both unchecked. Fixes #4157.
Daniel Atallah <datallah@pidgin.im>
parents:
21549
diff
changeset
|
192 | purple_prefs_add_bool ("/purple/network/map_ports", TRUE); |
|
16478
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
16035
diff
changeset
|
193 | purple_prefs_add_bool ("/purple/network/ports_range_use", FALSE); |
|
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
16035
diff
changeset
|
194 | purple_prefs_add_int ("/purple/network/ports_range_start", 1024); |
|
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
16035
diff
changeset
|
195 | purple_prefs_add_int ("/purple/network/ports_range_end", 2048); |
| 8231 | 196 | } |
| 14758 | 197 | |
| 198 | void | |
| 15884 | 199 | purple_network_uninit(void) |
| 14758 | 200 | { |
| 201 | } |