Wed, 19 Oct 2022 06:25:35 -0500
Back out the PurpleProtocol->login change that returned a PurpleConnection
This remains to be a good idea, but this implementation caused more issues than
it solved. I'm working on that better implementation, but we need to revert all
of this first, otherwise the new review request is going to be massive.
This reverts commits 3f96e2b2b03d, d567f89d6a9b, and 6ef5bb284651. These were
backed out manually due to some other commits that made automative backouts
difficult.
Testing Done:
Connected a demo, ircv3, and xmpp accounts without issue.
Reviewed at https://reviews.imfreedom.org/r/1937/
|
33348
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33347
diff
changeset
|
1 | /* purple |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33347
diff
changeset
|
2 | * |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33347
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:
33347
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:
33347
diff
changeset
|
5 | * source distribution. |
| 11414 | 6 | * |
|
33348
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33347
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:
33347
diff
changeset
|
8 | * by Tomek Wasilczyk (http://www.wasilczyk.pl). |
| 11414 | 9 | * |
|
33348
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33347
diff
changeset
|
10 | * Previously implemented by: |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33347
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:
33347
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:
33347
diff
changeset
|
13 | * - Krzysztof Klinikowski <grommasher@gmail.com> - some parts (2009-2011). |
| 11414 | 14 | * |
| 15 | * This program is free software; you can redistribute it and/or modify | |
| 16 | * it under the terms of the GNU General Public License as published by | |
| 17 | * the Free Software Foundation; either version 2 of the License, or | |
| 18 | * (at your option) any later version. | |
| 19 | * | |
| 20 | * This program is distributed in the hope that it will be useful, | |
| 21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 23 | * GNU General Public License for more details. | |
| 24 | * | |
| 25 | * You should have received a copy of the GNU General Public License | |
| 26 | * 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:
15884
diff
changeset
|
27 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 11414 | 28 | */ |
| 29 | ||
|
40523
9bcf96663cb9
Make gstreamer-1.0 a required dependency
Gary Kramlich <grim@reaperworld.com>
parents:
40512
diff
changeset
|
30 | #include <errno.h> |
|
9bcf96663cb9
Make gstreamer-1.0 a required dependency
Gary Kramlich <grim@reaperworld.com>
parents:
40512
diff
changeset
|
31 | |
|
9bcf96663cb9
Make gstreamer-1.0 a required dependency
Gary Kramlich <grim@reaperworld.com>
parents:
40512
diff
changeset
|
32 | #include <purple.h> |
|
9bcf96663cb9
Make gstreamer-1.0 a required dependency
Gary Kramlich <grim@reaperworld.com>
parents:
40512
diff
changeset
|
33 | |
|
33299
b3c4ab3aeb7f
Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33298
diff
changeset
|
34 | #include "utils.h" |
| 11414 | 35 | |
|
33299
b3c4ab3aeb7f
Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33298
diff
changeset
|
36 | #include "gg.h" |
| 11414 | 37 | |
|
12224
bf547f7989a4
[gaim-migrate @ 14526]
Richard Laager <rlaager@pidgin.im>
parents:
12223
diff
changeset
|
38 | uin_t ggp_str_to_uin(const char *str) |
| 11414 | 39 | { |
|
33299
b3c4ab3aeb7f
Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33298
diff
changeset
|
40 | char *endptr; |
|
b3c4ab3aeb7f
Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33298
diff
changeset
|
41 | uin_t uin; |
| 11414 | 42 | |
|
33299
b3c4ab3aeb7f
Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33298
diff
changeset
|
43 | if (!str || str[0] < '0' || str[0] > '9') |
| 11414 | 44 | return 0; |
| 45 | ||
| 46 | errno = 0; | |
|
33299
b3c4ab3aeb7f
Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33298
diff
changeset
|
47 | uin = strtoul(str, &endptr, 10); |
| 11414 | 48 | |
|
33299
b3c4ab3aeb7f
Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33298
diff
changeset
|
49 | if (errno == ERANGE || endptr[0] != '\0') |
| 11414 | 50 | return 0; |
| 51 | ||
|
33299
b3c4ab3aeb7f
Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33298
diff
changeset
|
52 | return uin; |
| 11414 | 53 | } |
| 54 | ||
|
33298
519acf37d16e
Gadu-Gadu: fix receiving of inline images after 3.x changes; code refactoring here as well
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
55 | const char * ggp_uin_to_str(uin_t uin) |
|
519acf37d16e
Gadu-Gadu: fix receiving of inline images after 3.x changes; code refactoring here as well
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
56 | { |
|
519acf37d16e
Gadu-Gadu: fix receiving of inline images after 3.x changes; code refactoring here as well
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
57 | static char buff[GGP_UIN_LEN_MAX + 1]; |
|
35357
389e413e3414
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35144
diff
changeset
|
58 | |
|
33298
519acf37d16e
Gadu-Gadu: fix receiving of inline images after 3.x changes; code refactoring here as well
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
59 | g_snprintf(buff, GGP_UIN_LEN_MAX + 1, "%u", uin); |
|
35357
389e413e3414
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35144
diff
changeset
|
60 | |
|
33298
519acf37d16e
Gadu-Gadu: fix receiving of inline images after 3.x changes; code refactoring here as well
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
61 | return buff; |
|
519acf37d16e
Gadu-Gadu: fix receiving of inline images after 3.x changes; code refactoring here as well
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
62 | } |
|
519acf37d16e
Gadu-Gadu: fix receiving of inline images after 3.x changes; code refactoring here as well
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
63 | |
|
34394
ed78b0fc180e
Gadu-Gadu: file transfer code tidying, first stage of receiving a file
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34389
diff
changeset
|
64 | uin_t ggp_get_my_uin(PurpleConnection *gc) |
|
ed78b0fc180e
Gadu-Gadu: file transfer code tidying, first stage of receiving a file
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34389
diff
changeset
|
65 | { |
|
ed78b0fc180e
Gadu-Gadu: file transfer code tidying, first stage of receiving a file
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34389
diff
changeset
|
66 | g_return_val_if_fail(gc != NULL, 0); |
|
35357
389e413e3414
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35144
diff
changeset
|
67 | |
|
34394
ed78b0fc180e
Gadu-Gadu: file transfer code tidying, first stage of receiving a file
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34389
diff
changeset
|
68 | return ggp_str_to_uin(purple_account_get_username( |
|
ed78b0fc180e
Gadu-Gadu: file transfer code tidying, first stage of receiving a file
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34389
diff
changeset
|
69 | purple_connection_get_account(gc))); |
|
ed78b0fc180e
Gadu-Gadu: file transfer code tidying, first stage of receiving a file
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34389
diff
changeset
|
70 | } |
|
ed78b0fc180e
Gadu-Gadu: file transfer code tidying, first stage of receiving a file
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34389
diff
changeset
|
71 | |
|
33299
b3c4ab3aeb7f
Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33298
diff
changeset
|
72 | static gchar * ggp_convert(const gchar *src, const char *srcenc, |
|
b3c4ab3aeb7f
Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33298
diff
changeset
|
73 | const char *dstenc) |
| 15288 | 74 | { |
|
33299
b3c4ab3aeb7f
Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33298
diff
changeset
|
75 | gchar *dst; |
| 11414 | 76 | GError *err = NULL; |
| 77 | ||
|
33299
b3c4ab3aeb7f
Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33298
diff
changeset
|
78 | if (src == NULL) |
| 11414 | 79 | return NULL; |
| 80 | ||
|
33299
b3c4ab3aeb7f
Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33298
diff
changeset
|
81 | dst = g_convert_with_fallback(src, strlen(src), dstenc, srcenc, "?", |
|
b3c4ab3aeb7f
Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33298
diff
changeset
|
82 | NULL, NULL, &err); |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35357
diff
changeset
|
83 | if (err != NULL) { |
|
33299
b3c4ab3aeb7f
Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33298
diff
changeset
|
84 | purple_debug_error("gg", "error converting from %s to %s: %s\n", |
|
b3c4ab3aeb7f
Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33298
diff
changeset
|
85 | srcenc, dstenc, err->message); |
| 11414 | 86 | g_error_free(err); |
| 87 | } | |
| 88 | ||
|
33299
b3c4ab3aeb7f
Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33298
diff
changeset
|
89 | if (dst == NULL) |
|
b3c4ab3aeb7f
Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33298
diff
changeset
|
90 | dst = g_strdup(src); |
| 11414 | 91 | |
|
33299
b3c4ab3aeb7f
Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33298
diff
changeset
|
92 | return dst; |
| 11414 | 93 | } |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19859
diff
changeset
|
94 | |
|
33299
b3c4ab3aeb7f
Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33298
diff
changeset
|
95 | gchar * ggp_convert_to_cp1250(const gchar *src) |
|
b3c4ab3aeb7f
Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33298
diff
changeset
|
96 | { |
|
b3c4ab3aeb7f
Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33298
diff
changeset
|
97 | return ggp_convert(src, "UTF-8", "CP1250"); |
|
b3c4ab3aeb7f
Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33298
diff
changeset
|
98 | } |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19859
diff
changeset
|
99 | |
|
33299
b3c4ab3aeb7f
Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33298
diff
changeset
|
100 | gchar * ggp_convert_from_cp1250(const gchar *src) |
|
b3c4ab3aeb7f
Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33298
diff
changeset
|
101 | { |
|
b3c4ab3aeb7f
Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33298
diff
changeset
|
102 | return ggp_convert(src, "CP1250", "UTF-8"); |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19859
diff
changeset
|
103 | } |
|
33309
bc2f2ea7b5ab
Gadu-Gadu: refactoring of account registration done
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33305
diff
changeset
|
104 | |
|
33337
458d578d553d
Gadu-Gadu: status refactoring - fix bug with long status
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33334
diff
changeset
|
105 | gchar * ggp_utf8_strndup(const gchar *str, gsize n) |
|
458d578d553d
Gadu-Gadu: status refactoring - fix bug with long status
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33334
diff
changeset
|
106 | { |
|
36047
2d7d55acd82c
Coverity: fix null pointer dereferences
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35361
diff
changeset
|
107 | size_t raw_len; |
|
33337
458d578d553d
Gadu-Gadu: status refactoring - fix bug with long status
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33334
diff
changeset
|
108 | gchar *end_ptr; |
|
458d578d553d
Gadu-Gadu: status refactoring - fix bug with long status
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33334
diff
changeset
|
109 | if (str == NULL) |
|
458d578d553d
Gadu-Gadu: status refactoring - fix bug with long status
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33334
diff
changeset
|
110 | return NULL; |
|
36047
2d7d55acd82c
Coverity: fix null pointer dereferences
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35361
diff
changeset
|
111 | raw_len = strlen(str); |
|
33337
458d578d553d
Gadu-Gadu: status refactoring - fix bug with long status
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33334
diff
changeset
|
112 | if (raw_len <= n) |
|
458d578d553d
Gadu-Gadu: status refactoring - fix bug with long status
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33334
diff
changeset
|
113 | return g_strdup(str); |
|
35357
389e413e3414
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35144
diff
changeset
|
114 | |
|
33337
458d578d553d
Gadu-Gadu: status refactoring - fix bug with long status
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33334
diff
changeset
|
115 | end_ptr = g_utf8_offset_to_pointer(str, g_utf8_pointer_to_offset(str, &str[n])); |
|
458d578d553d
Gadu-Gadu: status refactoring - fix bug with long status
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33334
diff
changeset
|
116 | raw_len = end_ptr - str; |
|
35357
389e413e3414
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35144
diff
changeset
|
117 | |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35357
diff
changeset
|
118 | if (raw_len > n) { |
|
33337
458d578d553d
Gadu-Gadu: status refactoring - fix bug with long status
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33334
diff
changeset
|
119 | end_ptr = g_utf8_prev_char(end_ptr); |
|
458d578d553d
Gadu-Gadu: status refactoring - fix bug with long status
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33334
diff
changeset
|
120 | raw_len = end_ptr - str; |
|
458d578d553d
Gadu-Gadu: status refactoring - fix bug with long status
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33334
diff
changeset
|
121 | } |
|
35357
389e413e3414
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35144
diff
changeset
|
122 | |
|
33337
458d578d553d
Gadu-Gadu: status refactoring - fix bug with long status
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33334
diff
changeset
|
123 | g_assert(raw_len <= n); |
|
35357
389e413e3414
Style: fix gg (partially)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35144
diff
changeset
|
124 | |
|
33337
458d578d553d
Gadu-Gadu: status refactoring - fix bug with long status
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33334
diff
changeset
|
125 | return g_strndup(str, raw_len); |
|
458d578d553d
Gadu-Gadu: status refactoring - fix bug with long status
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33334
diff
changeset
|
126 | } |
|
33339
02ee2834030c
Gadu-Gadu: servers history feature
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33337
diff
changeset
|
127 | |
|
35144
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34429
diff
changeset
|
128 | const gchar * ggp_ipv4_to_str(uint32_t raw_ip) |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34429
diff
changeset
|
129 | { |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34429
diff
changeset
|
130 | static gchar buff[INET_ADDRSTRLEN]; |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34429
diff
changeset
|
131 | buff[0] = '\0'; |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34429
diff
changeset
|
132 | |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34429
diff
changeset
|
133 | g_snprintf(buff, sizeof(buff), "%d.%d.%d.%d", |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34429
diff
changeset
|
134 | ((raw_ip >> 0) & 0xFF), |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34429
diff
changeset
|
135 | ((raw_ip >> 8) & 0xFF), |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34429
diff
changeset
|
136 | ((raw_ip >> 16) & 0xFF), |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34429
diff
changeset
|
137 | ((raw_ip >> 24) & 0xFF)); |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34429
diff
changeset
|
138 | |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34429
diff
changeset
|
139 | return buff; |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34429
diff
changeset
|
140 | } |
|
3590ceb242b5
Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34429
diff
changeset
|
141 | |
|
33347
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33339
diff
changeset
|
142 | gchar * ggp_free_if_equal(gchar *str, const gchar *pattern) |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33339
diff
changeset
|
143 | { |
|
35361
efdbd45604f1
Style: fix gg braces (part 2)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35357
diff
changeset
|
144 | if (g_strcmp0(str, pattern) == 0) { |
|
33347
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33339
diff
changeset
|
145 | g_free(str); |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33339
diff
changeset
|
146 | return NULL; |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33339
diff
changeset
|
147 | } |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33339
diff
changeset
|
148 | return str; |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33339
diff
changeset
|
149 | } |
|
cc3f8295618a
Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33339
diff
changeset
|
150 | |
|
34361
ddcc82637afa
Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33348
diff
changeset
|
151 | uint64_t * ggp_uint64dup(uint64_t val) |
|
ddcc82637afa
Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33348
diff
changeset
|
152 | { |
|
ddcc82637afa
Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33348
diff
changeset
|
153 | uint64_t *ptr = g_new(uint64_t, 1); |
|
ddcc82637afa
Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33348
diff
changeset
|
154 | *ptr = val; |
|
ddcc82637afa
Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33348
diff
changeset
|
155 | return ptr; |
|
ddcc82637afa
Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33348
diff
changeset
|
156 | } |
|
ddcc82637afa
Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33348
diff
changeset
|
157 | |
|
34384
c81441091162
Simple, but (partially) working outgoing file transfer
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34374
diff
changeset
|
158 | JsonParser * ggp_json_parse(const gchar *data) |
|
c81441091162
Simple, but (partially) working outgoing file transfer
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34374
diff
changeset
|
159 | { |
|
c81441091162
Simple, but (partially) working outgoing file transfer
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34374
diff
changeset
|
160 | JsonParser *parser; |
|
c81441091162
Simple, but (partially) working outgoing file transfer
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34374
diff
changeset
|
161 | |
|
c81441091162
Simple, but (partially) working outgoing file transfer
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34374
diff
changeset
|
162 | parser = json_parser_new(); |
|
c81441091162
Simple, but (partially) working outgoing file transfer
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34374
diff
changeset
|
163 | if (json_parser_load_from_data(parser, data, -1, NULL)) |
|
c81441091162
Simple, but (partially) working outgoing file transfer
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34374
diff
changeset
|
164 | return parser; |
|
c81441091162
Simple, but (partially) working outgoing file transfer
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34374
diff
changeset
|
165 | |
|
c81441091162
Simple, but (partially) working outgoing file transfer
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34374
diff
changeset
|
166 | if (purple_debug_is_unsafe()) |
|
c81441091162
Simple, but (partially) working outgoing file transfer
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34374
diff
changeset
|
167 | purple_debug_warning("gg", "Invalid JSON: %s\n", data); |
|
c81441091162
Simple, but (partially) working outgoing file transfer
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34374
diff
changeset
|
168 | return NULL; |
|
c81441091162
Simple, but (partially) working outgoing file transfer
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34374
diff
changeset
|
169 | } |