#include <stdio.h>
#include "account.h"
Include dependency graph for util.h:
Go to the source code of this file.
Base16 Functions | |
unsigned char * | gaim_base16_encode (const unsigned char *str, int len) |
Converts a string to its base-16 equivalent. | |
int | gaim_base16_decode (const char *str, unsigned char **ret_str) |
Converts a string back from its base-16 equivalent. | |
Base64 Functions | |
unsigned char * | gaim_base64_encode (const unsigned char *buf, size_t len) |
Converts a string to its base-64 equivalent. | |
void | gaim_base64_decode (const char *str, char **ret_str, int *ret_len) |
Converts a string back from its base-64 equivalent. | |
Quoted Printable Functions | |
void | gaim_quotedp_decode (const char *str, char **ret_str, int *ret_len) |
Converts a quoted printable string back to its readable equivalent. | |
MIME Functions | |
char * | gaim_mime_decode_field (const char *str) |
Converts a MIME header field string back to its readable equivalent according to RFC 2047. | |
Date/Time Functions | |
const char * | gaim_date (void) |
Returns the current local time in hour:minute:second form. | |
const char * | gaim_date_full (void) |
Returns the date and time in human-readable form. | |
time_t | gaim_time_build (int year, int month, int day, int hour, int min, int sec) |
Builds a time_t from the supplied information. | |
time_t | gaim_str_to_time (const char *timestamp, gboolean utc) |
Parses a timestamp in jabber or ISO8601 format and returns a time_t. | |
Markup Functions | |
gboolean | gaim_markup_find_tag (const char *needle, const char *haystack, const char **start, const char **end, GData **attributes) |
Finds a HTML tag matching the given name. | |
gboolean | gaim_markup_extract_info_field (const char *str, int len, GString *dest, const char *start_token, int skip, const char *end_token, char check_value, const char *no_value_token, const char *display_name, gboolean is_link, const char *link_prefix) |
Extracts a field of data from HTML. | |
void | gaim_markup_html_to_xhtml (const char *html, char **dest_xhtml, char **dest_plain) |
Converts HTML markup to XHTML. | |
char * | gaim_markup_strip_html (const char *str) |
Strips HTML tags from a string. | |
char * | gaim_markup_linkify (const char *str) |
Adds the necessary HTML code to turn URIs into HTML links in a string. | |
char * | gaim_escape_html (const char *html) |
Escapes HTML special characters to be displayed literally. | |
char * | gaim_unescape_html (const char *html) |
Unescapes HTML entities to their literal characters. | |
Path/Filename Functions | |
const gchar * | gaim_home_dir (void) |
Returns the user's home directory. | |
char * | gaim_user_dir (void) |
Returns the gaim settings directory in the user's home directory. | |
void | set_gaim_user_dir (const char *dir) |
Define a custom gaim settings directory, overriding the default (user's home directory/.gaim). | |
int | gaim_build_dir (const char *path, int mode) |
Builds a complete path from the root, making any directories along the path which do not already exist. | |
FILE * | gaim_mkstemp (char **path) |
Creates a temporary file and returns a file pointer to it. | |
gboolean | gaim_program_is_valid (const char *program) |
Checks if the given program name is valid and executable. | |
char * | gaim_fd_get_ip (int fd) |
Returns the IP address from a socket file descriptor. | |
String Functions | |
const char * | gaim_normalize (const GaimAccount *account, const char *str) |
Normalizes a string, so that it is suitable for comparison. | |
gboolean | gaim_str_has_prefix (const char *s, const char *p) |
Compares two strings to see if the first contains the second as a proper prefix. | |
gboolean | gaim_str_has_suffix (const char *s, const char *x) |
Compares two strings to see if the second is a proper suffix of the first. | |
gchar * | gaim_str_sub_away_formatters (const char *str, const char *name) |
Looks for n, d, or t in a string, and replaces them with the specified name, date, and time, respectively. | |
gchar * | gaim_strdup_withhtml (const gchar *src) |
Duplicates a string and replaces all newline characters from the source string with HTML linebreaks. | |
char * | gaim_str_add_cr (const char *str) |
Ensures that all linefeeds have a matching carriage return. | |
void | gaim_str_strip_cr (char *str) |
Strips all carriage returns from a string. | |
gchar * | gaim_strreplace (const char *string, const char *delimiter, const char *replacement) |
Given a string, this replaces one substring with another and returns a newly allocated string. | |
gchar * | gaim_strcasereplace (const char *string, const char *delimiter, const char *replacement) |
Given a string, this replaces one substring with another ignoring case and returns a newly allocated string. | |
const char * | gaim_strcasestr (const char *haystack, const char *needle) |
This is like strstr, except that it ignores ASCII case in searching for the substring. | |
char * | gaim_str_size_to_units (size_t size) |
Returns a string representing a filesize in the appropriate units (MB, KB, GB, etc.). | |
char * | gaim_str_seconds_to_string (guint sec) |
Converts seconds into a human-readable form. | |
URI/URL Functions | |
gboolean | gaim_url_parse (const char *url, char **ret_host, int *ret_port, char **ret_path) |
Parses a URL, returning its host, port, and file path. | |
void | gaim_url_fetch (const char *url, gboolean full, const char *user_agent, gboolean http11, void(*cb)(void *, const char *, size_t), void *data) |
Fetches the data from a URL, and passes it to a callback function. | |
const char * | gaim_url_decode (const char *str) |
Decodes a URL into a plain string. | |
const char * | gaim_url_encode (const char *str) |
Encodes a URL into an escaped string. | |
Defines | |
#define | gaim_add_eight(x) ((x)+8) |
Adds 8 to something. |
gaim
Gaim is the legal property of its developers, whose names are too numerous to list here. Please refer to the COPYRIGHT file distributed with this source distribution.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Adds 8 to something. Blame SimGuy.
|
|
Converts a string back from its base-16 equivalent.
|
|
Converts a string to its base-16 equivalent.
|
|
Converts a string back from its base-64 equivalent.
|
|
Converts a string to its base-64 equivalent.
|
|
Builds a complete path from the root, making any directories along the path which do not already exist.
|
|
Returns the current local time in hour:minute:second form. The returned string is stored in a static buffer, so the result should be g_strdup()'d if it's intended to be used for long.
|
|
Returns the date and time in human-readable form. The returned string is stored in a static buffer, so the result should be g_strdup()'d if it's intended to be used for long.
|
|
Escapes HTML special characters to be displayed literally. For example '&' is replaced by "&" and so on
|
|
Returns the IP address from a socket file descriptor.
|
|
Returns the user's home directory.
|
|
Extracts a field of data from HTML. This is a scary function. See protocols/msn/msn.c and protocols/yahoo/yahoo.c for example usage.
|
|
Finds a HTML tag matching the given name. This locates an HTML tag's start and end, and stores its attributes in a GData hash table. The names of the attributes are lower-cased in the hash table, and the name of the tag is case insensitive.
|
|
Converts HTML markup to XHTML.
|
|
Adds the necessary HTML code to turn URIs into HTML links in a string.
|
|
Strips HTML tags from a string.
|
|
Checks for messages starting with "/me ".
|
|
Converts a MIME header field string back to its readable equivalent according to RFC 2047. Basically, a header is plain ASCII and can contain any number of sections called "encoded-words." The format of an encoded word is =?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?= =? designates the beginning of the encoded-word ?= designates the end of the encoded-word ? segments the encoded word into three pieces. The first piece is the character set, the second piece is the encoding, and the third piece is the encoded text.
|
|
Creates a temporary file and returns a file pointer to it. This is like mkstemp(), but returns a file pointer and uses a pre-set template. It uses the semantics of tempnam() for the directory to use and allocates the space for the file path. The caller is responsible for closing the file and removing it when done, as well as freeing the space pointed to by path with g_free().
|
|
Normalizes a string, so that it is suitable for comparison. The returned string will point to a static buffer, so if the string is intended to be kept long-term, you must g_strdup() it. Also, calling normalize() twice in the same line will lead to problems.
|
|
Checks if the given program name is valid and executable.
|
|
Converts a quoted printable string back to its readable equivalent.
|
|
Ensures that all linefeeds have a matching carriage return.
|
|
Compares two strings to see if the first contains the second as a proper prefix.
|
|
Compares two strings to see if the second is a proper suffix of the first.
|
|
Converts seconds into a human-readable form.
|
|
Returns a string representing a filesize in the appropriate units (MB, KB, GB, etc.).
|
|
Strips all carriage returns from a string.
|
|
Looks for n, d, or t in a string, and replaces them with the specified name, date, and time, respectively.
|
|
Parses a timestamp in jabber or ISO8601 format and returns a time_t.
|
|
Given a string, this replaces one substring with another ignoring case and returns a newly allocated string.
|
|
This is like strstr, except that it ignores ASCII case in searching for the substring.
|
|
Duplicates a string and replaces all newline characters from the source string with HTML linebreaks.
|
|
Given a string, this replaces one substring with another and returns a newly allocated string.
|
|
Removes the underscore characters from a string used identify the mnemonic character.
|
|
Builds a time_t from the supplied information.
|
|
Unescapes HTML entities to their literal characters. For example "&" is replaced by '&' and so on. Actually only "&", """, "<" and ">" are currently supported.
|
|
Decodes a URL into a plain string. This will change hex codes and such to their ascii equivalents.
|
|
Encodes a URL into an escaped string. This will change non-alphanumeric characters to hex codes.
|
|
Fetches the data from a URL, and passes it to a callback function.
|
|
Parses a URL, returning its host, port, and file path. The returned data must be freed.
|
|
Returns the gaim settings directory in the user's home directory.
|
|
Compares two UTF-8 strings.
|
|
Attempts to convert a string to UTF-8 from an unknown encoding. This function checks the locale and tries sane defaults.
|
|
Define a custom gaim settings directory, overriding the default (user's home directory/.gaim).
|