2013-03-31 21:44:48 +02:00
|
|
|
/* HexChat
|
|
|
|
* Copyright (C) 1998-2010 Peter Zelezny.
|
|
|
|
* Copyright (C) 2009-2013 Berke Viktor.
|
|
|
|
*
|
|
|
|
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2011-02-24 04:14:30 +01:00
|
|
|
/************************************************************************
|
|
|
|
* This technique was borrowed in part from the source code to
|
|
|
|
* ircd-hybrid-5.3 to implement case-insensitive string matches which
|
|
|
|
* are fully compliant with Section 2.2 of RFC 1459, the copyright
|
|
|
|
* of that code being (C) 1990 Jarkko Oikarinen and under the GPL.
|
|
|
|
*
|
|
|
|
* A special thanks goes to Mr. Okarinen for being the one person who
|
|
|
|
* seems to have ever noticed this section in the original RFC and
|
|
|
|
* written code for it. Shame on all the rest of you (myself included).
|
|
|
|
*
|
|
|
|
* --+ Dagmar d'Surreal
|
|
|
|
*/
|
|
|
|
|
2012-10-25 01:33:23 +02:00
|
|
|
#ifndef HEXCHAT_UTIL_H
|
|
|
|
#define HEXCHAT_UTIL_H
|
2011-02-24 04:14:30 +01:00
|
|
|
|
|
|
|
#define rfc_tolower(c) (rfc_tolowertab[(unsigned char)(c)])
|
|
|
|
|
2017-08-18 21:59:31 +02:00
|
|
|
#define ELLIPSIS "\xe2\x80\xa6"
|
|
|
|
|
2011-02-24 04:14:30 +01:00
|
|
|
extern const unsigned char rfc_tolowertab[];
|
|
|
|
|
|
|
|
char *expand_homedir (char *file);
|
|
|
|
void path_part (char *file, char *path, int pathlen);
|
|
|
|
int match (const char *mask, const char *string);
|
|
|
|
char *file_part (char *file);
|
2016-05-28 08:52:26 +02:00
|
|
|
void for_files (const char *dirname, const char *mask, void callback (char *file));
|
2011-02-24 04:14:30 +01:00
|
|
|
int rfc_casecmp (const char *, const char *);
|
|
|
|
int rfc_ncasecmp (char *, char *, int);
|
|
|
|
int buf_get_line (char *, char **, int *, int len);
|
|
|
|
char *nocasestrstr (const char *text, const char *tofind);
|
|
|
|
char *country (char *);
|
|
|
|
void country_search (char *pattern, void *ud, void (*print)(void *, char *, ...));
|
2012-10-28 00:05:40 +02:00
|
|
|
char *get_sys_str (int with_cpu);
|
2014-04-25 19:41:38 +02:00
|
|
|
void util_exec (const char *cmd);
|
2011-02-24 04:14:30 +01:00
|
|
|
#define STRIP_COLOR 1
|
|
|
|
#define STRIP_ATTRIB 2
|
|
|
|
#define STRIP_HIDDEN 4
|
|
|
|
#define STRIP_ESCMARKUP 8
|
|
|
|
#define STRIP_ALL 7
|
|
|
|
gchar *strip_color (const char *text, int len, int flags);
|
|
|
|
int strip_color2 (const char *src, int len, char *dst, int flags);
|
|
|
|
int strip_hidden_attribute (char *src, char *dst);
|
|
|
|
char *errorstring (int err);
|
|
|
|
int waitline (int sok, char *buf, int bufsize, int);
|
2011-02-28 18:59:32 +01:00
|
|
|
#ifdef WIN32
|
|
|
|
int waitline2 (GIOChannel *source, char *buf, int bufsize);
|
2011-05-30 21:15:39 +02:00
|
|
|
int get_cpu_arch (void);
|
2011-02-28 18:59:32 +01:00
|
|
|
#else
|
|
|
|
#define waitline2(source,buf,size) waitline(serv->childread,buf,size,0)
|
|
|
|
#endif
|
2011-02-24 04:14:30 +01:00
|
|
|
unsigned long make_ping_time (void);
|
2012-11-03 18:24:25 +01:00
|
|
|
void move_file (char *src_dir, char *dst_dir, char *fname, int dccpermissions);
|
2011-02-24 04:14:30 +01:00
|
|
|
int token_foreach (char *str, char sep, int (*callback) (char *str, void *ud), void *ud);
|
|
|
|
guint32 str_hash (const char *key);
|
|
|
|
guint32 str_ihash (const unsigned char *key);
|
|
|
|
void safe_strcpy (char *dest, const char *src, int bytes_left);
|
2011-11-29 20:15:56 +01:00
|
|
|
void canonalize_key (char *key);
|
2014-07-19 05:36:13 +02:00
|
|
|
int portable_mode (void);
|
2013-09-02 20:24:37 +02:00
|
|
|
char *encode_sasl_pass_plain (char *user, char *pass);
|
2016-04-14 00:46:20 +02:00
|
|
|
char *challengeauth_response (const char *username, const char *password, const char *challenge);
|
2013-11-02 07:05:55 +01:00
|
|
|
size_t strftime_validated (char *dest, size_t destsize, const char *format, const struct tm *time);
|
2015-03-20 09:56:04 +01:00
|
|
|
gsize strftime_utf8 (char *dest, gsize destsize, const char *format, time_t time);
|
2011-02-24 04:14:30 +01:00
|
|
|
#endif
|