libpurple/protocols/gg/utils.h

Tue, 04 Feb 2014 00:30:47 +0100

author
Tomasz Wasilczyk <twasilczyk@pidgin.im>
date
Tue, 04 Feb 2014 00:30:47 +0100
changeset 35360
29d788c72350
parent 35144
3590ceb242b5
child 39819
3554dac2991b
permissions
-rw-r--r--

Style: fix gg braces (part 1)

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
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents:
diff changeset
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
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents:
diff changeset
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
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents:
diff changeset
14 *
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents:
diff changeset
15 * This program is free software; you can redistribute it and/or modify
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents:
diff changeset
16 * it under the terms of the GNU General Public License as published by
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents:
diff changeset
17 * the Free Software Foundation; either version 2 of the License, or
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents:
diff changeset
18 * (at your option) any later version.
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents:
diff changeset
19 *
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents:
diff changeset
20 * This program is distributed in the hope that it will be useful,
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents:
diff changeset
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents:
diff changeset
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents:
diff changeset
23 * GNU General Public License for more details.
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents:
diff changeset
24 *
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents:
diff changeset
25 * You should have received a copy of the GNU General Public License
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents:
diff changeset
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
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents:
diff changeset
28 */
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents:
diff changeset
29
33300
c671ae84307f Updated libgadu to 1.11.2, configure.ac refactoring
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33299
diff changeset
30 #ifndef _GGP_UTILS_H
c671ae84307f Updated libgadu to 1.11.2, configure.ac refactoring
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33299
diff changeset
31 #define _GGP_UTILS_H
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents:
diff changeset
32
33299
b3c4ab3aeb7f Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33298
diff changeset
33 #include <internal.h>
b3c4ab3aeb7f Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33298
diff changeset
34 #include <libgadu.h>
34384
c81441091162 Simple, but (partially) working outgoing file transfer
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34361
diff changeset
35 #include <json-glib/json-glib.h>
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents:
diff changeset
36
15288
ee9ffc3db216 [gaim-migrate @ 18016]
Bartosz Oler <bartosz@pidgin.im>
parents: 14254
diff changeset
37 /**
33299
b3c4ab3aeb7f Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33298
diff changeset
38 * Converts stringified UIN to uin_t.
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents:
diff changeset
39 *
33299
b3c4ab3aeb7f Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33298
diff changeset
40 * @param str The string to convert.
15288
ee9ffc3db216 [gaim-migrate @ 18016]
Bartosz Oler <bartosz@pidgin.im>
parents: 14254
diff changeset
41 *
33299
b3c4ab3aeb7f Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33298
diff changeset
42 * @return Converted UIN or 0 if an error occurred.
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents:
diff changeset
43 */
33299
b3c4ab3aeb7f Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33298
diff changeset
44 uin_t ggp_str_to_uin(const char *str);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents:
diff changeset
45
33299
b3c4ab3aeb7f Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33298
diff changeset
46 /**
b3c4ab3aeb7f Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33298
diff changeset
47 * Stringifies UIN.
b3c4ab3aeb7f Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33298
diff changeset
48 *
b3c4ab3aeb7f Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33298
diff changeset
49 * @param uin UIN to stringify.
b3c4ab3aeb7f Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33298
diff changeset
50 *
b3c4ab3aeb7f Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33298
diff changeset
51 * @return Stringified UIN.
b3c4ab3aeb7f Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33298
diff changeset
52 */
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
53 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
54
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents:
diff changeset
55 /**
34394
ed78b0fc180e Gadu-Gadu: file transfer code tidying, first stage of receiving a file
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34389
diff changeset
56 * Gets UIN for the account.
ed78b0fc180e Gadu-Gadu: file transfer code tidying, first stage of receiving a file
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34389
diff changeset
57 *
ed78b0fc180e Gadu-Gadu: file transfer code tidying, first stage of receiving a file
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34389
diff changeset
58 * @param gc The connection, in which account is connected.
ed78b0fc180e Gadu-Gadu: file transfer code tidying, first stage of receiving a file
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34389
diff changeset
59 * @return UIN for this account.
ed78b0fc180e Gadu-Gadu: file transfer code tidying, first stage of receiving a file
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34389
diff changeset
60 */
ed78b0fc180e Gadu-Gadu: file transfer code tidying, first stage of receiving a file
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34389
diff changeset
61 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
62
ed78b0fc180e Gadu-Gadu: file transfer code tidying, first stage of receiving a file
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34389
diff changeset
63 /**
33299
b3c4ab3aeb7f Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33298
diff changeset
64 * Converts encoding of a given string from UTF-8 to CP1250.
15288
ee9ffc3db216 [gaim-migrate @ 18016]
Bartosz Oler <bartosz@pidgin.im>
parents: 14254
diff changeset
65 *
33299
b3c4ab3aeb7f Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33298
diff changeset
66 * @param src Input string.
15288
ee9ffc3db216 [gaim-migrate @ 18016]
Bartosz Oler <bartosz@pidgin.im>
parents: 14254
diff changeset
67 *
33299
b3c4ab3aeb7f Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33298
diff changeset
68 * @return Converted string (must be freed with g_free). If src is NULL,
b3c4ab3aeb7f Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33298
diff changeset
69 * then NULL is returned.
15288
ee9ffc3db216 [gaim-migrate @ 18016]
Bartosz Oler <bartosz@pidgin.im>
parents: 14254
diff changeset
70 */
33299
b3c4ab3aeb7f Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33298
diff changeset
71 gchar * ggp_convert_to_cp1250(const gchar *src);
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents:
diff changeset
72
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents:
diff changeset
73 /**
33299
b3c4ab3aeb7f Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33298
diff changeset
74 * Converts encoding of a given string from CP1250 to UTF-8.
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents:
diff changeset
75 *
33299
b3c4ab3aeb7f Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33298
diff changeset
76 * @param src Input string.
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents:
diff changeset
77 *
33299
b3c4ab3aeb7f Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33298
diff changeset
78 * @return Converted string (must be freed with g_free). If src is NULL,
b3c4ab3aeb7f Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33298
diff changeset
79 * then NULL is returned.
11414
10b74079ef15 [gaim-migrate @ 13651]
Bartosz Oler <bartosz@pidgin.im>
parents:
diff changeset
80 */
33299
b3c4ab3aeb7f Gadu-Gadu: utils refactoring, (partially) fix new account registration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33298
diff changeset
81 gchar * ggp_convert_from_cp1250(const gchar *src);
20289
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19859
diff changeset
82
33309
bc2f2ea7b5ab Gadu-Gadu: refactoring of account registration done
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33305
diff changeset
83 gboolean ggp_password_validate(const gchar *password);
bc2f2ea7b5ab Gadu-Gadu: refactoring of account registration done
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33305
diff changeset
84
33337
458d578d553d Gadu-Gadu: status refactoring - fix bug with long status
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33334
diff changeset
85 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
86
33339
02ee2834030c Gadu-Gadu: servers history feature
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33337
diff changeset
87 GSList * ggp_list_copy_to_slist_deep(GList *list, GCopyFunc func,
02ee2834030c Gadu-Gadu: servers history feature
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33337
diff changeset
88 gpointer user_data);
02ee2834030c Gadu-Gadu: servers history feature
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33337
diff changeset
89
02ee2834030c Gadu-Gadu: servers history feature
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33337
diff changeset
90 GList * ggp_strsplit_list(const gchar *string, const gchar *delimiter,
02ee2834030c Gadu-Gadu: servers history feature
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33337
diff changeset
91 gint max_tokens);
02ee2834030c Gadu-Gadu: servers history feature
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33337
diff changeset
92
02ee2834030c Gadu-Gadu: servers history feature
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33337
diff changeset
93 gchar * ggp_strjoin_list(const gchar *separator, GList *list);
02ee2834030c Gadu-Gadu: servers history feature
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33337
diff changeset
94
35144
3590ceb242b5 Gadu-Gadu: multilogon / other sessions dialog implementation. Refs #14366
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34429
diff changeset
95 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
96
34304
faf0414a8b51 Fix most of libpurple warnings about -Wsign-compare
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33348
diff changeset
97 GList * ggp_list_truncate(GList *list, guint length, GDestroyNotify free_func);
33339
02ee2834030c Gadu-Gadu: servers history feature
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33337
diff changeset
98
33347
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33339
diff changeset
99 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
100
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33339
diff changeset
101 const gchar * ggp_date_strftime(const gchar *format, time_t date);
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33339
diff changeset
102
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33339
diff changeset
103 time_t ggp_date_from_iso8601(const gchar *str);
cc3f8295618a Gadu-Gadu: setting public profile information. Fixes #6918
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33339
diff changeset
104
34361
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33348
diff changeset
105 uint64_t * ggp_uint64dup(uint64_t val);
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33348
diff changeset
106
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33348
diff changeset
107 gint ggp_int64_compare(gconstpointer a, gconstpointer b);
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33348
diff changeset
108
34384
c81441091162 Simple, but (partially) working outgoing file transfer
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34361
diff changeset
109 JsonParser * ggp_json_parse(const gchar *data);
c81441091162 Simple, but (partially) working outgoing file transfer
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34361
diff changeset
110
33300
c671ae84307f Updated libgadu to 1.11.2, configure.ac refactoring
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33299
diff changeset
111 #endif /* _GGP_UTILS_H */

mercurial