annotate src/util.h @ 6629:bdc448cf4cb6

[gaim-migrate @ 7153] Tim Ringenbach (marv_sf) writes: " This patch makes sending colors in yahoo work. It also makes a few changing to receiving them, and addresses most of the problems with that patch (which I think were all related to the fact it didn't do outgoing colors). It now handles bold, italic, underline, font face, font size, and font color in both directions. It disables the background color button if the prpl is yahoo (in a generic way), and farthermore strips out any <body> tags that the user might try to type anyway (the yahoo server purposely mangles them). It also adds a line to g_strescape some debug messages because I got tired them of changing the color of my terminal. I think I got all the bugs out. If you run with -d or open the debug window, it will show you what both conversion function returned, which should help track down any problems." committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Tue, 26 Aug 2003 01:34:51 +0000
parents 2fed50891afa
children 41120df7ed94
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4890
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1 /**
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2 * @file util.h Utility Functions
5034
4691c5936c01 [gaim-migrate @ 5377]
Christian Hammond <chipx86@chipx86.com>
parents: 4890
diff changeset
3 * @ingroup core
4890
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5 * gaim
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
7 * Copyright (C) 2002-2003, Christian Hammond <chipx86@gnupdate.org>
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
8 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
9 * This program is free software; you can redistribute it and/or modify
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
10 * it under the terms of the GNU General Public License as published by
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 * (at your option) any later version.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful,
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 * GNU General Public License for more details.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 * along with this program; if not, write to the Free Software
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
22 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
23 * @todo Rename the functions so that they live somewhere in the gaim
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
24 * namespace.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
25 */
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
26 #ifndef _GAIM_UTIL_H_
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
27 #define _GAIM_UTIL_H_
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
28
6474
2fed50891afa [gaim-migrate @ 6983]
Christian Hammond <chipx86@chipx86.com>
parents: 5944
diff changeset
29 #include <stdio.h>
2fed50891afa [gaim-migrate @ 6983]
Christian Hammond <chipx86@chipx86.com>
parents: 5944
diff changeset
30
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5532
diff changeset
31 #include "account.h"
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5532
diff changeset
32
5944
158196b2db19 [gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents: 5943
diff changeset
33 #ifdef __cplusplus
158196b2db19 [gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents: 5943
diff changeset
34 extern "C" {
158196b2db19 [gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents: 5943
diff changeset
35 #endif
158196b2db19 [gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents: 5943
diff changeset
36
4890
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
37 /**
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
38 * Normalizes a string, so that it is suitable for comparison.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
39 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
40 * The returned string will point to a static buffer, so if the
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
41 * string is intended to be kept long-term, you <i>must</i>
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
42 * g_strdup() it. Also, calling normalize() twice in the same line
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
43 * will lead to problems.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
44 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
45 * @param str The string to normalize.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
46 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
47 * @return A pointer to the normalized version stored in a static buffer.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
48 */
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
49 char *normalize(const char *str);
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
50
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
51 /**
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
52 * Converts a string to its base-64 equivalent.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
53 *
5426
8d8bf0d31a23 [gaim-migrate @ 5805]
Nathan Walp <nwalp@pidgin.im>
parents: 5136
diff changeset
54 * @param buf The data to convert.
5532
6f35b80c5ffa [gaim-migrate @ 5932]
Luke Schierer <lschiere@pidgin.im>
parents: 5515
diff changeset
55 * @param len The length of the data.
4890
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
56 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
57 * @return The base-64 version of @a str.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
58 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
59 * @see frombase64()
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
60 */
5426
8d8bf0d31a23 [gaim-migrate @ 5805]
Nathan Walp <nwalp@pidgin.im>
parents: 5136
diff changeset
61 char *tobase64(const unsigned char *buf, size_t len);
4890
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
62
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
63 /**
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
64 * Converts a string back from its base-64 equivalent.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
65 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
66 * @param str The string to convert back.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
67 * @param ret_str The returned, non-base-64 string.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
68 * @param ret_len The returned string length.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
69 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
70 * @see tobase64()
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
71 */
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
72 void frombase64(const char *str, char **ret_str, int *ret_len);
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
73
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
74 /**
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
75 * Converts a string to its base-16 equivalent.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
76 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
77 * @param str The string to convert.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
78 * @param len The length of the string.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
79 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
80 * @return The base-16 string.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
81 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
82 * @see frombase16()
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
83 */
5451
e1cc0c67e123 [gaim-migrate @ 5839]
Nathan Walp <nwalp@pidgin.im>
parents: 5426
diff changeset
84 unsigned char *tobase16(const unsigned char *str, int len);
4890
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
85
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
86 /**
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
87 * Converts a string back from its base-16 equivalent.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
88 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
89 * @param str The string to convert back.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
90 * @param ret_str The returned, non-base-16 string.
5451
e1cc0c67e123 [gaim-migrate @ 5839]
Nathan Walp <nwalp@pidgin.im>
parents: 5426
diff changeset
91 *
4890
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
92 * @return The length of the returned string.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
93 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
94 * @see tobase16()
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
95 */
5497
3c7748b24410 [gaim-migrate @ 5893]
Mark Doliner <mark@kingant.net>
parents: 5451
diff changeset
96 int frombase16(const char *str, unsigned char **ret_str);
4890
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
97
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
98 /**
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
99 * Waits for all child processes to terminate.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
100 */
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
101 void clean_pid(void);
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
102
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
103 /**
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
104 * Returns the current local time in hour:minute:second form.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
105 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
106 * The returned string is stored in a static buffer, so the result
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
107 * should be g_strdup()'d if it's intended to be used for long.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
108 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
109 * @return The current local time.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
110 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
111 * @see full_date()
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
112 */
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
113 char *date(void);
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
114
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
115 /**
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
116 * Adds the necessary HTML code to turn URIs into HTML links in a string.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
117 *
5136
381da05cb5ed [gaim-migrate @ 5500]
Nathan Walp <nwalp@pidgin.im>
parents: 5034
diff changeset
118 * @param str The string to linkify.
4890
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
119 *
5136
381da05cb5ed [gaim-migrate @ 5500]
Nathan Walp <nwalp@pidgin.im>
parents: 5034
diff changeset
120 * @return The linkified text.
4890
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
121 */
5136
381da05cb5ed [gaim-migrate @ 5500]
Nathan Walp <nwalp@pidgin.im>
parents: 5034
diff changeset
122 char *linkify_text(const char *str);
4890
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
123
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
124 /**
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
125 * Converts seconds into a human-readable form.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
126 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
127 * @param sec The seconds.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
128 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
129 * @return A human-readable form, containing days, hours, minutes, and
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
130 * seconds.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
131 */
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
132 char *sec_to_text(guint sec);
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
133
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
134 /**
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
135 * Returns the date and time in human-readable form.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
136 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
137 * The returned string is stored in a static buffer, so the result
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
138 * should be g_strdup()'d if it's intended to be used for long.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
139 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
140 * @return The date and time in human-readable form.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
141 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
142 * @see date()
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
143 */
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5532
diff changeset
144 char *full_date(void);
4890
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
145
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
146 /**
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
147 * Looks for %n, %d, or %t in a string, and replaces them with the
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
148 * specified name, date, and time, respectively.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
149 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
150 * The returned string is stored in a static buffer, so the result
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
151 * should be g_strdup()'d if it's intended to be used for long.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
152 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
153 * @param str The string that may contain the special variables.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
154 * @param name The sender name.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
155 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
156 * @return A new string where the special variables are expanded.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
157 */
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
158 char *away_subs(const char *str, const char *name);
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
159
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
160 /**`
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
161 * Returns the user's home directory.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
162 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
163 * @return The user's home directory.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
164 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
165 * @see gaim_user_dir()
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
166 */
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
167 const gchar *gaim_home_dir(void);
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
168
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
169 /**
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
170 * Returns the gaim settings directory in the user's home directory.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
171 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
172 * @return The gaim settings directory.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
173 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
174 * @see gaim_home_dir()
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
175 */
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
176 char *gaim_user_dir(void);
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
177
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
178 /**
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
179 * Copies a string and replaces all HTML linebreaks with newline characters.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
180 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
181 * @param dest The destination string.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
182 * @param src The source string.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
183 * @param dest_len The destination string length.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
184 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
185 * @see strncpy_withhtml()
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
186 * @see strdup_withhtml()
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
187 */
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
188 void strncpy_nohtml(gchar *dest, const gchar *src, size_t dest_len);
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
189
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
190 /**
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
191 * Copies a string and replaces all newline characters with HTML linebreaks.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
192 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
193 * @param dest The destination string.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
194 * @param src The source string.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
195 * @param dest_len The destination string length.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
196 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
197 * @see strncpy_nohtml()
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
198 * @see strdup_withhtml()
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
199 */
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
200 void strncpy_withhtml(gchar *dest, const gchar *src, size_t dest_len);
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
201
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
202 /**
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
203 * Duplicates a string and replaces all newline characters from the
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
204 * source string with HTML linebreaks.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
205 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
206 * @param src The source string.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
207 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
208 * @return The new string.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
209 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
210 * @see strncpy_nohtml()
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
211 * @see strncpy_withhtml()
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
212 */
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
213 gchar *strdup_withhtml(const gchar *src);
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
214
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
215 /**
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
216 * Ensures that all linefeeds have a matching carriage return.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
217 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
218 * @param str The source string.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
219 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
220 * @return The string with carriage returns.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
221 */
5136
381da05cb5ed [gaim-migrate @ 5500]
Nathan Walp <nwalp@pidgin.im>
parents: 5034
diff changeset
222 char *add_cr(const char *);
4890
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
223
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
224 /**
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
225 * Strips all linefeeds from a string.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
226 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
227 * @param str The string to strip linefeeds from.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
228 */
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
229 void strip_linefeed(char *str);
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
230
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
231 /**
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
232 * Builds a time_t from the supplied information.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
233 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
234 * @param year The year.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
235 * @param month The month.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
236 * @param day The day.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
237 * @param hour The hour.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
238 * @param min The minute.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
239 * @param sec The second.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
240 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
241 * @return A time_t.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
242 */
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
243 time_t get_time(int year, int month, int day,
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5532
diff changeset
244 int hour, int min, int sec);
4890
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
245
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
246 /**
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
247 * Creates a temporary file and returns a file pointer to it.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
248 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
249 * This is like mkstemp(), but returns a file pointer and uses a
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
250 * pre-set template. It uses the semantics of tempnam() for the
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
251 * directory to use and allocates the space for the file path.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
252 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
253 * The caller is responsible for closing the file and removing it when
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
254 * done, as well as freeing the space pointed to by @a path with
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
255 * g_free().
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
256 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
257 * @param path The returned path to the temp file.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
258 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
259 * @return A file pointer to the temporary file, or @c NULL on failure.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
260 */
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
261 FILE *gaim_mkstemp(gchar **path);
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
262
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
263 /**
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
264 * Attempts to convert a string to UTF-8 from an unknown encoding.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
265 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
266 * This function checks the locale and tries sane defaults.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
267 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
268 * @param str The source string.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
269 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
270 * @return The UTF-8 string, or @c NULL if it could not be converted.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
271 */
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
272 char *gaim_try_conv_to_utf8(const char *str);
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
273
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
274 /**
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
275 * Returns the IP address from a socket file descriptor.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
276 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
277 * @param fd The socket file descriptor.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
278 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
279 * @return The IP address, or @c NULL on error.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
280 */
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
281 char *gaim_getip_from_fd(int fd);
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
282
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
283 /**
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
284 * Compares two UTF-8 strings.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
285 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
286 * @param a The first string.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
287 * @param b The second string.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
288 *
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
289 * @return -1 if @a is less than @a b.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
290 * 0 if @a is equal to @a b.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
291 * 1 if @a is greater than @a b.
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
292 */
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
293 gint gaim_utf8_strcasecmp(const gchar *a, const gchar *b);
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
294
5515
439a05a6b409 [gaim-migrate @ 5914]
Mark Doliner <mark@kingant.net>
parents: 5497
diff changeset
295 /**
439a05a6b409 [gaim-migrate @ 5914]
Mark Doliner <mark@kingant.net>
parents: 5497
diff changeset
296 * Given a string, this replaces one substring with another
439a05a6b409 [gaim-migrate @ 5914]
Mark Doliner <mark@kingant.net>
parents: 5497
diff changeset
297 * and returns a newly allocated string.
439a05a6b409 [gaim-migrate @ 5914]
Mark Doliner <mark@kingant.net>
parents: 5497
diff changeset
298 *
439a05a6b409 [gaim-migrate @ 5914]
Mark Doliner <mark@kingant.net>
parents: 5497
diff changeset
299 * @param string The string from which to replace stuff.
439a05a6b409 [gaim-migrate @ 5914]
Mark Doliner <mark@kingant.net>
parents: 5497
diff changeset
300 * @param delimiter The substring you want replaced.
439a05a6b409 [gaim-migrate @ 5914]
Mark Doliner <mark@kingant.net>
parents: 5497
diff changeset
301 * @param replacement The substring you want inserted in place
439a05a6b409 [gaim-migrate @ 5914]
Mark Doliner <mark@kingant.net>
parents: 5497
diff changeset
302 * of the delimiting substring.
439a05a6b409 [gaim-migrate @ 5914]
Mark Doliner <mark@kingant.net>
parents: 5497
diff changeset
303 */
5874
964e4f94fc56 [gaim-migrate @ 6306]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
304 gchar *gaim_strreplace(const gchar *string, const gchar *delimiter,
964e4f94fc56 [gaim-migrate @ 6306]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
305 const gchar *replacement);
5515
439a05a6b409 [gaim-migrate @ 5914]
Mark Doliner <mark@kingant.net>
parents: 5497
diff changeset
306
5826
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5563
diff changeset
307 /**
5944
158196b2db19 [gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents: 5943
diff changeset
308 * Returns a string representing a filesize in the appropriate
158196b2db19 [gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents: 5943
diff changeset
309 * units (MB, KB, GB, etc.)
5826
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5563
diff changeset
310 *
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5563
diff changeset
311 * @param size The size
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5563
diff changeset
312 */
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5563
diff changeset
313 char *gaim_get_size_string(size_t size);
bd0d0e89cac3 [gaim-migrate @ 6256]
Sean Egan <seanegan@gmail.com>
parents: 5563
diff changeset
314
5944
158196b2db19 [gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents: 5943
diff changeset
315 #ifdef __cplusplus
158196b2db19 [gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents: 5943
diff changeset
316 }
158196b2db19 [gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents: 5943
diff changeset
317 #endif
158196b2db19 [gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents: 5943
diff changeset
318
4890
89cb14edf8cf [gaim-migrate @ 5220]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
319 #endif /* _GAIM_UTIL_H_ */