/* * ---------------------------------------------------------------- * Night Light IRC Proxy Connection Configuration Functions Header * ---------------------------------------------------------------- * Copyright (C) 1997-2003 Jonas Kvinge * All rights reserved. * * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA. * * Last modified by: * Jonas Kvinge (17.11.2006) * */ #ifdef CONN_CONF_H #warning "conn_conf.h already included." #else #define CONN_CONF_H #define CONN_CONF_NAME_DEFAULT "Connection001" #define CONN_CONF_NICK_DEFAULT "ircproxy" #define CONN_CONF_AWAYNICK_DEFAULT "ircproxyA" #define CONN_CONF_USER_DEFAULT "ircproxy" #define CONN_CONF_HOST_DEFAULT "0.0.0.0" #define CONN_CONF_USERMODE_DEFAULT "+i" #define CONN_CONF_USERINFO_DEFAULT "Night Light IRC Proxy" #define CONN_CONF_CHANS_DEFAULT "#eclipsed" #define CONN_CONF_AUTOCONNECT_DEFAULT 1 #define CONN_CONF_LOGGING_DEFAULT 1 #define CONN_CONF_AUTOAWAY_DEFAULT 1 #define CONN_CONF_PUBLICAWAY_DEFAULT 1 #define CONN_CONF_REGAINNICK_DEFAULT 1 #define CONN_CONF_MAXCLIENTS_DEFAULT 5 #define CONN_CONF_SENDMAXLINES_DEFAULT 1024 #define CONN_CONF_SENDLINETIME_DEFAULT 10 #define CONN_CONF_SENDMAXBUFFER_DEFAULT 1024 #define CONN_CONF_SENDBUFFERTIME_DEFAULT 120 #define CONN_CONF_AWAYMSG_DEFAULT "Not here, detached." #define CONN_CONF_PUBLICAWAYMSG_DEFAULT "is gone." #define CONN_CONF_PUBLICBACKMSG_DEFAULT "is back." #define CONN_CONF_CHANCYCLE_DEFAULT TRUE #define CONN_CONF_NICKSERVNUH_DEFAULT "NickServ!nickserv@nickserv" #define CONN_CONF_NICKSERVPASS_DEFAULT "blah" #define CONN_CONF_SERVERHOST_DEFAULT "irc.night-light.net" #define CONN_CONF_SERVERPORT_DEFAULT "6667" #define CONN_CONF_SERVERPASS_NONE "0" #define CONN_CONF_SERVERPASS_DEFAULT "0" /* BIT MASKS - JONAS (24.11.2007) */ #define CONN_CONF_BITMASK_IPV6 1 #define CONN_CONF_BITMASK_SSL 2 #define CONN_CONF_BITMASK_AUTOCONNECT 4 #define CONN_CONF_BITMASK_LOGGING 8 #define CONN_CONF_BITMASK_AUTOAWAY 16 #define CONN_CONF_BITMASK_PUBLICAWAY 32 #define CONN_CONF_BITMASK_REGAINNICK 64 #define CONN_CONF_BITMASK_CHANCYCLE 128 /* MACROS - JONAS (24.11.2007) */ #define ConnConf_SetIPv6(x) ((x)->ConfFlags |= CONN_CONF_BITMASK_IPV6) #define ConnConf_SetSSL(x) ((x)->ConfFlags |= CONN_CONF_BITMASK_SSL) #define ConnConf_SetAutoConnect(x) ((x)->ConfFlags |= CONN_CONF_BITMASK_AUTOCONNECT) #define ConnConf_SetLogging(x) ((x)->ConfFlags |= CONN_CONF_BITMASK_LOGGING) #define ConnConf_SetAutoAway(x) ((x)->ConfFlags |= CONN_CONF_BITMASK_AUTOAWAY) #define ConnConf_SetPublicAway(x) ((x)->ConfFlags |= CONN_CONF_BITMASK_PUBLICAWAY) #define ConnConf_SetRegainNick(x) ((x)->ConfFlags |= CONN_CONF_BITMASK_REGAINNICK) #define ConnConf_SetChanCycle(x) ((x)->ConfFlags |= CONN_CONF_BITMASK_CHANCYCLE) #define ConnConf_ClearIPv6(x) ((x)->ConfFlags &= ~CONN_CONF_BITMASK_IPV6) #define ConnConf_ClearSSL(x) ((x)->ConfFlags &= ~CONN_CONF_BITMASK_SSL) #define ConnConf_ClearAutoConnect(x) ((x)->ConfFlags &= ~CONN_CONF_BITMASK_AUTOCONNECT) #define ConnConf_ClearLogging(x) ((x)->ConfFlags &= ~CONN_CONF_BITMASK_LOGGING) #define ConnConf_ClearAutoAway(x) ((x)->ConfFlags &= ~CONN_CONF_BITMASK_AUTOAWAY) #define ConnConf_ClearPublicAway(x) ((x)->ConfFlags &= ~CONN_CONF_BITMASK_PUBLICAWAY) #define ConnConf_ClearRegainNick(x) ((x)->ConfFlags &= ~CONN_CONF_BITMASK_REGAINNICK) #define ConnConf_ClearChanCycle(x) ((x)->ConfFlags &= ~CONN_CONF_BITMASK_CHANCYCLE) #define ConnConf_IsIPv6(x) ((x)->ConfFlags & CONN_CONF_BITMASK_IPV6) #define ConnConf_IsSSL(x) ((x)->ConfFlags & CONN_CONF_BITMASK_SSL) #define ConnConf_IsAutoConnect(x) ((x)->ConfFlags & CONN_CONF_BITMASK_AUTOCONNECT) #define ConnConf_IsLogging(x) ((x)->ConfFlags & CONN_CONF_BITMASK_LOGGING) #define ConnConf_IsAutoAway(x) ((x)->ConfFlags & CONN_CONF_BITMASK_AUTOAWAY) #define ConnConf_IsPublicAway(x) ((x)->ConfFlags & CONN_CONF_BITMASK_PUBLICAWAY) #define ConnConf_IsRegainNick(x) ((x)->ConfFlags & CONN_CONF_BITMASK_REGAINNICK) #define ConnConf_IsChanCycle(x) ((x)->ConfFlags & CONN_CONF_BITMASK_CHANCYCLE) /* STRUCTURES - JONAS (18.07.2001) */ struct ConnConf_Struct { char *Name; char *Nick; char *AwayNick; char *User; char *Host; char *Mode; char *Info; char *Chans; char *AwayMsg; char *PublicDetachMsg; char *PublicAttachMsg; char *NickServNUH; char *NickServPass; unsigned short int MaxClients; unsigned short int SendMaxLines; unsigned short int SendLineTime; unsigned short int SendMaxBuffer; unsigned short int SendBufferTime; unsigned long int ConfFlags; unsigned short int Servers; struct ConnConfServer_Struct *Server_Head; struct ConnConfServer_Struct *Server_Tail; struct ConnConf_Struct *Next; struct ConnConf_Struct *Prev; }; struct ConnConfServer_Struct { char *Host; unsigned long int Port; char *Pass; struct ConnConfServer_Struct *Next; struct ConnConfServer_Struct *Prev; }; /* FUNCTION PROTOTYPES - JONAS (18.07.2001) */ signed long int conn_conf_read(void); struct ConnConf_Struct *conn_conf_add(const char *const NamePT); void conn_conf_rem(struct ConnConf_Struct *ConnConf); struct ConnConf_Struct *conn_conf_get(const char *const NamePT); void conn_conf_destroy(void); struct ConnConfServer_Struct *conn_conf_addserver(struct ConnConf_Struct *ConnConf, const char *const HostPT, const unsigned long int Port, const char *const PassPT); void conn_conf_remserver(struct ConnConf_Struct *ConnConf, struct ConnConfServer_Struct *ConnConfServer); struct ConnConfServer_Struct *conn_conf_getserver(struct ConnConf_Struct *ConnConf, const char *const HostPT); void conn_conf_remservers(struct ConnConf_Struct *ConnConf); #endif