rename accountopt.[ch] to purpleaccountoption.[ch]
[pidgin-git.git] / libpurple / protocols / gg / utils.h
blob32040482039b44a2c98a14de349da256a480cca7
1 /* purple
3 * Purple is the legal property of its developers, whose names are too numerous
4 * to list here. Please refer to the COPYRIGHT file distributed with this
5 * source distribution.
7 * Rewritten from scratch during Google Summer of Code 2012
8 * by Tomek Wasilczyk (http://www.wasilczyk.pl).
10 * Previously implemented by:
11 * - Arkadiusz Miskiewicz <misiek@pld.org.pl> - first implementation (2001);
12 * - Bartosz Oler <bartosz@bzimage.us> - reimplemented during GSoC 2005;
13 * - Krzysztof Klinikowski <grommasher@gmail.com> - some parts (2009-2011).
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.
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.
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
27 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
30 #ifndef PURPLE_GG_UTILS_H
31 #define PURPLE_GG_UTILS_H
33 #include <internal.h>
34 #include <libgadu.h>
35 #include <json-glib/json-glib.h>
37 /**
38 * Converts stringified UIN to uin_t.
40 * @param str The string to convert.
42 * @return Converted UIN or 0 if an error occurred.
44 uin_t ggp_str_to_uin(const char *str);
46 /**
47 * Stringifies UIN.
49 * @param uin UIN to stringify.
51 * @return Stringified UIN.
53 const char * ggp_uin_to_str(uin_t uin);
55 /**
56 * Gets UIN for the account.
58 * @param gc The connection, in which account is connected.
59 * @return UIN for this account.
61 uin_t ggp_get_my_uin(PurpleConnection *gc);
63 /**
64 * Converts encoding of a given string from UTF-8 to CP1250.
66 * @param src Input string.
68 * @return Converted string (must be freed with g_free). If src is NULL,
69 * then NULL is returned.
71 gchar * ggp_convert_to_cp1250(const gchar *src);
73 /**
74 * Converts encoding of a given string from CP1250 to UTF-8.
76 * @param src Input string.
78 * @return Converted string (must be freed with g_free). If src is NULL,
79 * then NULL is returned.
81 gchar * ggp_convert_from_cp1250(const gchar *src);
83 gboolean ggp_password_validate(const gchar *password);
85 gchar * ggp_utf8_strndup(const gchar *str, gsize n);
87 GSList * ggp_list_copy_to_slist_deep(GList *list, GCopyFunc func,
88 gpointer user_data);
90 GList * ggp_strsplit_list(const gchar *string, const gchar *delimiter,
91 gint max_tokens);
93 gchar * ggp_strjoin_list(const gchar *separator, GList *list);
95 const gchar * ggp_ipv4_to_str(uint32_t raw_ip);
97 GList * ggp_list_truncate(GList *list, guint length, GDestroyNotify free_func);
99 gchar * ggp_free_if_equal(gchar *str, const gchar *pattern);
101 const gchar * ggp_date_strftime(const gchar *format, time_t date);
103 time_t ggp_date_from_iso8601(const gchar *str);
105 uint64_t * ggp_uint64dup(uint64_t val);
107 gint ggp_int64_compare(gconstpointer a, gconstpointer b);
109 JsonParser * ggp_json_parse(const gchar *data);
111 #endif /* PURPLE_GG_UTILS_H */