1999-09-03 10:27:29 -04:00
|
|
|
#ifndef __COMMON_H
|
|
|
|
#define __COMMON_H
|
|
|
|
|
2001-07-14 20:39:48 -04:00
|
|
|
#define IRSSI_DIR_FULL "%s/.irssi" /* %s == g_get_home_dir() */
|
2002-02-10 09:35:21 -05:00
|
|
|
|
|
|
|
#define IRSSI_GLOBAL_CONFIG "irssi.conf" /* config file name in /etc/ */
|
2002-02-10 09:33:42 -05:00
|
|
|
#define IRSSI_HOME_CONFIG "config" /* config file name in ~/.irssi/ */
|
2001-07-14 20:39:48 -04:00
|
|
|
|
2018-03-29 16:00:40 -04:00
|
|
|
#define IRSSI_ABI_VERSION 16
|
2015-11-23 18:08:20 -05:00
|
|
|
|
2002-10-21 15:05:44 -04:00
|
|
|
#define DEFAULT_SERVER_ADD_PORT 6667
|
2017-06-04 11:41:38 -04:00
|
|
|
#define DEFAULT_SERVER_ADD_TLS_PORT 6697
|
2002-10-21 15:05:44 -04:00
|
|
|
|
1999-09-03 10:27:29 -04:00
|
|
|
#ifdef HAVE_CONFIG_H
|
2008-02-16 06:13:45 -05:00
|
|
|
#include "irssi-config.h"
|
1999-09-03 10:27:29 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2000-08-30 18:29:55 -04:00
|
|
|
#include <stddef.h>
|
1999-09-03 10:27:29 -04:00
|
|
|
#include <stdarg.h>
|
|
|
|
#include <ctype.h>
|
2008-03-14 06:34:34 -04:00
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
1999-09-03 10:27:29 -04:00
|
|
|
#include <errno.h>
|
|
|
|
#include <time.h>
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
2000-10-26 14:12:20 -04:00
|
|
|
#ifdef HAVE_SYS_TIME_H
|
|
|
|
# include <sys/time.h>
|
|
|
|
#endif
|
1999-09-03 10:27:29 -04:00
|
|
|
#include <sys/stat.h>
|
|
|
|
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
# include <unistd.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_DIRENT_H
|
|
|
|
# include <dirent.h>
|
|
|
|
#endif
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
|
|
|
#include <glib.h>
|
2001-01-15 19:14:14 -05:00
|
|
|
#ifdef HAVE_GMODULE
|
|
|
|
# include <gmodule.h>
|
|
|
|
#endif
|
1999-09-03 10:27:29 -04:00
|
|
|
|
2002-11-21 12:48:40 -05:00
|
|
|
#if defined (UOFF_T_INT)
|
|
|
|
typedef unsigned int uoff_t;
|
|
|
|
#elif defined (UOFF_T_LONG)
|
|
|
|
typedef unsigned long uoff_t;
|
|
|
|
#elif defined (UOFF_T_LONG_LONG)
|
|
|
|
typedef unsigned long long uoff_t;
|
|
|
|
#else
|
|
|
|
# error uoff_t size not set
|
|
|
|
#endif
|
|
|
|
|
2001-07-14 20:39:48 -04:00
|
|
|
/* input functions */
|
2000-11-23 18:29:32 -05:00
|
|
|
#define G_INPUT_READ (1 << 0)
|
|
|
|
#define G_INPUT_WRITE (1 << 1)
|
1999-09-03 10:27:29 -04:00
|
|
|
|
2000-12-04 17:57:18 -05:00
|
|
|
typedef void (*GInputFunction) (void *data, GIOChannel *source, int condition);
|
1999-09-03 10:27:29 -04:00
|
|
|
|
2000-12-04 17:57:18 -05:00
|
|
|
int g_input_add(GIOChannel *source, int condition,
|
2000-07-16 16:18:05 -04:00
|
|
|
GInputFunction function, void *data);
|
2000-12-04 17:57:18 -05:00
|
|
|
int g_input_add_full(GIOChannel *source, int priority, int condition,
|
2000-10-01 18:12:01 -04:00
|
|
|
GInputFunction function, void *data);
|
1999-09-03 10:27:29 -04:00
|
|
|
|
2001-07-14 20:39:48 -04:00
|
|
|
/* return full path for ~/.irssi */
|
|
|
|
const char *get_irssi_dir(void);
|
|
|
|
/* return full path for ~/.irssi/config */
|
|
|
|
const char *get_irssi_config(void);
|
|
|
|
|
|
|
|
/* max. size for %d */
|
2000-03-18 07:52:51 -05:00
|
|
|
#define MAX_INT_STRLEN ((sizeof(int) * CHAR_BIT + 2) / 3 + 1)
|
1999-09-03 10:27:29 -04:00
|
|
|
|
2001-11-27 19:54:49 -05:00
|
|
|
#define g_free_not_null(a) g_free(a)
|
2001-07-14 20:39:48 -04:00
|
|
|
|
|
|
|
#define g_free_and_null(a) \
|
|
|
|
G_STMT_START { \
|
|
|
|
if (a) { g_free(a); (a) = NULL; } \
|
|
|
|
} G_STMT_END
|
|
|
|
|
2002-01-27 15:45:59 -05:00
|
|
|
/* ctype.h isn't safe with chars, use our own instead */
|
|
|
|
#define i_toupper(x) toupper((int) (unsigned char) (x))
|
|
|
|
#define i_tolower(x) tolower((int) (unsigned char) (x))
|
|
|
|
#define i_isalnum(x) isalnum((int) (unsigned char) (x))
|
|
|
|
#define i_isalpha(x) isalpha((int) (unsigned char) (x))
|
|
|
|
#define i_isascii(x) isascii((int) (unsigned char) (x))
|
|
|
|
#define i_isblank(x) isblank((int) (unsigned char) (x))
|
|
|
|
#define i_iscntrl(x) iscntrl((int) (unsigned char) (x))
|
|
|
|
#define i_isdigit(x) isdigit((int) (unsigned char) (x))
|
|
|
|
#define i_isgraph(x) isgraph((int) (unsigned char) (x))
|
|
|
|
#define i_islower(x) islower((int) (unsigned char) (x))
|
|
|
|
#define i_isprint(x) isprint((int) (unsigned char) (x))
|
|
|
|
#define i_ispunct(x) ispunct((int) (unsigned char) (x))
|
|
|
|
#define i_isspace(x) isspace((int) (unsigned char) (x))
|
|
|
|
#define i_isupper(x) isupper((int) (unsigned char) (x))
|
|
|
|
#define i_isxdigit(x) isxdigit((int) (unsigned char) (x))
|
|
|
|
|
2001-01-01 02:45:54 -05:00
|
|
|
typedef struct _IPADDR IPADDR;
|
|
|
|
|
|
|
|
typedef struct _LINEBUF_REC LINEBUF_REC;
|
|
|
|
typedef struct _NET_SENDBUF_REC NET_SENDBUF_REC;
|
|
|
|
typedef struct _RAWLOG_REC RAWLOG_REC;
|
|
|
|
|
2002-05-10 18:41:22 -04:00
|
|
|
typedef struct _CHAT_PROTOCOL_REC CHAT_PROTOCOL_REC;
|
2001-01-01 02:45:54 -05:00
|
|
|
typedef struct _CHATNET_REC CHATNET_REC;
|
|
|
|
typedef struct _SERVER_REC SERVER_REC;
|
|
|
|
typedef struct _WI_ITEM_REC WI_ITEM_REC;
|
|
|
|
typedef struct _CHANNEL_REC CHANNEL_REC;
|
|
|
|
typedef struct _QUERY_REC QUERY_REC;
|
|
|
|
typedef struct _NICK_REC NICK_REC;
|
|
|
|
|
|
|
|
typedef struct _SERVER_CONNECT_REC SERVER_CONNECT_REC;
|
|
|
|
typedef struct _SERVER_SETUP_REC SERVER_SETUP_REC;
|
|
|
|
typedef struct _CHANNEL_SETUP_REC CHANNEL_SETUP_REC;
|
|
|
|
|
2001-12-19 21:14:49 -05:00
|
|
|
typedef struct _WINDOW_REC WINDOW_REC;
|
|
|
|
|
1999-09-03 10:27:29 -04:00
|
|
|
#endif
|