Sun, 21 May 2006 03:10:46 +0000
[gaim-migrate @ 16195]
Rest of SF Patch #1492122 from Sadrul
Some typo fixes and doc cleanups.
committer: Richard Laager <rlaager@pidgin.im>
| 4890 | 1 | /** |
| 2 | * @file util.h Utility Functions | |
|
5034
077678f7b048
[gaim-migrate @ 5377]
Christian Hammond <chipx86@chipx86.com>
parents:
4890
diff
changeset
|
3 | * @ingroup core |
| 4890 | 4 | * |
| 5 | * gaim | |
| 6 | * | |
| 8046 | 7 | * Gaim is the legal property of its developers, whose names are too numerous |
| 8 | * to list here. Please refer to the COPYRIGHT file distributed with this | |
| 9 | * source distribution. | |
|
7094
8f9588491993
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
10 | * |
| 4890 | 11 | * This program is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by | |
| 13 | * the Free Software Foundation; either version 2 of the License, or | |
| 14 | * (at your option) any later version. | |
| 15 | * | |
| 16 | * This program is distributed in the hope that it will be useful, | |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 19 | * GNU General Public License for more details. | |
| 20 | * | |
| 21 | * You should have received a copy of the GNU General Public License | |
| 22 | * along with this program; if not, write to the Free Software | |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 24 | * | |
| 25 | * @todo Rename the functions so that they live somewhere in the gaim | |
| 26 | * namespace. | |
| 27 | */ | |
| 28 | #ifndef _GAIM_UTIL_H_ | |
| 29 | #define _GAIM_UTIL_H_ | |
| 30 | ||
|
6474
12d3fe5e5b1b
[gaim-migrate @ 6983]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
31 | #include <stdio.h> |
|
12d3fe5e5b1b
[gaim-migrate @ 6983]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
32 | |
|
5563
d5a7852aa0cb
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5532
diff
changeset
|
33 | #include "account.h" |
|
10425
d82cef15da95
[gaim-migrate @ 11677]
Mark Doliner <markdoliner@pidgin.im>
parents:
10415
diff
changeset
|
34 | #include "xmlnode.h" |
|
5563
d5a7852aa0cb
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5532
diff
changeset
|
35 | |
|
5944
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5943
diff
changeset
|
36 | #ifdef __cplusplus |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5943
diff
changeset
|
37 | extern "C" { |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5943
diff
changeset
|
38 | #endif |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5943
diff
changeset
|
39 | |
| 12919 | 40 | typedef struct _GaimMenuAction |
| 41 | { | |
| 42 | char *label; | |
| 43 | GaimCallback callback; | |
| 44 | gpointer data; | |
| 45 | GList *children; | |
| 46 | } GaimMenuAction; | |
| 12106 | 47 | |
|
13105
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
48 | typedef char *(*GaimInfoFieldFormatCallback)(const char *field, size_t len); |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
49 | |
| 12106 | 50 | /** |
| 51 | * A key-value pair. | |
| 52 | * | |
| 53 | * This is used by, among other things, gaim_gtk_combo* functions to pass in a | |
| 54 | * list of key-value pairs so it can display a user-friendly value. | |
| 55 | */ | |
| 56 | typedef struct _GaimKeyValuePair | |
| 57 | { | |
| 58 | gchar *key; | |
| 59 | void *value; | |
| 60 | ||
| 61 | } GaimKeyValuePair; | |
| 62 | ||
| 12919 | 63 | /** |
| 64 | * Creates a new GaimMenuAction. | |
|
13103
81ccb40de82b
[gaim-migrate @ 15464]
Richard Laager <rlaager@pidgin.im>
parents:
13090
diff
changeset
|
65 | * |
| 12919 | 66 | * @param label The text label to display for this action. |
| 67 | * @param callback The function to be called when the action is used on | |
| 68 | * the selected item. | |
| 69 | * @param data Additional data to be passed to the callback. | |
| 70 | * @param children A GList of GaimMenuActions to be added as a submenu | |
| 71 | * of the action. | |
| 72 | * @return The GaimMenuAction. | |
| 73 | */ | |
|
13103
81ccb40de82b
[gaim-migrate @ 15464]
Richard Laager <rlaager@pidgin.im>
parents:
13090
diff
changeset
|
74 | GaimMenuAction *gaim_menu_action_new(const char *label, GaimCallback callback, |
| 12919 | 75 | gpointer data, GList *children); |
| 12106 | 76 | |
|
13103
81ccb40de82b
[gaim-migrate @ 15464]
Richard Laager <rlaager@pidgin.im>
parents:
13090
diff
changeset
|
77 | /** |
|
81ccb40de82b
[gaim-migrate @ 15464]
Richard Laager <rlaager@pidgin.im>
parents:
13090
diff
changeset
|
78 | * Frees a GaimMenuAction |
|
81ccb40de82b
[gaim-migrate @ 15464]
Richard Laager <rlaager@pidgin.im>
parents:
13090
diff
changeset
|
79 | * |
|
81ccb40de82b
[gaim-migrate @ 15464]
Richard Laager <rlaager@pidgin.im>
parents:
13090
diff
changeset
|
80 | * @param act The GaimMenuAction to free. |
|
81ccb40de82b
[gaim-migrate @ 15464]
Richard Laager <rlaager@pidgin.im>
parents:
13090
diff
changeset
|
81 | */ |
|
81ccb40de82b
[gaim-migrate @ 15464]
Richard Laager <rlaager@pidgin.im>
parents:
13090
diff
changeset
|
82 | void gaim_menu_action_free(GaimMenuAction *act); |
|
81ccb40de82b
[gaim-migrate @ 15464]
Richard Laager <rlaager@pidgin.im>
parents:
13090
diff
changeset
|
83 | |
|
7108
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
84 | /**************************************************************************/ |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
85 | /** @name Base16 Functions */ |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
86 | /**************************************************************************/ |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
87 | /*@{*/ |
| 4890 | 88 | |
| 89 | /** | |
|
11127
5e539d9d26a4
[gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents:
10871
diff
changeset
|
90 | * Converts a chunk of binary data to its base-16 equivalent. |
| 4890 | 91 | * |
|
11127
5e539d9d26a4
[gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents:
10871
diff
changeset
|
92 | * @param data The data to convert. |
|
5e539d9d26a4
[gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents:
10871
diff
changeset
|
93 | * @param len The length of the data. |
| 4890 | 94 | * |
|
11127
5e539d9d26a4
[gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents:
10871
diff
changeset
|
95 | * @return The base-16 string in the ASCII encoding. Must be |
|
5e539d9d26a4
[gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents:
10871
diff
changeset
|
96 | * g_free'd when no longer needed. |
| 4890 | 97 | * |
|
7123
a308c150e74a
[gaim-migrate @ 7690]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
98 | * @see gaim_base16_decode() |
| 4890 | 99 | */ |
|
11137
cf40226ddff7
[gaim-migrate @ 13201]
Mark Doliner <markdoliner@pidgin.im>
parents:
11135
diff
changeset
|
100 | gchar *gaim_base16_encode(const guchar *data, gsize len); |
| 4890 | 101 | |
| 102 | /** | |
|
11127
5e539d9d26a4
[gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents:
10871
diff
changeset
|
103 | * Converts an ASCII string of base-16 encoded data to |
|
5e539d9d26a4
[gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents:
10871
diff
changeset
|
104 | * the binary equivalent. |
| 4890 | 105 | * |
|
11127
5e539d9d26a4
[gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents:
10871
diff
changeset
|
106 | * @param str The base-16 string to convert to raw data. |
|
5e539d9d26a4
[gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents:
10871
diff
changeset
|
107 | * @param ret_len The length of the returned data. You can |
|
5e539d9d26a4
[gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents:
10871
diff
changeset
|
108 | * pass in NULL if you're sure that you know |
|
5e539d9d26a4
[gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents:
10871
diff
changeset
|
109 | * the length of the decoded data, or if you |
|
5e539d9d26a4
[gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents:
10871
diff
changeset
|
110 | * know you'll be able to use strlen to |
|
5e539d9d26a4
[gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents:
10871
diff
changeset
|
111 | * determine the length, etc. |
| 5451 | 112 | * |
|
11127
5e539d9d26a4
[gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents:
10871
diff
changeset
|
113 | * @return The raw data. Must be g_free'd when no longer needed. |
| 4890 | 114 | * |
|
7123
a308c150e74a
[gaim-migrate @ 7690]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
115 | * @see gaim_base16_encode() |
| 4890 | 116 | */ |
|
11137
cf40226ddff7
[gaim-migrate @ 13201]
Mark Doliner <markdoliner@pidgin.im>
parents:
11135
diff
changeset
|
117 | guchar *gaim_base16_decode(const char *str, gsize *ret_len); |
| 4890 | 118 | |
|
7108
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
119 | /*@}*/ |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
120 | |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
121 | /**************************************************************************/ |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
122 | /** @name Base64 Functions */ |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
123 | /**************************************************************************/ |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
124 | /*@{*/ |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
125 | |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
126 | /** |
|
11127
5e539d9d26a4
[gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents:
10871
diff
changeset
|
127 | * Converts a chunk of binary data to its base-64 equivalent. |
|
7108
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
128 | * |
|
11127
5e539d9d26a4
[gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents:
10871
diff
changeset
|
129 | * @param data The data to convert. |
|
5e539d9d26a4
[gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents:
10871
diff
changeset
|
130 | * @param len The length of the data. |
|
7108
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
131 | * |
|
11127
5e539d9d26a4
[gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents:
10871
diff
changeset
|
132 | * @return The base-64 string in the ASCII encoding. Must be |
|
5e539d9d26a4
[gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents:
10871
diff
changeset
|
133 | * g_free'd when no longer needed. |
|
7108
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
134 | * |
|
7123
a308c150e74a
[gaim-migrate @ 7690]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
135 | * @see gaim_base64_decode() |
|
7108
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
136 | */ |
|
11137
cf40226ddff7
[gaim-migrate @ 13201]
Mark Doliner <markdoliner@pidgin.im>
parents:
11135
diff
changeset
|
137 | gchar *gaim_base64_encode(const guchar *data, gsize len); |
|
7108
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
138 | |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
139 | /** |
|
11127
5e539d9d26a4
[gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents:
10871
diff
changeset
|
140 | * Converts an ASCII string of base-64 encoded data to |
|
5e539d9d26a4
[gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents:
10871
diff
changeset
|
141 | * the binary equivalent. |
|
7108
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
142 | * |
|
11127
5e539d9d26a4
[gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents:
10871
diff
changeset
|
143 | * @param str The base-64 string to convert to raw data. |
|
5e539d9d26a4
[gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents:
10871
diff
changeset
|
144 | * @param ret_len The length of the returned data. You can |
|
5e539d9d26a4
[gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents:
10871
diff
changeset
|
145 | * pass in NULL if you're sure that you know |
|
5e539d9d26a4
[gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents:
10871
diff
changeset
|
146 | * the length of the decoded data, or if you |
|
5e539d9d26a4
[gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents:
10871
diff
changeset
|
147 | * know you'll be able to use strlen to |
|
5e539d9d26a4
[gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents:
10871
diff
changeset
|
148 | * determine the length, etc. |
|
5e539d9d26a4
[gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents:
10871
diff
changeset
|
149 | * |
|
5e539d9d26a4
[gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents:
10871
diff
changeset
|
150 | * @return The raw data. Must be g_free'd when no longer needed. |
|
7108
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
151 | * |
|
7123
a308c150e74a
[gaim-migrate @ 7690]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
152 | * @see gaim_base64_encode() |
|
7108
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
153 | */ |
|
11137
cf40226ddff7
[gaim-migrate @ 13201]
Mark Doliner <markdoliner@pidgin.im>
parents:
11135
diff
changeset
|
154 | guchar *gaim_base64_decode(const char *str, gsize *ret_len); |
|
7108
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
155 | |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
156 | /*@}*/ |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
157 | |
|
7679
c9804d02dcab
[gaim-migrate @ 8323]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7675
diff
changeset
|
158 | /**************************************************************************/ |
|
c9804d02dcab
[gaim-migrate @ 8323]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7675
diff
changeset
|
159 | /** @name Quoted Printable Functions */ |
|
c9804d02dcab
[gaim-migrate @ 8323]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7675
diff
changeset
|
160 | /**************************************************************************/ |
|
c9804d02dcab
[gaim-migrate @ 8323]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7675
diff
changeset
|
161 | /*@{*/ |
|
c9804d02dcab
[gaim-migrate @ 8323]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7675
diff
changeset
|
162 | |
|
c9804d02dcab
[gaim-migrate @ 8323]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7675
diff
changeset
|
163 | /** |
|
c9804d02dcab
[gaim-migrate @ 8323]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7675
diff
changeset
|
164 | * Converts a quoted printable string back to its readable equivalent. |
|
11132
eeb2afd70f70
[gaim-migrate @ 13189]
Mark Doliner <markdoliner@pidgin.im>
parents:
11127
diff
changeset
|
165 | * What is a quoted printable string, you ask? It's an encoding used |
|
eeb2afd70f70
[gaim-migrate @ 13189]
Mark Doliner <markdoliner@pidgin.im>
parents:
11127
diff
changeset
|
166 | * to transmit binary data as ASCII. It's intended purpose is to send |
|
eeb2afd70f70
[gaim-migrate @ 13189]
Mark Doliner <markdoliner@pidgin.im>
parents:
11127
diff
changeset
|
167 | * e-mails containing non-ASCII characters. Wikipedia has a pretty good |
|
eeb2afd70f70
[gaim-migrate @ 13189]
Mark Doliner <markdoliner@pidgin.im>
parents:
11127
diff
changeset
|
168 | * explanation. Also see RFC 2045. |
|
7679
c9804d02dcab
[gaim-migrate @ 8323]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7675
diff
changeset
|
169 | * |
|
11132
eeb2afd70f70
[gaim-migrate @ 13189]
Mark Doliner <markdoliner@pidgin.im>
parents:
11127
diff
changeset
|
170 | * @param str The quoted printable ASCII string to convert to raw data. |
|
11501
a8fc92026134
[gaim-migrate @ 13746]
Richard Laager <rlaager@pidgin.im>
parents:
11153
diff
changeset
|
171 | * @param ret_len The length of the returned data. |
|
11132
eeb2afd70f70
[gaim-migrate @ 13189]
Mark Doliner <markdoliner@pidgin.im>
parents:
11127
diff
changeset
|
172 | * |
|
11501
a8fc92026134
[gaim-migrate @ 13746]
Richard Laager <rlaager@pidgin.im>
parents:
11153
diff
changeset
|
173 | * @return The readable string. Must be g_free'd when no longer needed. |
|
7679
c9804d02dcab
[gaim-migrate @ 8323]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7675
diff
changeset
|
174 | */ |
|
11137
cf40226ddff7
[gaim-migrate @ 13201]
Mark Doliner <markdoliner@pidgin.im>
parents:
11135
diff
changeset
|
175 | guchar *gaim_quotedp_decode(const char *str, gsize *ret_len); |
|
7679
c9804d02dcab
[gaim-migrate @ 8323]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7675
diff
changeset
|
176 | |
|
c9804d02dcab
[gaim-migrate @ 8323]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7675
diff
changeset
|
177 | /*@}*/ |
|
c9804d02dcab
[gaim-migrate @ 8323]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7675
diff
changeset
|
178 | |
|
c9804d02dcab
[gaim-migrate @ 8323]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7675
diff
changeset
|
179 | /**************************************************************************/ |
|
c9804d02dcab
[gaim-migrate @ 8323]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7675
diff
changeset
|
180 | /** @name MIME Functions */ |
|
c9804d02dcab
[gaim-migrate @ 8323]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7675
diff
changeset
|
181 | /**************************************************************************/ |
|
c9804d02dcab
[gaim-migrate @ 8323]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7675
diff
changeset
|
182 | /*@{*/ |
|
c9804d02dcab
[gaim-migrate @ 8323]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7675
diff
changeset
|
183 | |
|
c9804d02dcab
[gaim-migrate @ 8323]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7675
diff
changeset
|
184 | /** |
|
c9804d02dcab
[gaim-migrate @ 8323]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7675
diff
changeset
|
185 | * Converts a MIME header field string back to its readable equivalent |
| 8432 | 186 | * according to RFC 2047. Basically, a header is plain ASCII and can |
| 187 | * contain any number of sections called "encoded-words." The format | |
|
7821
d15fc781c318
[gaim-migrate @ 8473]
Mark Doliner <markdoliner@pidgin.im>
parents:
7679
diff
changeset
|
188 | * of an encoded word is =?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?= |
|
d15fc781c318
[gaim-migrate @ 8473]
Mark Doliner <markdoliner@pidgin.im>
parents:
7679
diff
changeset
|
189 | * =? designates the beginning of the encoded-word |
|
d15fc781c318
[gaim-migrate @ 8473]
Mark Doliner <markdoliner@pidgin.im>
parents:
7679
diff
changeset
|
190 | * ?= designates the end of the encoded-word |
|
11135
063678d038f9
[gaim-migrate @ 13196]
Mark Doliner <markdoliner@pidgin.im>
parents:
11132
diff
changeset
|
191 | * |
|
063678d038f9
[gaim-migrate @ 13196]
Mark Doliner <markdoliner@pidgin.im>
parents:
11132
diff
changeset
|
192 | * An encoded word is segmented into three pieces by the use of a |
|
063678d038f9
[gaim-migrate @ 13196]
Mark Doliner <markdoliner@pidgin.im>
parents:
11132
diff
changeset
|
193 | * question mark. The first piece is the character set, the second |
|
063678d038f9
[gaim-migrate @ 13196]
Mark Doliner <markdoliner@pidgin.im>
parents:
11132
diff
changeset
|
194 | * piece is the encoding, and the third piece is the encoded text. |
|
7679
c9804d02dcab
[gaim-migrate @ 8323]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7675
diff
changeset
|
195 | * |
|
11135
063678d038f9
[gaim-migrate @ 13196]
Mark Doliner <markdoliner@pidgin.im>
parents:
11132
diff
changeset
|
196 | * @param str The ASCII string, possibly containing any number of |
|
063678d038f9
[gaim-migrate @ 13196]
Mark Doliner <markdoliner@pidgin.im>
parents:
11132
diff
changeset
|
197 | * encoded-word sections. |
|
7679
c9804d02dcab
[gaim-migrate @ 8323]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7675
diff
changeset
|
198 | * |
|
11135
063678d038f9
[gaim-migrate @ 13196]
Mark Doliner <markdoliner@pidgin.im>
parents:
11132
diff
changeset
|
199 | * @return The string, with any encoded-word sections decoded and |
|
063678d038f9
[gaim-migrate @ 13196]
Mark Doliner <markdoliner@pidgin.im>
parents:
11132
diff
changeset
|
200 | * converted to UTF-8. Must be g_free'd when no longer |
|
063678d038f9
[gaim-migrate @ 13196]
Mark Doliner <markdoliner@pidgin.im>
parents:
11132
diff
changeset
|
201 | * needed. |
|
7679
c9804d02dcab
[gaim-migrate @ 8323]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7675
diff
changeset
|
202 | */ |
|
11135
063678d038f9
[gaim-migrate @ 13196]
Mark Doliner <markdoliner@pidgin.im>
parents:
11132
diff
changeset
|
203 | char *gaim_mime_decode_field(const char *str); |
|
7679
c9804d02dcab
[gaim-migrate @ 8323]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7675
diff
changeset
|
204 | |
|
c9804d02dcab
[gaim-migrate @ 8323]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7675
diff
changeset
|
205 | /*@}*/ |
|
c9804d02dcab
[gaim-migrate @ 8323]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7675
diff
changeset
|
206 | |
|
7108
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
207 | |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
208 | /**************************************************************************/ |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
209 | /** @name Date/Time Functions */ |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
210 | /**************************************************************************/ |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
211 | /*@{*/ |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
212 | |
| 4890 | 213 | /** |
|
13105
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
214 | * Formats a time into the specified format. |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
215 | * |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
216 | * This is essentially strftime(), but it has a static buffer |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
217 | * and handles the UTF-8 conversion for the caller. |
|
13120
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13105
diff
changeset
|
218 | * |
|
13153
3e0b91a83516
[gaim-migrate @ 15515]
Richard Laager <rlaager@pidgin.im>
parents:
13120
diff
changeset
|
219 | * This function also provides the GNU %z formatter if the underlying C |
|
3e0b91a83516
[gaim-migrate @ 15515]
Richard Laager <rlaager@pidgin.im>
parents:
13120
diff
changeset
|
220 | * library doesn't. However, the format string parser is very naive, which |
|
3e0b91a83516
[gaim-migrate @ 15515]
Richard Laager <rlaager@pidgin.im>
parents:
13120
diff
changeset
|
221 | * means that conversions specifiers to %z cannot be guaranteed. The GNU |
|
3e0b91a83516
[gaim-migrate @ 15515]
Richard Laager <rlaager@pidgin.im>
parents:
13120
diff
changeset
|
222 | * strftime(3) man page describes %z as: 'The time-zone as hour offset from |
|
3e0b91a83516
[gaim-migrate @ 15515]
Richard Laager <rlaager@pidgin.im>
parents:
13120
diff
changeset
|
223 | * GMT. Required to emit RFC822-conformant dates |
|
3e0b91a83516
[gaim-migrate @ 15515]
Richard Laager <rlaager@pidgin.im>
parents:
13120
diff
changeset
|
224 | * (using "%a, %d %b %Y %H:%M:%S %z"). (GNU)' |
|
3e0b91a83516
[gaim-migrate @ 15515]
Richard Laager <rlaager@pidgin.im>
parents:
13120
diff
changeset
|
225 | * |
|
13334
d0d48650f114
[gaim-migrate @ 15703]
Richard Laager <rlaager@pidgin.im>
parents:
13216
diff
changeset
|
226 | * On Windows, this function also converts the results for %Z from a timezone |
|
d0d48650f114
[gaim-migrate @ 15703]
Richard Laager <rlaager@pidgin.im>
parents:
13216
diff
changeset
|
227 | * name (as returned by the system strftime() %Z format string) to a timezone |
|
d0d48650f114
[gaim-migrate @ 15703]
Richard Laager <rlaager@pidgin.im>
parents:
13216
diff
changeset
|
228 | * abbreviation (as is the case on Unix). As with %z, conversion specifiers |
|
d0d48650f114
[gaim-migrate @ 15703]
Richard Laager <rlaager@pidgin.im>
parents:
13216
diff
changeset
|
229 | * should not be used. |
|
d0d48650f114
[gaim-migrate @ 15703]
Richard Laager <rlaager@pidgin.im>
parents:
13216
diff
changeset
|
230 | * |
|
13216
2cc737d198f3
[gaim-migrate @ 15579]
Richard Laager <rlaager@pidgin.im>
parents:
13153
diff
changeset
|
231 | * @param format The format string, in UTF-8 |
|
13120
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13105
diff
changeset
|
232 | * @param tm The time to format, or @c NULL to use the current local time |
|
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13105
diff
changeset
|
233 | * |
|
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13105
diff
changeset
|
234 | * @return The formatted time, in UTF-8. |
|
13216
2cc737d198f3
[gaim-migrate @ 15579]
Richard Laager <rlaager@pidgin.im>
parents:
13153
diff
changeset
|
235 | * |
|
2cc737d198f3
[gaim-migrate @ 15579]
Richard Laager <rlaager@pidgin.im>
parents:
13153
diff
changeset
|
236 | * @note @a format is required to be in UTF-8. This differs from strftime(), |
|
2cc737d198f3
[gaim-migrate @ 15579]
Richard Laager <rlaager@pidgin.im>
parents:
13153
diff
changeset
|
237 | * where the format is provided in the locale charset. |
|
13105
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
238 | */ |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
239 | const char *gaim_utf8_strftime(const char *format, const struct tm *tm); |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
240 | |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
241 | /** |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
242 | * Formats a time into the user's preferred short date format. |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
243 | * |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
244 | * The returned string is stored in a static buffer, so the result |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
245 | * should be g_strdup()'d if it's going to be kept. |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
246 | * |
|
13785
4ee261bcc567
[gaim-migrate @ 16195]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13357
diff
changeset
|
247 | * @param tm The time to format, or @c NULL to use the current local time |
|
13105
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
248 | * |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
249 | * @return The date, formatted as per the user's settings. |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
250 | */ |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
251 | const char *gaim_date_format_short(const struct tm *tm); |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
252 | |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
253 | /** |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
254 | * Formats a time into the user's preferred short date plus time format. |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
255 | * |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
256 | * The returned string is stored in a static buffer, so the result |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
257 | * should be g_strdup()'d if it's going to be kept. |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
258 | * |
|
13785
4ee261bcc567
[gaim-migrate @ 16195]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13357
diff
changeset
|
259 | * @param tm The time to format, or @c NULL to use the current local time |
|
13105
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
260 | * |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
261 | * @return The timestamp, formatted as per the user's settings. |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
262 | */ |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
263 | const char *gaim_date_format_long(const struct tm *tm); |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
264 | |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
265 | /** |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
266 | * Formats a time into the user's preferred full date and time format. |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
267 | * |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
268 | * The returned string is stored in a static buffer, so the result |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
269 | * should be g_strdup()'d if it's going to be kept. |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
270 | * |
|
13785
4ee261bcc567
[gaim-migrate @ 16195]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13357
diff
changeset
|
271 | * @param tm The time to format, or @c NULL to use the current local time |
|
13105
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
272 | * |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
273 | * @return The date and time, formatted as per the user's settings. |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
274 | */ |
|
13120
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13105
diff
changeset
|
275 | const char *gaim_date_format_full(const struct tm *tm); |
|
13105
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
276 | |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
277 | /** |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
278 | * Formats a time into the user's preferred time format. |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
279 | * |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
280 | * The returned string is stored in a static buffer, so the result |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
281 | * should be g_strdup()'d if it's going to be kept. |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
282 | * |
|
13785
4ee261bcc567
[gaim-migrate @ 16195]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13357
diff
changeset
|
283 | * @param tm The time to format, or @c NULL to use the current local time |
|
13105
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
284 | * |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
285 | * @return The time, formatted as per the user's settings. |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
286 | */ |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
287 | const char *gaim_time_format(const struct tm *tm); |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
288 | |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
289 | /** |
| 4890 | 290 | * Builds a time_t from the supplied information. |
| 291 | * | |
| 292 | * @param year The year. | |
| 293 | * @param month The month. | |
| 294 | * @param day The day. | |
| 295 | * @param hour The hour. | |
| 296 | * @param min The minute. | |
| 297 | * @param sec The second. | |
| 298 | * | |
| 299 | * @return A time_t. | |
| 300 | */ | |
|
7108
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
301 | time_t gaim_time_build(int year, int month, int day, int hour, |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
302 | int min, int sec); |
| 4890 | 303 | |
|
13120
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13105
diff
changeset
|
304 | /** Used by gaim_str_to_time to indicate no timezone offset was |
|
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13105
diff
changeset
|
305 | * specified in the timestamp string. */ |
|
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13105
diff
changeset
|
306 | #define GAIM_NO_TZ_OFF -500000 |
|
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13105
diff
changeset
|
307 | |
| 8577 | 308 | /** |
|
13105
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
309 | * Parses a timestamp in jabber, ISO8601, or MM/DD/YYYY format and returns |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
310 | * a time_t. |
| 8577 | 311 | * |
| 312 | * @param timestamp The timestamp | |
|
13120
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13105
diff
changeset
|
313 | * @param utc Assume UTC if no timezone specified |
|
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13105
diff
changeset
|
314 | * @param tm If not @c NULL, the caller can get a copy of the |
|
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13105
diff
changeset
|
315 | * struct tm used to calculate the time_t return value. |
|
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13105
diff
changeset
|
316 | * @param tz_off If not @c NULL, the caller can get a copy of the |
|
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13105
diff
changeset
|
317 | * timezone offset (from UTC) used to calculate the time_t |
|
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13105
diff
changeset
|
318 | * return value. Note: Zero is a valid offset. As such, |
|
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13105
diff
changeset
|
319 | * the value of the macro @c GAIM_NO_TZ_OFF indicates no |
|
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13105
diff
changeset
|
320 | * offset was specified (which means that the local |
|
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13105
diff
changeset
|
321 | * timezone was used in the calculation). |
|
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13105
diff
changeset
|
322 | * @param rest If not @c NULL, the caller can get a pointer to the |
|
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13105
diff
changeset
|
323 | * part of @a timestamp left over after parsing is |
|
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13105
diff
changeset
|
324 | * completed, if it's not the end of @a timestamp. |
| 8577 | 325 | * |
| 326 | * @return A time_t. | |
| 327 | */ | |
|
13120
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13105
diff
changeset
|
328 | time_t gaim_str_to_time(const char *timestamp, gboolean utc, |
|
c25222322810
[gaim-migrate @ 15481]
Richard Laager <rlaager@pidgin.im>
parents:
13105
diff
changeset
|
329 | struct tm *tm, long *tz_off, const char **rest); |
| 8577 | 330 | |
|
7108
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
331 | /*@}*/ |
| 4890 | 332 | |
| 333 | ||
|
7108
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
334 | /**************************************************************************/ |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
335 | /** @name Markup Functions */ |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
336 | /**************************************************************************/ |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
337 | /*@{*/ |
| 5826 | 338 | |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6861
diff
changeset
|
339 | /** |
|
11135
063678d038f9
[gaim-migrate @ 13196]
Mark Doliner <markdoliner@pidgin.im>
parents:
11132
diff
changeset
|
340 | * Finds an HTML tag matching the given name. |
|
7094
8f9588491993
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
341 | * |
|
8f9588491993
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
342 | * This locates an HTML tag's start and end, and stores its attributes |
|
8f9588491993
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
343 | * in a GData hash table. The names of the attributes are lower-cased |
|
8f9588491993
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
344 | * in the hash table, and the name of the tag is case insensitive. |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6861
diff
changeset
|
345 | * |
|
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6861
diff
changeset
|
346 | * @param needle the name of the tag |
|
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6861
diff
changeset
|
347 | * @param haystack the null-delimited string to search in |
|
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6861
diff
changeset
|
348 | * @param start a pointer to the start of the tag if found |
|
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6861
diff
changeset
|
349 | * @param end a pointer to the end of the tag if found |
|
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6861
diff
changeset
|
350 | * @param attributes the attributes, if the tag was found |
|
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6861
diff
changeset
|
351 | * @return TRUE if the tag was found |
|
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6861
diff
changeset
|
352 | */ |
|
7094
8f9588491993
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
353 | gboolean gaim_markup_find_tag(const char *needle, const char *haystack, |
|
8f9588491993
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
354 | const char **start, const char **end, |
|
8f9588491993
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
355 | GData **attributes); |
|
8f9588491993
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
356 | |
|
8f9588491993
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
357 | /** |
|
7095
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
358 | * Extracts a field of data from HTML. |
|
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
359 | * |
|
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
360 | * This is a scary function. See protocols/msn/msn.c and |
| 9175 | 361 | * protocols/yahoo/yahoo_profile.c for example usage. |
|
7095
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
362 | * |
|
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
363 | * @param str The string to parse. |
| 7675 | 364 | * @param len The size of str. |
| 365 | * @param dest The destination GString to append the new | |
|
7095
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
366 | * field info to. |
|
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
367 | * @param start_token The beginning token. |
|
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
368 | * @param skip The number of characters to skip after the |
|
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
369 | * start token. |
|
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
370 | * @param end_token The ending token. |
|
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
371 | * @param check_value The value that the last character must meet. |
|
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
372 | * @param no_value_token The token indicating no value is given. |
|
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
373 | * @param display_name The short descriptive name to display for this token. |
|
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
374 | * @param is_link TRUE if this should be a link, or FALSE otherwise. |
|
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
375 | * @param link_prefix The prefix for the link. |
|
13105
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
376 | * @param format_cb A callback to format the value before adding it. |
|
7095
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
377 | * |
|
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
378 | * @return TRUE if successful, or FALSE otherwise. |
|
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
379 | */ |
| 7675 | 380 | gboolean gaim_markup_extract_info_field(const char *str, int len, GString *dest, |
| 381 | const char *start_token, int skip, | |
| 382 | const char *end_token, char check_value, | |
| 383 | const char *no_value_token, | |
| 384 | const char *display_name, gboolean is_link, | |
|
13105
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
385 | const char *link_prefix, |
|
8f9c66e4af87
[gaim-migrate @ 15466]
Richard Laager <rlaager@pidgin.im>
parents:
13103
diff
changeset
|
386 | GaimInfoFieldFormatCallback format_cb); |
|
7095
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
387 | |
|
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
388 | /** |
|
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
389 | * Converts HTML markup to XHTML. |
|
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
390 | * |
|
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
391 | * @param html The HTML markup. |
|
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
392 | * @param dest_xhtml The destination XHTML output. |
|
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
393 | * @param dest_plain The destination plain-text output. |
|
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
394 | */ |
|
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
395 | void gaim_markup_html_to_xhtml(const char *html, char **dest_xhtml, |
|
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
396 | char **dest_plain); |
|
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
397 | |
|
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
398 | /** |
|
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
399 | * Strips HTML tags from a string. |
|
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
400 | * |
|
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
401 | * @param str The string to strip HTML from. |
|
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
402 | * |
|
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
403 | * @return The new string without HTML. This must be freed. |
|
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
404 | */ |
|
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
405 | char *gaim_markup_strip_html(const char *str); |
|
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
406 | |
|
17d2b54254f8
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7094
diff
changeset
|
407 | /** |
|
7107
903864ff76c3
[gaim-migrate @ 7672]
Christian Hammond <chipx86@chipx86.com>
parents:
7106
diff
changeset
|
408 | * Adds the necessary HTML code to turn URIs into HTML links in a string. |
|
903864ff76c3
[gaim-migrate @ 7672]
Christian Hammond <chipx86@chipx86.com>
parents:
7106
diff
changeset
|
409 | * |
|
903864ff76c3
[gaim-migrate @ 7672]
Christian Hammond <chipx86@chipx86.com>
parents:
7106
diff
changeset
|
410 | * @param str The string to linkify. |
|
903864ff76c3
[gaim-migrate @ 7672]
Christian Hammond <chipx86@chipx86.com>
parents:
7106
diff
changeset
|
411 | * |
|
903864ff76c3
[gaim-migrate @ 7672]
Christian Hammond <chipx86@chipx86.com>
parents:
7106
diff
changeset
|
412 | * @return The linkified text. |
|
903864ff76c3
[gaim-migrate @ 7672]
Christian Hammond <chipx86@chipx86.com>
parents:
7106
diff
changeset
|
413 | */ |
|
903864ff76c3
[gaim-migrate @ 7672]
Christian Hammond <chipx86@chipx86.com>
parents:
7106
diff
changeset
|
414 | char *gaim_markup_linkify(const char *str); |
|
903864ff76c3
[gaim-migrate @ 7672]
Christian Hammond <chipx86@chipx86.com>
parents:
7106
diff
changeset
|
415 | |
| 8163 | 416 | /** |
| 8442 | 417 | * Unescapes HTML entities to their literal characters. |
| 418 | * For example "&" is replaced by '&' and so on. | |
| 419 | * Actually only "&", """, "<" and ">" are currently | |
| 420 | * supported. | |
| 421 | * | |
| 422 | * @param html The string in which to unescape any HTML entities | |
| 423 | * | |
| 424 | * @return the text with HTML entities literalized | |
| 425 | */ | |
| 426 | char *gaim_unescape_html(const char *html); | |
| 427 | ||
| 9175 | 428 | /** |
| 429 | * Returns a newly allocated substring of the HTML UTF-8 string "str". | |
| 430 | * The markup is preserved such that the substring will have the same | |
| 431 | * formatting as original string, even though some tags may have been | |
| 432 | * opened before "x", or may close after "y". All open tags are closed | |
| 433 | * at the end of the returned string, in the proper order. | |
| 434 | * | |
| 435 | * Note that x and y are in character offsets, not byte offsets, and | |
| 436 | * are offsets into an unformatted version of str. Because of this, | |
| 437 | * this function may be sensitive to changes in GtkIMHtml and may break | |
| 438 | * when used with other UI's. libgaim users are encouraged to report and | |
| 439 | * work out any problems encountered. | |
| 440 | * | |
| 441 | * @param str The input NUL terminated, HTML, UTF-8 (or ASCII) string. | |
| 442 | * @param x The character offset into an unformatted version of str to | |
| 443 | * begin at. | |
| 444 | * @param y The character offset (into an unformatted vesion of str) of | |
| 445 | * one past the last character to include in the slice. | |
| 446 | * | |
| 447 | * @return The HTML slice of string, with all formatting retained. | |
| 448 | */ | |
| 449 | char *gaim_markup_slice(const char *str, guint x, guint y); | |
| 450 | ||
| 451 | /** | |
| 452 | * Returns a newly allocated string containing the name of the tag | |
| 453 | * located at "tag". Tag is expected to point to a '<', and contain | |
| 454 | * a '>' sometime after that. If there is no '>' and the string is | |
| 455 | * not NUL terminated, this function can be expected to segfault. | |
| 456 | * | |
| 457 | * @param tag The string starting a HTML tag. | |
| 458 | * @return A string containing the name of the tag. | |
| 459 | */ | |
| 460 | char *gaim_markup_get_tag_name(const char *tag); | |
| 461 | ||
|
7108
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
462 | /*@}*/ |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
463 | |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
464 | |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
465 | /**************************************************************************/ |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
466 | /** @name Path/Filename Functions */ |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
467 | /**************************************************************************/ |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
468 | /*@{*/ |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
469 | |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
470 | /** |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
471 | * Returns the user's home directory. |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
472 | * |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
473 | * @return The user's home directory. |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
474 | * |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
475 | * @see gaim_user_dir() |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
476 | */ |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
477 | const gchar *gaim_home_dir(void); |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
478 | |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
479 | /** |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
480 | * Returns the gaim settings directory in the user's home directory. |
|
10869
86a3144baf08
[gaim-migrate @ 12556]
Mark Doliner <markdoliner@pidgin.im>
parents:
10732
diff
changeset
|
481 | * This is usually ~/.gaim |
|
7108
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
482 | * |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
483 | * @return The gaim settings directory. |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
484 | * |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
485 | * @see gaim_home_dir() |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
486 | */ |
|
10332
62ed0121db22
[gaim-migrate @ 11539]
Mark Doliner <markdoliner@pidgin.im>
parents:
10258
diff
changeset
|
487 | const char *gaim_user_dir(void); |
|
7108
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
488 | |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
489 | /** |
| 8596 | 490 | * Define a custom gaim settings directory, overriding the default (user's home directory/.gaim) |
| 491 | * @param dir The custom settings directory | |
| 492 | */ | |
|
10871
c0282a4f2250
[gaim-migrate @ 12558]
Mark Doliner <markdoliner@pidgin.im>
parents:
10869
diff
changeset
|
493 | void gaim_util_set_user_dir(const char *dir); |
| 8596 | 494 | |
| 495 | /** | |
| 7612 | 496 | * Builds a complete path from the root, making any directories along |
| 497 | * the path which do not already exist. | |
| 7622 | 498 | * |
| 7612 | 499 | * @param path The path you wish to create. Note that it must start |
| 500 | * from the root or this function will fail. | |
| 501 | * @param mode Unix-style permissions for this directory. | |
| 7622 | 502 | * |
| 7612 | 503 | * @return 0 for success, nonzero on any error. |
| 504 | */ | |
| 7622 | 505 | int gaim_build_dir(const char *path, int mode); |
| 7612 | 506 | |
| 507 | /** | |
|
10415
faceb835eb87
[gaim-migrate @ 11665]
Mark Doliner <markdoliner@pidgin.im>
parents:
10414
diff
changeset
|
508 | * Write a string of data to a file of the given name in the Gaim |
|
faceb835eb87
[gaim-migrate @ 11665]
Mark Doliner <markdoliner@pidgin.im>
parents:
10414
diff
changeset
|
509 | * user directory ($HOME/.gaim by default). The data is typically |
|
faceb835eb87
[gaim-migrate @ 11665]
Mark Doliner <markdoliner@pidgin.im>
parents:
10414
diff
changeset
|
510 | * a serialized version of one of Gaim's config files, such as |
|
faceb835eb87
[gaim-migrate @ 11665]
Mark Doliner <markdoliner@pidgin.im>
parents:
10414
diff
changeset
|
511 | * prefs.xml, accounts.xml, etc. And the string is typically |
|
faceb835eb87
[gaim-migrate @ 11665]
Mark Doliner <markdoliner@pidgin.im>
parents:
10414
diff
changeset
|
512 | * obtained using xmlnode_to_formatted_str. However, this function |
|
faceb835eb87
[gaim-migrate @ 11665]
Mark Doliner <markdoliner@pidgin.im>
parents:
10414
diff
changeset
|
513 | * should work fine for saving binary files as well. |
|
10414
6b10b76933e1
[gaim-migrate @ 11664]
Mark Doliner <markdoliner@pidgin.im>
parents:
10332
diff
changeset
|
514 | * |
|
6b10b76933e1
[gaim-migrate @ 11664]
Mark Doliner <markdoliner@pidgin.im>
parents:
10332
diff
changeset
|
515 | * @param filename The basename of the file to write in the gaim_user_dir. |
|
6b10b76933e1
[gaim-migrate @ 11664]
Mark Doliner <markdoliner@pidgin.im>
parents:
10332
diff
changeset
|
516 | * @param data A null-terminated string of data to write. |
|
10415
faceb835eb87
[gaim-migrate @ 11665]
Mark Doliner <markdoliner@pidgin.im>
parents:
10414
diff
changeset
|
517 | * @param size The size of the data to save. If data is |
|
faceb835eb87
[gaim-migrate @ 11665]
Mark Doliner <markdoliner@pidgin.im>
parents:
10414
diff
changeset
|
518 | * null-terminated you can pass in -1. |
|
10414
6b10b76933e1
[gaim-migrate @ 11664]
Mark Doliner <markdoliner@pidgin.im>
parents:
10332
diff
changeset
|
519 | * |
|
6b10b76933e1
[gaim-migrate @ 11664]
Mark Doliner <markdoliner@pidgin.im>
parents:
10332
diff
changeset
|
520 | * @return TRUE if the file was written successfully. FALSE otherwise. |
|
6b10b76933e1
[gaim-migrate @ 11664]
Mark Doliner <markdoliner@pidgin.im>
parents:
10332
diff
changeset
|
521 | */ |
|
10415
faceb835eb87
[gaim-migrate @ 11665]
Mark Doliner <markdoliner@pidgin.im>
parents:
10414
diff
changeset
|
522 | gboolean gaim_util_write_data_to_file(const char *filename, const char *data, |
|
faceb835eb87
[gaim-migrate @ 11665]
Mark Doliner <markdoliner@pidgin.im>
parents:
10414
diff
changeset
|
523 | size_t size); |
|
10414
6b10b76933e1
[gaim-migrate @ 11664]
Mark Doliner <markdoliner@pidgin.im>
parents:
10332
diff
changeset
|
524 | |
|
6b10b76933e1
[gaim-migrate @ 11664]
Mark Doliner <markdoliner@pidgin.im>
parents:
10332
diff
changeset
|
525 | /** |
|
10425
d82cef15da95
[gaim-migrate @ 11677]
Mark Doliner <markdoliner@pidgin.im>
parents:
10415
diff
changeset
|
526 | * Read the contents of a given file and parse the results into an |
|
d82cef15da95
[gaim-migrate @ 11677]
Mark Doliner <markdoliner@pidgin.im>
parents:
10415
diff
changeset
|
527 | * xmlnode tree structure. This is intended to be used to read |
|
d82cef15da95
[gaim-migrate @ 11677]
Mark Doliner <markdoliner@pidgin.im>
parents:
10415
diff
changeset
|
528 | * Gaim's configuration xml files (prefs.xml, pounces.xml, etc.) |
|
d82cef15da95
[gaim-migrate @ 11677]
Mark Doliner <markdoliner@pidgin.im>
parents:
10415
diff
changeset
|
529 | * |
|
d82cef15da95
[gaim-migrate @ 11677]
Mark Doliner <markdoliner@pidgin.im>
parents:
10415
diff
changeset
|
530 | * @param filename The basename of the file to open in the gaim_user_dir. |
|
d82cef15da95
[gaim-migrate @ 11677]
Mark Doliner <markdoliner@pidgin.im>
parents:
10415
diff
changeset
|
531 | * @param description A very short description of the contents of this |
|
d82cef15da95
[gaim-migrate @ 11677]
Mark Doliner <markdoliner@pidgin.im>
parents:
10415
diff
changeset
|
532 | * file. This is used in error messages shown to the |
|
d82cef15da95
[gaim-migrate @ 11677]
Mark Doliner <markdoliner@pidgin.im>
parents:
10415
diff
changeset
|
533 | * user when the file can not be opened. For example, |
|
d82cef15da95
[gaim-migrate @ 11677]
Mark Doliner <markdoliner@pidgin.im>
parents:
10415
diff
changeset
|
534 | * "preferences," or "buddy pounces." |
|
d82cef15da95
[gaim-migrate @ 11677]
Mark Doliner <markdoliner@pidgin.im>
parents:
10415
diff
changeset
|
535 | * |
|
d82cef15da95
[gaim-migrate @ 11677]
Mark Doliner <markdoliner@pidgin.im>
parents:
10415
diff
changeset
|
536 | * @return An xmlnode tree of the contents of the given file. Or NULL, if |
|
d82cef15da95
[gaim-migrate @ 11677]
Mark Doliner <markdoliner@pidgin.im>
parents:
10415
diff
changeset
|
537 | * the file does not exist or there was an error reading the file. |
|
d82cef15da95
[gaim-migrate @ 11677]
Mark Doliner <markdoliner@pidgin.im>
parents:
10415
diff
changeset
|
538 | */ |
|
d82cef15da95
[gaim-migrate @ 11677]
Mark Doliner <markdoliner@pidgin.im>
parents:
10415
diff
changeset
|
539 | xmlnode *gaim_util_read_xml_from_file(const char *filename, |
|
d82cef15da95
[gaim-migrate @ 11677]
Mark Doliner <markdoliner@pidgin.im>
parents:
10415
diff
changeset
|
540 | const char *description); |
|
d82cef15da95
[gaim-migrate @ 11677]
Mark Doliner <markdoliner@pidgin.im>
parents:
10415
diff
changeset
|
541 | |
|
d82cef15da95
[gaim-migrate @ 11677]
Mark Doliner <markdoliner@pidgin.im>
parents:
10415
diff
changeset
|
542 | /** |
|
7108
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
543 | * Creates a temporary file and returns a file pointer to it. |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
544 | * |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
545 | * This is like mkstemp(), but returns a file pointer and uses a |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
546 | * pre-set template. It uses the semantics of tempnam() for the |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
547 | * directory to use and allocates the space for the file path. |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
548 | * |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
549 | * The caller is responsible for closing the file and removing it when |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
550 | * done, as well as freeing the space pointed to by @a path with |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
551 | * g_free(). |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
552 | * |
|
10203
21d6c11a53c6
[gaim-migrate @ 11324]
Herman Bloggs <herman@bluedigits.com>
parents:
9926
diff
changeset
|
553 | * @param path The returned path to the temp file. |
|
21d6c11a53c6
[gaim-migrate @ 11324]
Herman Bloggs <herman@bluedigits.com>
parents:
9926
diff
changeset
|
554 | * @param binary Text or binary, for platforms where it matters. |
|
7108
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
555 | * |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
556 | * @return A file pointer to the temporary file, or @c NULL on failure. |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
557 | */ |
|
10203
21d6c11a53c6
[gaim-migrate @ 11324]
Herman Bloggs <herman@bluedigits.com>
parents:
9926
diff
changeset
|
558 | FILE *gaim_mkstemp(char **path, gboolean binary); |
|
7108
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
559 | |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
560 | /** |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
561 | * Checks if the given program name is valid and executable. |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
562 | * |
|
7303
b7b02c31b5bb
[gaim-migrate @ 7887]
Christian Hammond <chipx86@chipx86.com>
parents:
7261
diff
changeset
|
563 | * @param program The file name of the application. |
|
7108
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
564 | * |
|
12483
38fc67810cdb
[gaim-migrate @ 14795]
Richard Laager <rlaager@pidgin.im>
parents:
12106
diff
changeset
|
565 | * @return TRUE if the program is runable. |
|
7108
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
566 | */ |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
567 | gboolean gaim_program_is_valid(const char *program); |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
568 | |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
569 | /** |
|
12483
38fc67810cdb
[gaim-migrate @ 14795]
Richard Laager <rlaager@pidgin.im>
parents:
12106
diff
changeset
|
570 | * Check if running GNOME. |
| 11878 | 571 | * |
|
12483
38fc67810cdb
[gaim-migrate @ 14795]
Richard Laager <rlaager@pidgin.im>
parents:
12106
diff
changeset
|
572 | * @return TRUE if running GNOME, FALSE otherwise. |
| 11878 | 573 | */ |
| 574 | gboolean gaim_running_gnome(void); | |
| 575 | ||
| 576 | /** | |
|
12483
38fc67810cdb
[gaim-migrate @ 14795]
Richard Laager <rlaager@pidgin.im>
parents:
12106
diff
changeset
|
577 | * Check if running KDE. |
|
38fc67810cdb
[gaim-migrate @ 14795]
Richard Laager <rlaager@pidgin.im>
parents:
12106
diff
changeset
|
578 | * |
|
38fc67810cdb
[gaim-migrate @ 14795]
Richard Laager <rlaager@pidgin.im>
parents:
12106
diff
changeset
|
579 | * @return TRUE if running KDE, FALSE otherwise. |
|
38fc67810cdb
[gaim-migrate @ 14795]
Richard Laager <rlaager@pidgin.im>
parents:
12106
diff
changeset
|
580 | */ |
|
38fc67810cdb
[gaim-migrate @ 14795]
Richard Laager <rlaager@pidgin.im>
parents:
12106
diff
changeset
|
581 | gboolean gaim_running_kde(void); |
|
38fc67810cdb
[gaim-migrate @ 14795]
Richard Laager <rlaager@pidgin.im>
parents:
12106
diff
changeset
|
582 | |
|
38fc67810cdb
[gaim-migrate @ 14795]
Richard Laager <rlaager@pidgin.im>
parents:
12106
diff
changeset
|
583 | /** |
|
7108
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
584 | * Returns the IP address from a socket file descriptor. |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
585 | * |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
586 | * @param fd The socket file descriptor. |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
587 | * |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
588 | * @return The IP address, or @c NULL on error. |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
589 | */ |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
590 | char *gaim_fd_get_ip(int fd); |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
591 | |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
592 | /*@}*/ |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
593 | |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
594 | |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
595 | /**************************************************************************/ |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
596 | /** @name String Functions */ |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
597 | /**************************************************************************/ |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
598 | /*@{*/ |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
599 | |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
600 | /** |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
601 | * Normalizes a string, so that it is suitable for comparison. |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
602 | * |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
603 | * The returned string will point to a static buffer, so if the |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
604 | * string is intended to be kept long-term, you <i>must</i> |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
605 | * g_strdup() it. Also, calling normalize() twice in the same line |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
606 | * will lead to problems. |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
607 | * |
|
10433
04cf48e72655
[gaim-migrate @ 11689]
Mark Doliner <markdoliner@pidgin.im>
parents:
10425
diff
changeset
|
608 | * @param account The account the string belongs to, or NULL if you do |
|
04cf48e72655
[gaim-migrate @ 11689]
Mark Doliner <markdoliner@pidgin.im>
parents:
10425
diff
changeset
|
609 | * not know the account. If you use NULL, the string |
|
04cf48e72655
[gaim-migrate @ 11689]
Mark Doliner <markdoliner@pidgin.im>
parents:
10425
diff
changeset
|
610 | * will still be normalized, but if the PRPL uses a |
|
04cf48e72655
[gaim-migrate @ 11689]
Mark Doliner <markdoliner@pidgin.im>
parents:
10425
diff
changeset
|
611 | * custom normalization function then the string may |
|
04cf48e72655
[gaim-migrate @ 11689]
Mark Doliner <markdoliner@pidgin.im>
parents:
10425
diff
changeset
|
612 | * not be normalized correctly. |
| 7261 | 613 | * @param str The string to normalize. |
|
7108
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
614 | * |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
615 | * @return A pointer to the normalized version stored in a static buffer. |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
616 | */ |
| 7261 | 617 | const char *gaim_normalize(const GaimAccount *account, const char *str); |
|
7108
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
618 | |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
619 | /** |
|
11153
b5c721366f2d
[gaim-migrate @ 13235]
Evan Schoenberg <evands@pidgin.im>
parents:
11137
diff
changeset
|
620 | * Normalizes a string, so that it is suitable for comparison. |
|
b5c721366f2d
[gaim-migrate @ 13235]
Evan Schoenberg <evands@pidgin.im>
parents:
11137
diff
changeset
|
621 | * |
|
b5c721366f2d
[gaim-migrate @ 13235]
Evan Schoenberg <evands@pidgin.im>
parents:
11137
diff
changeset
|
622 | * This is one possible implementation for the PRPL callback |
|
b5c721366f2d
[gaim-migrate @ 13235]
Evan Schoenberg <evands@pidgin.im>
parents:
11137
diff
changeset
|
623 | * function "normalize." It returns a lowercase and UTF-8 |
|
b5c721366f2d
[gaim-migrate @ 13235]
Evan Schoenberg <evands@pidgin.im>
parents:
11137
diff
changeset
|
624 | * normalized version of the string. |
|
b5c721366f2d
[gaim-migrate @ 13235]
Evan Schoenberg <evands@pidgin.im>
parents:
11137
diff
changeset
|
625 | * |
|
b5c721366f2d
[gaim-migrate @ 13235]
Evan Schoenberg <evands@pidgin.im>
parents:
11137
diff
changeset
|
626 | * @param account The account the string belongs to. |
|
b5c721366f2d
[gaim-migrate @ 13235]
Evan Schoenberg <evands@pidgin.im>
parents:
11137
diff
changeset
|
627 | * @param str The string to normalize. |
|
b5c721366f2d
[gaim-migrate @ 13235]
Evan Schoenberg <evands@pidgin.im>
parents:
11137
diff
changeset
|
628 | * |
|
b5c721366f2d
[gaim-migrate @ 13235]
Evan Schoenberg <evands@pidgin.im>
parents:
11137
diff
changeset
|
629 | * @return A pointer to the normalized version stored in a static buffer. |
|
b5c721366f2d
[gaim-migrate @ 13235]
Evan Schoenberg <evands@pidgin.im>
parents:
11137
diff
changeset
|
630 | */ |
|
b5c721366f2d
[gaim-migrate @ 13235]
Evan Schoenberg <evands@pidgin.im>
parents:
11137
diff
changeset
|
631 | const char *gaim_normalize_nocase(const GaimAccount *account, const char *str); |
|
b5c721366f2d
[gaim-migrate @ 13235]
Evan Schoenberg <evands@pidgin.im>
parents:
11137
diff
changeset
|
632 | |
|
b5c721366f2d
[gaim-migrate @ 13235]
Evan Schoenberg <evands@pidgin.im>
parents:
11137
diff
changeset
|
633 | /** |
| 7628 | 634 | * Compares two strings to see if the first contains the second as |
| 635 | * a proper prefix. | |
| 8432 | 636 | * |
| 7628 | 637 | * @param s The string to check. |
| 638 | * @param p The prefix in question. | |
| 8432 | 639 | * |
| 7628 | 640 | * @return TRUE if p is a prefix of s, otherwise FALSE. |
| 641 | */ | |
| 642 | gboolean gaim_str_has_prefix(const char *s, const char *p); | |
| 643 | ||
| 644 | /** | |
| 645 | * Compares two strings to see if the second is a proper suffix | |
| 646 | * of the first. | |
| 8432 | 647 | * |
| 7628 | 648 | * @param s The string to check. |
| 649 | * @param x The suffix in question. | |
| 8432 | 650 | * |
| 7628 | 651 | * @return TRUE if x is a a suffix of s, otherwise FALSE. |
| 652 | */ | |
| 653 | gboolean gaim_str_has_suffix(const char *s, const char *x); | |
| 654 | ||
| 655 | /** | |
|
7108
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
656 | * Duplicates a string and replaces all newline characters from the |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
657 | * source string with HTML linebreaks. |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
658 | * |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
659 | * @param src The source string. |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
660 | * |
|
8341
dc43b1acfc1a
[gaim-migrate @ 9065]
Mark Doliner <markdoliner@pidgin.im>
parents:
8163
diff
changeset
|
661 | * @return The new string. Must be g_free'd by the caller. |
|
7108
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
662 | */ |
|
8341
dc43b1acfc1a
[gaim-migrate @ 9065]
Mark Doliner <markdoliner@pidgin.im>
parents:
8163
diff
changeset
|
663 | gchar *gaim_strdup_withhtml(const gchar *src); |
|
7108
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
664 | |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
665 | /** |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
666 | * Ensures that all linefeeds have a matching carriage return. |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
667 | * |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
668 | * @param str The source string. |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
669 | * |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
670 | * @return The string with carriage returns. |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
671 | */ |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
672 | char *gaim_str_add_cr(const char *str); |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
673 | |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
674 | /** |
|
11920
be80617ec59b
[gaim-migrate @ 14211]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11878
diff
changeset
|
675 | * Strips all instances of the given character from the |
|
be80617ec59b
[gaim-migrate @ 14211]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11878
diff
changeset
|
676 | * given string. The string is modified in place. This |
|
be80617ec59b
[gaim-migrate @ 14211]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11878
diff
changeset
|
677 | * is useful for stripping new line characters, for example. |
|
be80617ec59b
[gaim-migrate @ 14211]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11878
diff
changeset
|
678 | * |
|
be80617ec59b
[gaim-migrate @ 14211]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11878
diff
changeset
|
679 | * Example usage: |
|
be80617ec59b
[gaim-migrate @ 14211]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11878
diff
changeset
|
680 | * gaim_str_strip_char(my_dumb_string, '\n'); |
|
7108
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
681 | * |
|
11920
be80617ec59b
[gaim-migrate @ 14211]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11878
diff
changeset
|
682 | * @param str The string to strip characters from. |
|
be80617ec59b
[gaim-migrate @ 14211]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11878
diff
changeset
|
683 | * @param thechar The character to strip from the given string. |
|
7108
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
684 | */ |
|
11920
be80617ec59b
[gaim-migrate @ 14211]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11878
diff
changeset
|
685 | void gaim_str_strip_char(char *str, char thechar); |
|
be80617ec59b
[gaim-migrate @ 14211]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11878
diff
changeset
|
686 | |
|
be80617ec59b
[gaim-migrate @ 14211]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11878
diff
changeset
|
687 | /** |
|
be80617ec59b
[gaim-migrate @ 14211]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11878
diff
changeset
|
688 | * Given a string, this replaces all instances of one character |
|
be80617ec59b
[gaim-migrate @ 14211]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11878
diff
changeset
|
689 | * with another. This happens inline (the original string IS |
|
be80617ec59b
[gaim-migrate @ 14211]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11878
diff
changeset
|
690 | * modified). |
|
be80617ec59b
[gaim-migrate @ 14211]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11878
diff
changeset
|
691 | * |
|
be80617ec59b
[gaim-migrate @ 14211]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11878
diff
changeset
|
692 | * @param string The string from which to replace stuff. |
|
be80617ec59b
[gaim-migrate @ 14211]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11878
diff
changeset
|
693 | * @param delimiter The character you want replaced. |
|
be80617ec59b
[gaim-migrate @ 14211]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11878
diff
changeset
|
694 | * @param replacement The character you want inserted in place |
|
be80617ec59b
[gaim-migrate @ 14211]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11878
diff
changeset
|
695 | * of the delimiting character. |
|
be80617ec59b
[gaim-migrate @ 14211]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11878
diff
changeset
|
696 | */ |
|
be80617ec59b
[gaim-migrate @ 14211]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11878
diff
changeset
|
697 | void gaim_util_chrreplace(char *string, char delimiter, |
|
be80617ec59b
[gaim-migrate @ 14211]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11878
diff
changeset
|
698 | char replacement); |
|
7108
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
699 | |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
700 | /** |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
701 | * Given a string, this replaces one substring with another |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
702 | * and returns a newly allocated string. |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
703 | * |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
704 | * @param string The string from which to replace stuff. |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
705 | * @param delimiter The substring you want replaced. |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
706 | * @param replacement The substring you want inserted in place |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
707 | * of the delimiting substring. |
|
8461
920171a59e45
[gaim-migrate @ 9191]
Mark Doliner <markdoliner@pidgin.im>
parents:
8442
diff
changeset
|
708 | * |
|
920171a59e45
[gaim-migrate @ 9191]
Mark Doliner <markdoliner@pidgin.im>
parents:
8442
diff
changeset
|
709 | * @return A new string, after performing the substitution. |
|
920171a59e45
[gaim-migrate @ 9191]
Mark Doliner <markdoliner@pidgin.im>
parents:
8442
diff
changeset
|
710 | * free this with g_free(). |
|
7108
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
711 | */ |
|
8341
dc43b1acfc1a
[gaim-migrate @ 9065]
Mark Doliner <markdoliner@pidgin.im>
parents:
8163
diff
changeset
|
712 | gchar *gaim_strreplace(const char *string, const char *delimiter, |
|
dc43b1acfc1a
[gaim-migrate @ 9065]
Mark Doliner <markdoliner@pidgin.im>
parents:
8163
diff
changeset
|
713 | const char *replacement); |
|
dc43b1acfc1a
[gaim-migrate @ 9065]
Mark Doliner <markdoliner@pidgin.im>
parents:
8163
diff
changeset
|
714 | |
|
12813
6f67cfa0e6a0
[gaim-migrate @ 15161]
Christopher O'Brien <siege@pidgin.im>
parents:
12483
diff
changeset
|
715 | |
|
6f67cfa0e6a0
[gaim-migrate @ 15161]
Christopher O'Brien <siege@pidgin.im>
parents:
12483
diff
changeset
|
716 | /** |
|
6f67cfa0e6a0
[gaim-migrate @ 15161]
Christopher O'Brien <siege@pidgin.im>
parents:
12483
diff
changeset
|
717 | * Given a string, this replaces any utf-8 substrings in that string with |
|
6f67cfa0e6a0
[gaim-migrate @ 15161]
Christopher O'Brien <siege@pidgin.im>
parents:
12483
diff
changeset
|
718 | * the corresponding numerical character reference, and returns a newly |
|
6f67cfa0e6a0
[gaim-migrate @ 15161]
Christopher O'Brien <siege@pidgin.im>
parents:
12483
diff
changeset
|
719 | * allocated string. |
|
6f67cfa0e6a0
[gaim-migrate @ 15161]
Christopher O'Brien <siege@pidgin.im>
parents:
12483
diff
changeset
|
720 | * |
|
6f67cfa0e6a0
[gaim-migrate @ 15161]
Christopher O'Brien <siege@pidgin.im>
parents:
12483
diff
changeset
|
721 | * @param in The string which might contain utf-8 substrings |
|
6f67cfa0e6a0
[gaim-migrate @ 15161]
Christopher O'Brien <siege@pidgin.im>
parents:
12483
diff
changeset
|
722 | * |
|
6f67cfa0e6a0
[gaim-migrate @ 15161]
Christopher O'Brien <siege@pidgin.im>
parents:
12483
diff
changeset
|
723 | * @return A new string, with utf-8 replaced with numerical character |
|
6f67cfa0e6a0
[gaim-migrate @ 15161]
Christopher O'Brien <siege@pidgin.im>
parents:
12483
diff
changeset
|
724 | * references, free this with g_free() |
|
6f67cfa0e6a0
[gaim-migrate @ 15161]
Christopher O'Brien <siege@pidgin.im>
parents:
12483
diff
changeset
|
725 | */ |
|
6f67cfa0e6a0
[gaim-migrate @ 15161]
Christopher O'Brien <siege@pidgin.im>
parents:
12483
diff
changeset
|
726 | char *gaim_utf8_ncr_encode(const char *in); |
|
6f67cfa0e6a0
[gaim-migrate @ 15161]
Christopher O'Brien <siege@pidgin.im>
parents:
12483
diff
changeset
|
727 | |
|
6f67cfa0e6a0
[gaim-migrate @ 15161]
Christopher O'Brien <siege@pidgin.im>
parents:
12483
diff
changeset
|
728 | |
|
8341
dc43b1acfc1a
[gaim-migrate @ 9065]
Mark Doliner <markdoliner@pidgin.im>
parents:
8163
diff
changeset
|
729 | /** |
| 9171 | 730 | * Given a string, this replaces any numerical character references |
| 731 | * in that string with the corresponding actual utf-8 substrings, | |
| 732 | * and returns a newly allocated string. | |
| 733 | * | |
| 734 | * @param in The string which might contain numerical character references. | |
| 735 | * | |
| 736 | * @return A new string, with numerical character references | |
| 737 | * replaced with actual utf-8, free this with g_free(). | |
| 738 | */ | |
| 739 | char *gaim_utf8_ncr_decode(const char *in); | |
| 740 | ||
|
12813
6f67cfa0e6a0
[gaim-migrate @ 15161]
Christopher O'Brien <siege@pidgin.im>
parents:
12483
diff
changeset
|
741 | |
| 9171 | 742 | /** |
|
8341
dc43b1acfc1a
[gaim-migrate @ 9065]
Mark Doliner <markdoliner@pidgin.im>
parents:
8163
diff
changeset
|
743 | * Given a string, this replaces one substring with another |
|
dc43b1acfc1a
[gaim-migrate @ 9065]
Mark Doliner <markdoliner@pidgin.im>
parents:
8163
diff
changeset
|
744 | * ignoring case and returns a newly allocated string. |
|
dc43b1acfc1a
[gaim-migrate @ 9065]
Mark Doliner <markdoliner@pidgin.im>
parents:
8163
diff
changeset
|
745 | * |
|
dc43b1acfc1a
[gaim-migrate @ 9065]
Mark Doliner <markdoliner@pidgin.im>
parents:
8163
diff
changeset
|
746 | * @param string The string from which to replace stuff. |
|
dc43b1acfc1a
[gaim-migrate @ 9065]
Mark Doliner <markdoliner@pidgin.im>
parents:
8163
diff
changeset
|
747 | * @param delimiter The substring you want replaced. |
|
dc43b1acfc1a
[gaim-migrate @ 9065]
Mark Doliner <markdoliner@pidgin.im>
parents:
8163
diff
changeset
|
748 | * @param replacement The substring you want inserted in place |
|
dc43b1acfc1a
[gaim-migrate @ 9065]
Mark Doliner <markdoliner@pidgin.im>
parents:
8163
diff
changeset
|
749 | * of the delimiting substring. |
|
8461
920171a59e45
[gaim-migrate @ 9191]
Mark Doliner <markdoliner@pidgin.im>
parents:
8442
diff
changeset
|
750 | * |
|
920171a59e45
[gaim-migrate @ 9191]
Mark Doliner <markdoliner@pidgin.im>
parents:
8442
diff
changeset
|
751 | * @return A new string, after performing the substitution. |
|
920171a59e45
[gaim-migrate @ 9191]
Mark Doliner <markdoliner@pidgin.im>
parents:
8442
diff
changeset
|
752 | * free this with g_free(). |
|
8341
dc43b1acfc1a
[gaim-migrate @ 9065]
Mark Doliner <markdoliner@pidgin.im>
parents:
8163
diff
changeset
|
753 | */ |
|
dc43b1acfc1a
[gaim-migrate @ 9065]
Mark Doliner <markdoliner@pidgin.im>
parents:
8163
diff
changeset
|
754 | gchar *gaim_strcasereplace(const char *string, const char *delimiter, |
|
dc43b1acfc1a
[gaim-migrate @ 9065]
Mark Doliner <markdoliner@pidgin.im>
parents:
8163
diff
changeset
|
755 | const char *replacement); |
|
7108
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
756 | |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
757 | /** |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
758 | * This is like strstr, except that it ignores ASCII case in |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
759 | * searching for the substring. |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
760 | * |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
761 | * @param haystack The string to search in. |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
762 | * @param needle The substring to find. |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
763 | * |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
764 | * @return the location of the substring if found, or NULL if not |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
765 | */ |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
766 | const char *gaim_strcasestr(const char *haystack, const char *needle); |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
767 | |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
768 | /** |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
769 | * Returns a string representing a filesize in the appropriate |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
770 | * units (MB, KB, GB, etc.) |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
771 | * |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
772 | * @param size The size |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
773 | * |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
774 | * @return The string in units form. This must be freed. |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
775 | */ |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
776 | char *gaim_str_size_to_units(size_t size); |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
777 | |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
778 | /** |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
779 | * Converts seconds into a human-readable form. |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
780 | * |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
781 | * @param sec The seconds. |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
782 | * |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
783 | * @return A human-readable form, containing days, hours, minutes, and |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
784 | * seconds. |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
785 | */ |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
786 | char *gaim_str_seconds_to_string(guint sec); |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
787 | |
| 9277 | 788 | /** |
| 789 | * Converts a binary string into a NUL terminated ascii string, | |
| 790 | * replacing nonascii characters and characters below SPACE (including | |
| 9307 | 791 | * NUL) into \\xyy, where yy are two hex digits. Also backslashes are |
| 792 | * changed into two backslashes (\\\\). The returned, newly allocated | |
| 793 | * string can be outputted to the console, and must be g_free()d. | |
| 9277 | 794 | * |
| 795 | * @param binary A string of random data, possibly with embedded NULs | |
| 796 | * and such. | |
| 797 | * @param len The length in bytes of the input string. Must not be 0. | |
| 798 | * | |
| 799 | * @return A newly allocated ASCIIZ string. | |
| 800 | */ | |
| 801 | char *gaim_str_binary_to_ascii(const unsigned char *binary, guint len); | |
|
7108
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
802 | /*@}*/ |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
803 | |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
804 | |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
805 | /**************************************************************************/ |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
806 | /** @name URI/URL Functions */ |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
807 | /**************************************************************************/ |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
808 | /*@{*/ |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
809 | |
|
7107
903864ff76c3
[gaim-migrate @ 7672]
Christian Hammond <chipx86@chipx86.com>
parents:
7106
diff
changeset
|
810 | /** |
| 9227 | 811 | * Parses a URL, returning its host, port, file path, username and password. |
|
7094
8f9588491993
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
812 | * |
|
8f9588491993
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
813 | * The returned data must be freed. |
|
8f9588491993
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
814 | * |
|
8f9588491993
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
815 | * @param url The URL to parse. |
|
8f9588491993
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
816 | * @param ret_host The returned host. |
|
8f9588491993
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
817 | * @param ret_port The returned port. |
|
8f9588491993
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
818 | * @param ret_path The returned path. |
| 9227 | 819 | * @param ret_user The returned username. |
| 820 | * @param ret_passwd The returned password. | |
|
7094
8f9588491993
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
821 | */ |
|
8f9588491993
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
822 | gboolean gaim_url_parse(const char *url, char **ret_host, int *ret_port, |
| 9227 | 823 | char **ret_path, char **ret_user, char **ret_passwd); |
|
7094
8f9588491993
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
824 | |
|
12887
4235bbee17b1
[gaim-migrate @ 15240]
Daniel Atallah <datallah@pidgin.im>
parents:
12813
diff
changeset
|
825 | typedef void (*GaimURLFetchCallback) (gpointer data, const char *buf, gsize len); |
|
4235bbee17b1
[gaim-migrate @ 15240]
Daniel Atallah <datallah@pidgin.im>
parents:
12813
diff
changeset
|
826 | |
|
7094
8f9588491993
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
827 | /** |
|
8f9588491993
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
828 | * Fetches the data from a URL, and passes it to a callback function. |
|
8f9588491993
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
829 | * |
|
8f9588491993
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
830 | * @param url The URL. |
|
8f9588491993
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
831 | * @param full TRUE if this is the full URL, or FALSE if it's a |
|
8f9588491993
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
832 | * partial URL. |
| 9284 | 833 | * @param user_agent The user agent field to use, or NULL. |
| 834 | * @param http11 TRUE if HTTP/1.1 should be used to download the file. | |
|
7094
8f9588491993
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
835 | * @param cb The callback function. |
|
8f9588491993
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
836 | * @param data The user data to pass to the callback function. |
|
8f9588491993
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
837 | */ |
|
12887
4235bbee17b1
[gaim-migrate @ 15240]
Daniel Atallah <datallah@pidgin.im>
parents:
12813
diff
changeset
|
838 | #define gaim_url_fetch(url, full, user_agent, http11, cb, data) \ |
|
4235bbee17b1
[gaim-migrate @ 15240]
Daniel Atallah <datallah@pidgin.im>
parents:
12813
diff
changeset
|
839 | gaim_url_fetch_request(url, full, user_agent, http11, NULL, \ |
|
4235bbee17b1
[gaim-migrate @ 15240]
Daniel Atallah <datallah@pidgin.im>
parents:
12813
diff
changeset
|
840 | FALSE, cb, data); |
|
4235bbee17b1
[gaim-migrate @ 15240]
Daniel Atallah <datallah@pidgin.im>
parents:
12813
diff
changeset
|
841 | |
|
4235bbee17b1
[gaim-migrate @ 15240]
Daniel Atallah <datallah@pidgin.im>
parents:
12813
diff
changeset
|
842 | /** |
|
4235bbee17b1
[gaim-migrate @ 15240]
Daniel Atallah <datallah@pidgin.im>
parents:
12813
diff
changeset
|
843 | * Fetches the data from a URL, and passes it to a callback function. |
|
4235bbee17b1
[gaim-migrate @ 15240]
Daniel Atallah <datallah@pidgin.im>
parents:
12813
diff
changeset
|
844 | * |
|
4235bbee17b1
[gaim-migrate @ 15240]
Daniel Atallah <datallah@pidgin.im>
parents:
12813
diff
changeset
|
845 | * @param url The URL. |
|
4235bbee17b1
[gaim-migrate @ 15240]
Daniel Atallah <datallah@pidgin.im>
parents:
12813
diff
changeset
|
846 | * @param full TRUE if this is the full URL, or FALSE if it's a |
|
4235bbee17b1
[gaim-migrate @ 15240]
Daniel Atallah <datallah@pidgin.im>
parents:
12813
diff
changeset
|
847 | * partial URL. |
|
4235bbee17b1
[gaim-migrate @ 15240]
Daniel Atallah <datallah@pidgin.im>
parents:
12813
diff
changeset
|
848 | * @param user_agent The user agent field to use, or NULL. |
|
4235bbee17b1
[gaim-migrate @ 15240]
Daniel Atallah <datallah@pidgin.im>
parents:
12813
diff
changeset
|
849 | * @param http11 TRUE if HTTP/1.1 should be used to download the file. |
|
4235bbee17b1
[gaim-migrate @ 15240]
Daniel Atallah <datallah@pidgin.im>
parents:
12813
diff
changeset
|
850 | * @param request A HTTP request to send to the server instead of the |
|
4235bbee17b1
[gaim-migrate @ 15240]
Daniel Atallah <datallah@pidgin.im>
parents:
12813
diff
changeset
|
851 | * standard GET |
|
4235bbee17b1
[gaim-migrate @ 15240]
Daniel Atallah <datallah@pidgin.im>
parents:
12813
diff
changeset
|
852 | * @param include_headers if TRUE, include the HTTP headers in the |
|
4235bbee17b1
[gaim-migrate @ 15240]
Daniel Atallah <datallah@pidgin.im>
parents:
12813
diff
changeset
|
853 | * response |
|
4235bbee17b1
[gaim-migrate @ 15240]
Daniel Atallah <datallah@pidgin.im>
parents:
12813
diff
changeset
|
854 | * @param cb The callback function. |
|
4235bbee17b1
[gaim-migrate @ 15240]
Daniel Atallah <datallah@pidgin.im>
parents:
12813
diff
changeset
|
855 | * @param data The user data to pass to the callback function. |
|
4235bbee17b1
[gaim-migrate @ 15240]
Daniel Atallah <datallah@pidgin.im>
parents:
12813
diff
changeset
|
856 | */ |
|
4235bbee17b1
[gaim-migrate @ 15240]
Daniel Atallah <datallah@pidgin.im>
parents:
12813
diff
changeset
|
857 | void gaim_url_fetch_request(const char *url, gboolean full, |
|
4235bbee17b1
[gaim-migrate @ 15240]
Daniel Atallah <datallah@pidgin.im>
parents:
12813
diff
changeset
|
858 | const char *user_agent, gboolean http11, |
|
4235bbee17b1
[gaim-migrate @ 15240]
Daniel Atallah <datallah@pidgin.im>
parents:
12813
diff
changeset
|
859 | const char *request, gboolean include_headers, |
|
4235bbee17b1
[gaim-migrate @ 15240]
Daniel Atallah <datallah@pidgin.im>
parents:
12813
diff
changeset
|
860 | GaimURLFetchCallback cb, void *data); |
|
4235bbee17b1
[gaim-migrate @ 15240]
Daniel Atallah <datallah@pidgin.im>
parents:
12813
diff
changeset
|
861 | |
| 7134 | 862 | /** |
| 863 | * Decodes a URL into a plain string. | |
| 864 | * | |
| 865 | * This will change hex codes and such to their ascii equivalents. | |
| 866 | * | |
| 867 | * @param str The string to translate. | |
| 868 | * | |
| 869 | * @return The resulting string. | |
| 7162 | 870 | */ |
| 871 | const char *gaim_url_decode(const char *str); | |
| 7134 | 872 | |
| 873 | /** | |
| 874 | * Encodes a URL into an escaped string. | |
| 875 | * | |
| 876 | * This will change non-alphanumeric characters to hex codes. | |
| 877 | * | |
| 878 | * @param str The string to translate. | |
| 879 | * | |
| 880 | * @return The resulting string. | |
| 881 | */ | |
| 7162 | 882 | const char *gaim_url_encode(const char *str); |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6861
diff
changeset
|
883 | |
| 9045 | 884 | /** |
| 885 | * Checks if the given email address is syntactically valid. | |
| 886 | * | |
| 887 | * @param address The email address to validate. | |
| 888 | * | |
| 889 | * @return True if the email address is syntactically correct. | |
| 890 | */ | |
| 891 | gboolean gaim_email_is_valid(const char *address); | |
| 892 | ||
|
9670
4e8cb7ef72ab
[gaim-migrate @ 10522]
Daniel Atallah <datallah@pidgin.im>
parents:
9642
diff
changeset
|
893 | /** |
|
11135
063678d038f9
[gaim-migrate @ 13196]
Mark Doliner <markdoliner@pidgin.im>
parents:
11132
diff
changeset
|
894 | * This function extracts a list of URIs from the a "text/uri-list" |
|
063678d038f9
[gaim-migrate @ 13196]
Mark Doliner <markdoliner@pidgin.im>
parents:
11132
diff
changeset
|
895 | * string. It was "borrowed" from gnome_uri_list_extract_uris |
|
063678d038f9
[gaim-migrate @ 13196]
Mark Doliner <markdoliner@pidgin.im>
parents:
11132
diff
changeset
|
896 | * |
|
063678d038f9
[gaim-migrate @ 13196]
Mark Doliner <markdoliner@pidgin.im>
parents:
11132
diff
changeset
|
897 | * @param uri_list An uri-list in the standard format. |
|
9670
4e8cb7ef72ab
[gaim-migrate @ 10522]
Daniel Atallah <datallah@pidgin.im>
parents:
9642
diff
changeset
|
898 | * |
|
11135
063678d038f9
[gaim-migrate @ 13196]
Mark Doliner <markdoliner@pidgin.im>
parents:
11132
diff
changeset
|
899 | * @return A GList containing strings allocated with g_malloc |
|
063678d038f9
[gaim-migrate @ 13196]
Mark Doliner <markdoliner@pidgin.im>
parents:
11132
diff
changeset
|
900 | * that have been splitted from uri-list. |
|
9670
4e8cb7ef72ab
[gaim-migrate @ 10522]
Daniel Atallah <datallah@pidgin.im>
parents:
9642
diff
changeset
|
901 | */ |
|
11135
063678d038f9
[gaim-migrate @ 13196]
Mark Doliner <markdoliner@pidgin.im>
parents:
11132
diff
changeset
|
902 | GList *gaim_uri_list_extract_uris(const gchar *uri_list); |
|
9670
4e8cb7ef72ab
[gaim-migrate @ 10522]
Daniel Atallah <datallah@pidgin.im>
parents:
9642
diff
changeset
|
903 | |
|
4e8cb7ef72ab
[gaim-migrate @ 10522]
Daniel Atallah <datallah@pidgin.im>
parents:
9642
diff
changeset
|
904 | /** |
|
11135
063678d038f9
[gaim-migrate @ 13196]
Mark Doliner <markdoliner@pidgin.im>
parents:
11132
diff
changeset
|
905 | * This function extracts a list of filenames from a |
|
063678d038f9
[gaim-migrate @ 13196]
Mark Doliner <markdoliner@pidgin.im>
parents:
11132
diff
changeset
|
906 | * "text/uri-list" string. It was "borrowed" from |
|
063678d038f9
[gaim-migrate @ 13196]
Mark Doliner <markdoliner@pidgin.im>
parents:
11132
diff
changeset
|
907 | * gnome_uri_list_extract_filenames |
|
063678d038f9
[gaim-migrate @ 13196]
Mark Doliner <markdoliner@pidgin.im>
parents:
11132
diff
changeset
|
908 | * |
|
063678d038f9
[gaim-migrate @ 13196]
Mark Doliner <markdoliner@pidgin.im>
parents:
11132
diff
changeset
|
909 | * @param uri_list A uri-list in the standard format. |
|
9670
4e8cb7ef72ab
[gaim-migrate @ 10522]
Daniel Atallah <datallah@pidgin.im>
parents:
9642
diff
changeset
|
910 | * |
|
11135
063678d038f9
[gaim-migrate @ 13196]
Mark Doliner <markdoliner@pidgin.im>
parents:
11132
diff
changeset
|
911 | * @return A GList containing strings allocated with g_malloc that |
|
063678d038f9
[gaim-migrate @ 13196]
Mark Doliner <markdoliner@pidgin.im>
parents:
11132
diff
changeset
|
912 | * contain the filenames in the uri-list. Note that unlike |
|
063678d038f9
[gaim-migrate @ 13196]
Mark Doliner <markdoliner@pidgin.im>
parents:
11132
diff
changeset
|
913 | * gaim_uri_list_extract_uris() function, this will discard |
|
063678d038f9
[gaim-migrate @ 13196]
Mark Doliner <markdoliner@pidgin.im>
parents:
11132
diff
changeset
|
914 | * any non-file uri from the result value. |
|
9670
4e8cb7ef72ab
[gaim-migrate @ 10522]
Daniel Atallah <datallah@pidgin.im>
parents:
9642
diff
changeset
|
915 | */ |
|
11135
063678d038f9
[gaim-migrate @ 13196]
Mark Doliner <markdoliner@pidgin.im>
parents:
11132
diff
changeset
|
916 | GList *gaim_uri_list_extract_filenames(const gchar *uri_list); |
|
9670
4e8cb7ef72ab
[gaim-migrate @ 10522]
Daniel Atallah <datallah@pidgin.im>
parents:
9642
diff
changeset
|
917 | |
|
7108
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
918 | /*@}*/ |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
919 | |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
920 | /************************************************************************** |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
921 | * UTF8 String Functions |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
922 | **************************************************************************/ |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
923 | /*@{*/ |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
924 | |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
925 | /** |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
926 | * Attempts to convert a string to UTF-8 from an unknown encoding. |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
927 | * |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
928 | * This function checks the locale and tries sane defaults. |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
929 | * |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
930 | * @param str The source string. |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
931 | * |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
932 | * @return The UTF-8 string, or @c NULL if it could not be converted. |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
933 | */ |
|
9642
ec0b88cf9161
[gaim-migrate @ 10490]
Mark Doliner <markdoliner@pidgin.im>
parents:
9427
diff
changeset
|
934 | gchar *gaim_utf8_try_convert(const char *str); |
|
7108
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
935 | |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
936 | /** |
| 10258 | 937 | * Salvages the valid UTF-8 characters from a string, replacing any |
| 938 | * invalid characters with a filler character (currently hardcoded to | |
| 939 | * '?'). | |
| 940 | * | |
| 941 | * @param str The source string. | |
| 942 | * | |
| 943 | * @return A valid UTF-8 string. | |
| 944 | */ | |
| 945 | gchar *gaim_utf8_salvage(const char *str); | |
| 946 | ||
| 947 | /** | |
|
12908
759e5e5ae83a
[gaim-migrate @ 15261]
Richard Laager <rlaager@pidgin.im>
parents:
12887
diff
changeset
|
948 | * Compares two UTF-8 strings case-insensitively. |
|
7108
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
949 | * |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
950 | * @param a The first string. |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
951 | * @param b The second string. |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
952 | * |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
953 | * @return -1 if @a is less than @a b. |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
954 | * 0 if @a is equal to @a b. |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
955 | * 1 if @a is greater than @a b. |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
956 | */ |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
957 | int gaim_utf8_strcasecmp(const char *a, const char *b); |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
958 | |
| 7564 | 959 | /** |
|
11552
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11501
diff
changeset
|
960 | * Case insensitive search for a word in a string. The needle string |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11501
diff
changeset
|
961 | * must be contained in the haystack string and not be immediately |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11501
diff
changeset
|
962 | * preceded or immediately followed by another alpha-numeric character. |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11501
diff
changeset
|
963 | * |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11501
diff
changeset
|
964 | * @param haystack The string to search in. |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11501
diff
changeset
|
965 | * @param needle The substring to find. |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11501
diff
changeset
|
966 | * |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11501
diff
changeset
|
967 | * @return TRUE if haystack has the word, otherwise FALSE |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11501
diff
changeset
|
968 | */ |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11501
diff
changeset
|
969 | gboolean gaim_utf8_has_word(const char *haystack, const char *needle); |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11501
diff
changeset
|
970 | |
|
674a2a79943a
[gaim-migrate @ 13812]
Casey Harkins <charkins@pidgin.im>
parents:
11501
diff
changeset
|
971 | /** |
|
13090
aee4ed853ff3
[gaim-migrate @ 15451]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13033
diff
changeset
|
972 | * Prints a UTF-8 message to the given file stream. The function |
|
aee4ed853ff3
[gaim-migrate @ 15451]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13033
diff
changeset
|
973 | * tries to convert the UTF-8 message to user's locale. If this |
|
aee4ed853ff3
[gaim-migrate @ 15451]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13033
diff
changeset
|
974 | * is not possible, the original UTF-8 text will be printed. |
|
aee4ed853ff3
[gaim-migrate @ 15451]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13033
diff
changeset
|
975 | * |
|
aee4ed853ff3
[gaim-migrate @ 15451]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13033
diff
changeset
|
976 | * @param filestream The file stream (e.g. STDOUT or STDERR) |
|
aee4ed853ff3
[gaim-migrate @ 15451]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13033
diff
changeset
|
977 | * @param message The message to print. |
|
aee4ed853ff3
[gaim-migrate @ 15451]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13033
diff
changeset
|
978 | */ |
|
aee4ed853ff3
[gaim-migrate @ 15451]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13033
diff
changeset
|
979 | void gaim_print_utf8_to_console(FILE *filestream, char *message); |
|
aee4ed853ff3
[gaim-migrate @ 15451]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13033
diff
changeset
|
980 | |
|
aee4ed853ff3
[gaim-migrate @ 15451]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13033
diff
changeset
|
981 | /** |
| 7564 | 982 | * Checks for messages starting with "/me " |
| 983 | * | |
| 984 | * @param message The message to check | |
| 985 | * @param len The message length, or -1 | |
| 986 | * | |
| 987 | * @return TRUE if it starts with /me, and it has been removed, otherwise FALSE | |
| 988 | */ | |
| 989 | gboolean gaim_message_meify(char *message, size_t len); | |
| 990 | ||
| 7889 | 991 | /** |
| 992 | * Removes the underscore characters from a string used identify the mnemonic | |
| 993 | * character. | |
| 994 | * | |
| 995 | * @param in The string to strip | |
| 996 | * | |
| 997 | * @return The stripped string | |
| 998 | */ | |
| 8432 | 999 | char *gaim_text_strip_mnemonic(const char *in); |
| 7889 | 1000 | |
|
7108
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
1001 | /*@}*/ |
|
82655fa54acb
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
1002 | |
| 8432 | 1003 | /** |
| 1004 | * Adds 8 to something. | |
| 1005 | * | |
| 1006 | * Blame SimGuy. | |
| 1007 | * | |
| 9000 | 1008 | * @param x The number to add 8 to. |
| 8432 | 1009 | * |
| 9000 | 1010 | * @return x + 8 |
| 8432 | 1011 | */ |
| 8433 | 1012 | #define gaim_add_eight(x) ((x)+8) |
| 8432 | 1013 | |
| 9926 | 1014 | /** |
| 1015 | * Does the reverse of gaim_escape_filename | |
| 1016 | * | |
| 1017 | * This will change hex codes and such to their ascii equivalents. | |
| 1018 | * | |
| 1019 | * @param str The string to translate. | |
| 1020 | * | |
| 1021 | * @return The resulting string. | |
| 1022 | */ | |
| 1023 | const char *gaim_unescape_filename(const char *str); | |
| 1024 | ||
| 1025 | /** | |
| 1026 | * Escapes filesystem-unfriendly characters from a filename | |
| 1027 | * | |
| 1028 | * @param str The string to translate. | |
| 1029 | * | |
| 1030 | * @return The resulting string. | |
| 1031 | */ | |
| 1032 | const char *gaim_escape_filename(const char *str); | |
| 1033 | ||
|
5944
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5943
diff
changeset
|
1034 | #ifdef __cplusplus |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5943
diff
changeset
|
1035 | } |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5943
diff
changeset
|
1036 | #endif |
|
f19df037ac58
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5943
diff
changeset
|
1037 | |
| 4890 | 1038 | #endif /* _GAIM_UTIL_H_ */ |