Tue, 20 Feb 2024 00:55:28 -0600
Remove unnecessary casts for GObject methods
Testing Done:
Compiled with the turtles and verified no new warnings appeared.
Reviewed at https://reviews.imfreedom.org/r/2956/
|
33348
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33295
diff
changeset
|
1 | /* purple |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33295
diff
changeset
|
2 | * |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33295
diff
changeset
|
3 | * Purple is the legal property of its developers, whose names are too numerous |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33295
diff
changeset
|
4 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33295
diff
changeset
|
5 | * source distribution. |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33295
diff
changeset
|
6 | * |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33295
diff
changeset
|
7 | * Rewritten from scratch during Google Summer of Code 2012 |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33295
diff
changeset
|
8 | * by Tomek Wasilczyk (http://www.wasilczyk.pl). |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33295
diff
changeset
|
9 | * |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33295
diff
changeset
|
10 | * Previously implemented by: |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33295
diff
changeset
|
11 | * - Arkadiusz Miskiewicz <misiek@pld.org.pl> - first implementation (2001); |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33295
diff
changeset
|
12 | * - Bartosz Oler <bartosz@bzimage.us> - reimplemented during GSoC 2005; |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33295
diff
changeset
|
13 | * - Krzysztof Klinikowski <grommasher@gmail.com> - some parts (2009-2011). |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33295
diff
changeset
|
14 | * |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33295
diff
changeset
|
15 | * This program is free software; you can redistribute it and/or modify |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33295
diff
changeset
|
16 | * it under the terms of the GNU General Public License as published by |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33295
diff
changeset
|
17 | * the Free Software Foundation; either version 2 of the License, or |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33295
diff
changeset
|
18 | * (at your option) any later version. |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33295
diff
changeset
|
19 | * |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33295
diff
changeset
|
20 | * This program is distributed in the hope that it will be useful, |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33295
diff
changeset
|
21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33295
diff
changeset
|
22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33295
diff
changeset
|
23 | * GNU General Public License for more details. |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33295
diff
changeset
|
24 | * |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33295
diff
changeset
|
25 | * You should have received a copy of the GNU General Public License |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33295
diff
changeset
|
26 | * along with this program; if not, write to the Free Software |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33295
diff
changeset
|
27 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33295
diff
changeset
|
28 | */ |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33295
diff
changeset
|
29 | |
|
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:
40358
diff
changeset
|
30 | #include <purple.h> |
|
40756
3a58ef28ee44
Implement mitigation for GHSL-2021-045
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
31 | #include "libpurple/glibcompat.h" |
|
33291
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
32 | |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
33 | #include <libgadu.h> |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
34 | #include "resolver-purple.h" |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
35 | |
|
37454
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
36 | #include <gio/gio.h> |
|
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
37 | |
|
33291
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
38 | static int ggp_resolver_purple_start(int *fd, void **private_data, |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
39 | const char *hostname); |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
40 | |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
41 | static void ggp_resolver_purple_cleanup(void **private_data, int force); |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
42 | |
|
37454
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
43 | static void ggp_resolver_purple_cb(GObject *sender, GAsyncResult *res, gpointer data); |
|
33291
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
44 | |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
45 | typedef struct |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
46 | { |
|
37454
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
47 | GCancellable *cancellable; |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34422
diff
changeset
|
48 | |
|
33291
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
49 | /** |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
50 | * File descriptors: |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
51 | * pipes[0] - for reading |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
52 | * pipes[1] - for writing |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
53 | */ |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
54 | int pipes[2]; |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
55 | } ggp_resolver_purple_data; |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
56 | |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
57 | |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
58 | extern void ggp_resolver_purple_setup(void) |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
59 | { |
|
33295
c995c45e8ed9
Check result of ggp_resolver_purple_setup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33291
diff
changeset
|
60 | if (gg_global_set_custom_resolver(ggp_resolver_purple_start, |
|
c995c45e8ed9
Check result of ggp_resolver_purple_setup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33291
diff
changeset
|
61 | ggp_resolver_purple_cleanup) != 0) |
|
c995c45e8ed9
Check result of ggp_resolver_purple_setup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33291
diff
changeset
|
62 | { |
|
c995c45e8ed9
Check result of ggp_resolver_purple_setup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33291
diff
changeset
|
63 | purple_debug_error("gg", "failed to set custom resolver\n"); |
|
c995c45e8ed9
Check result of ggp_resolver_purple_setup
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33291
diff
changeset
|
64 | } |
|
33291
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
65 | } |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
66 | |
|
37454
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
67 | void ggp_resolver_purple_cb(GObject *sender, GAsyncResult *res, gpointer cbdata) { |
|
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
68 | GList *addresses = NULL, *in_addrs = NULL, *l = NULL; |
|
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
69 | GError *error = NULL; |
|
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
70 | gsize native_size = 0; /* this is kind of dirty, but it'll be initialized before we use it */ |
|
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
71 | |
|
33291
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
72 | ggp_resolver_purple_data *data = (ggp_resolver_purple_data*)cbdata; |
|
34422
8bd643b801e0
Remove TODO, it's already fixed
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34421
diff
changeset
|
73 | const int fd = data->pipes[1]; |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34422
diff
changeset
|
74 | |
|
37517
a67be31f9c7e
Use the GResolver which was passed to g_resolver_lookup_*_async()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37454
diff
changeset
|
75 | addresses = g_resolver_lookup_by_name_finish(G_RESOLVER(sender), |
|
a67be31f9c7e
Use the GResolver which was passed to g_resolver_lookup_*_async()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37454
diff
changeset
|
76 | res, &error); |
|
37454
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
77 | if(addresses == NULL) { |
|
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
78 | purple_debug_error("gg", "ggp_resolver_purple_cb failed: %s\n", |
|
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
79 | error->message); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34422
diff
changeset
|
80 | |
|
37454
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
81 | g_error_free(error); |
|
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
82 | } else { |
|
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
83 | purple_debug_misc("gg", "ggp_resolver_purple_cb succeeded: (%p, %p)\n", |
|
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
84 | addresses, cbdata); |
|
33291
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
85 | } |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34422
diff
changeset
|
86 | |
|
42592
6b65c0e4ba15
Remove unnecessary casts for GObject methods
Gary Kramlich <grim@reaperworld.com>
parents:
40756
diff
changeset
|
87 | g_object_unref(data->cancellable); |
|
37454
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
88 | data->cancellable = NULL; |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34422
diff
changeset
|
89 | |
|
37454
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
90 | for(l = addresses; l; l = l->next) { |
|
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
91 | GInetAddress *inet_address = G_INET_ADDRESS(l->data); |
|
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
92 | GSocketFamily family = G_SOCKET_FAMILY_INVALID; |
|
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
93 | gchar *ip_address = g_inet_address_to_string(inet_address); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34422
diff
changeset
|
94 | |
|
37454
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
95 | family = g_inet_address_get_family(inet_address); |
|
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
96 | |
|
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
97 | switch(family) { |
|
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
98 | case G_SOCKET_FAMILY_IPV4: |
|
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
99 | purple_debug_misc("gg", "ggp_resolver_purple_cb " |
|
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
100 | "ipv4: %s\n", ip_address); |
|
35676
d9fdd45925ec
Fix some of invalid alignment warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35361
diff
changeset
|
101 | |
|
37454
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
102 | native_size = g_inet_address_get_native_size(inet_address); |
|
40756
3a58ef28ee44
Implement mitigation for GHSL-2021-045
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
103 | in_addrs = g_list_append(in_addrs, g_memdup2(g_inet_address_to_bytes(inet_address), native_size)); |
|
37454
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
104 | |
|
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
105 | break; |
|
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
106 | case G_SOCKET_FAMILY_IPV6: |
|
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
107 | purple_debug_misc("gg", "ggp_resolver_purple_cb " |
|
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
108 | "ipv6 (ignore): %s\n", ip_address); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34422
diff
changeset
|
109 | |
|
37454
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
110 | break; |
|
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
111 | default: |
|
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
112 | purple_debug_warning("gg", "ggp_resolver_purple_cb " |
|
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
113 | "unexpected sa_family: %d\n", |
|
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
114 | family); |
|
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
115 | |
|
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
116 | break; |
|
33291
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
117 | } |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34422
diff
changeset
|
118 | |
|
37454
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
119 | g_free(ip_address); |
|
33291
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
120 | } |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34422
diff
changeset
|
121 | |
|
37454
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
122 | for(l = in_addrs; l; l = l->next) { |
|
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
123 | gint write_size = native_size; |
|
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
124 | if(write(fd, l->data, write_size) != write_size) { |
|
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
125 | purple_debug_error("gg", |
|
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
126 | "ggp_resolver_purple_cb write error on %p\n", l->data); |
|
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
127 | } |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34422
diff
changeset
|
128 | |
|
37454
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
129 | g_free(l->data); |
|
33291
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
130 | } |
|
37454
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
131 | |
|
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
132 | g_list_free(in_addrs); |
|
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
133 | g_resolver_free_addresses(addresses); |
|
33291
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
134 | } |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
135 | |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
136 | int ggp_resolver_purple_start(int *fd, void **private_data, |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
137 | const char *hostname) |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
138 | { |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
139 | ggp_resolver_purple_data *data; |
|
37518
53c9ebedf2b7
Plug g_resolver_get_default() leaks
Mike Ruprecht <cmaiku@gmail.com>
parents:
37517
diff
changeset
|
140 | GResolver *resolver; |
|
53c9ebedf2b7
Plug g_resolver_get_default() leaks
Mike Ruprecht <cmaiku@gmail.com>
parents:
37517
diff
changeset
|
141 | |
|
33351
bd15903d0d89
Gadu-Gadu: fix compilation on 64bit targets
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33348
diff
changeset
|
142 | purple_debug_misc("gg", "ggp_resolver_purple_start(%p, %p, \"%s\")\n", |
|
bd15903d0d89
Gadu-Gadu: fix compilation on 64bit targets
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33348
diff
changeset
|
143 | fd, private_data, hostname); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34422
diff
changeset
|
144 | |
|
39922
113b93e2bd2a
Replace malloc(sizeof(...)) with g_new0(..., 1).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37518
diff
changeset
|
145 | data = g_new0(ggp_resolver_purple_data, 1); |
|
33291
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
146 | *private_data = (void*)data; |
|
37454
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
147 | data->cancellable = NULL; |
|
33291
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
148 | data->pipes[0] = 0; |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
149 | data->pipes[1] = 0; |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34422
diff
changeset
|
150 | |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35356
diff
changeset
|
151 | if (purple_input_pipe(data->pipes) != 0) { |
|
33291
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
152 | purple_debug_error("gg", "ggp_resolver_purple_start: " |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
153 | "unable to create pipe\n"); |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
154 | ggp_resolver_purple_cleanup(private_data, 0); |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
155 | return -1; |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
156 | } |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34422
diff
changeset
|
157 | |
|
33291
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
158 | *fd = data->pipes[0]; |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34422
diff
changeset
|
159 | |
|
33291
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
160 | /* account and port is unknown in this context */ |
|
37454
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
161 | data->cancellable = g_cancellable_new(); |
|
33291
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
162 | |
|
37518
53c9ebedf2b7
Plug g_resolver_get_default() leaks
Mike Ruprecht <cmaiku@gmail.com>
parents:
37517
diff
changeset
|
163 | resolver = g_resolver_get_default(); |
|
53c9ebedf2b7
Plug g_resolver_get_default() leaks
Mike Ruprecht <cmaiku@gmail.com>
parents:
37517
diff
changeset
|
164 | g_resolver_lookup_by_name_async(resolver, |
|
37454
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
165 | hostname, |
|
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
166 | data->cancellable, |
|
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
167 | ggp_resolver_purple_cb, |
|
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
168 | (gpointer)data); |
|
37518
53c9ebedf2b7
Plug g_resolver_get_default() leaks
Mike Ruprecht <cmaiku@gmail.com>
parents:
37517
diff
changeset
|
169 | g_object_unref(resolver); |
|
37454
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
170 | |
|
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
171 | if (!data->cancellable) { |
|
33291
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
172 | purple_debug_error("gg", "ggp_resolver_purple_start: " |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
173 | "unable to call purple_dnsquery_a\n"); |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
174 | ggp_resolver_purple_cleanup(private_data, 0); |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
175 | return -1; |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
176 | } |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34422
diff
changeset
|
177 | |
|
33291
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
178 | return 0; |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
179 | } |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
180 | |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
181 | void ggp_resolver_purple_cleanup(void **private_data, int force) |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
182 | { |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
183 | ggp_resolver_purple_data *data = |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
184 | (ggp_resolver_purple_data*)(*private_data); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34422
diff
changeset
|
185 | |
|
33351
bd15903d0d89
Gadu-Gadu: fix compilation on 64bit targets
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33348
diff
changeset
|
186 | purple_debug_misc("gg", "ggp_resolver_purple_cleanup(%p, %d)\n", |
|
bd15903d0d89
Gadu-Gadu: fix compilation on 64bit targets
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33348
diff
changeset
|
187 | private_data, force); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34422
diff
changeset
|
188 | |
|
33291
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
189 | if (!data) |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
190 | return; |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
191 | *private_data = NULL; |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34422
diff
changeset
|
192 | |
|
37454
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
193 | if (G_IS_CANCELLABLE(data->cancellable)) { |
|
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
194 | g_cancellable_cancel(data->cancellable); |
|
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
195 | |
|
42592
6b65c0e4ba15
Remove unnecessary casts for GObject methods
Gary Kramlich <grim@reaperworld.com>
parents:
40756
diff
changeset
|
196 | g_object_unref(data->cancellable); |
|
37454
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
197 | } |
|
eac2789dd461
I think this will work for gg...
Gary Kramlich <grim@reaperworld.com>
parents:
35676
diff
changeset
|
198 | |
|
33291
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
199 | if (data->pipes[0]) |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
200 | close(data->pipes[0]); |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
201 | if (data->pipes[1]) |
|
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
202 | close(data->pipes[1]); |
|
35356
3a71df246d07
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34422
diff
changeset
|
203 | |
|
39922
113b93e2bd2a
Replace malloc(sizeof(...)) with g_new0(..., 1).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37518
diff
changeset
|
204 | g_free(data); |
|
33291
b70ab10887a7
New custom resolver, that uses libpurple for DNS queries. Get rid of old win32 resolver. Refs#343. Fixes #6263
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
205 | } |