diff -Nura aliases/statserv.conf aliases/statserv.conf --- aliases/statserv.conf 1970-01-01 03:00:00.000000000 +0300 +++ aliases/statserv.conf 2007-07-16 10:09:28.000000000 +0300 @@ -0,0 +1,4 @@ +/* statserv aliases */ + +alias statserv { type stats; }; +alias ss { target statserv; type stats; }; diff -Nura codepage.conf codepage.conf --- codepage.conf 1970-01-01 03:00:00.000000000 +0300 +++ codepage.conf 2007-07-16 10:10:08.000000000 +0300 @@ -0,0 +1,15 @@ +codepage { + default "CP1251"; + codepages + { + CP1251; + CP949; + UTF-8; + UTF-16; + KOI8-R; + iso8859-5; + MACCYRILLIC; + CP866; + TRANSLIT; + }; +}; diff -Nura Config Config --- Config 2007-06-14 21:15:52.000000000 +0300 +++ Config 2007-07-16 10:16:36.000000000 +0300 @@ -62,6 +62,13 @@ ARG="$ARG--enable-ziplinks=$ZIPLINKSDIR " fi fi +if [ "$ICONV" = "1" ] ; then +if test x"$ICONVDIR" = "x" ; then +ARG="$ARG--enable-iconv " +else +ARG="$ARG--enable-iconv=$ICONVDIR " +fi +fi if [ "$REMOTEINC" = "1" ] ; then ARG="$ARG--enable-libcurl=$CURLDIR " fi @@ -284,10 +291,10 @@ SPATH="`pwd`/src/ircd" HUB="1" DOMAINNAME=`hostname` -DEFPERM="0600" -CRYPTOIRCD="" +DEFPERM="0660" +CRYPTOIRCD="1" SSLDIR="" -ZIPLINKS="" +ZIPLINKS="1" ZIPLINKSDIR="" LISTEN_SIZE="5" NICKNAMEHISTORYLENGTH="2000" @@ -297,10 +304,12 @@ INET6="" REMOTEINC="" CURLDIR="" +ICONV="1" +ICONVDIR="" PREFIXAQ="1" SHOWLISTMODES="1" -TOPICNICKISNUH="" -SHUNNOTICES="" +TOPICNICKISNUH="1" +SHUNNOTICES="1" NOOPEROVERRIDE="" DISABLEUSERMOD="" OPEROVERRIDEVERIFY="" @@ -662,6 +671,48 @@ done fi +TEST="" +while [ -z "$TEST" ] ; do + if [ "$ICONV" = "1" ] ; then + TEST="Yes" + else + TEST="No" + fi + echo "" + echo "Do you want to enable iconv (codepage) support?" + echo $n "[$TEST] -> $c" + read cc + if [ -z "$cc" ] ; then + cc=$TEST + fi + case "$cc" in + [Yy]*) + ICONV="1" + ;; + [Nn]*) + ICONV="" + ;; + *) + echo "" + echo "You must enter either Yes or No" + TEST="" + ;; + esac +done + +if [ "$ICONV" = "1" ] ; then +TEST="" +echo "" +echo "If you know the path to iconv on your system, enter it here. If not" +echo "leave this blank" +echo $n "[$TEST] -> $c" + read cc +if [ -z "$cc" ] ; then + ICONVDIR="" +else + ICONVDIR=`eval echo $cc` # modified +fi +fi TEST="" while [ -z "$TEST" ] ; do diff -Nura configure configure --- configure 2007-06-12 03:06:33.000000000 +0300 +++ configure 2007-07-16 10:21:05.000000000 +0300 @@ -309,7 +309,7 @@ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT RM CP TOUCH OPENSSLPATH INSTALL MAKER GMAKE GUNZIP PKGCONFIG IRCDLIBS MKPASSWDLIBS CPP EGREP ALLOCA STRTOUL CRYPTOLIB MODULEFLAGS HAVE_ZLIB URL IRCDDIR BINDIR FD_SETSIZE TREINCDIR TRELIBS CARESINCDIR CARESLIBDIR CARESLIBS LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT RM CP TOUCH OPENSSLPATH INSTALL MAKER GMAKE GUNZIP PKGCONFIG IRCDLIBS MKPASSWDLIBS CPP EGREP ALLOCA STRTOUL CRYPTOLIB MODULEFLAGS HAVE_ZLIB URL HAVE_ICONV IRCDDIR BINDIR FD_SETSIZE TREINCDIR TRELIBS CARESINCDIR CARESLIBDIR CARESLIBS LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -847,6 +847,7 @@ /usr/ssl /usr/pkg /usr/local /usr --enable-ziplinks enable ziplinks will check /usr/local /usr /usr/pkg --enable-libcurl=DIR enable libcurl (remote include) support + --enable-iconv=DIR enable iconv (codepage changing) support --enable-dynamic-linking Make the IRCd dynamically link shared objects rather than statically @@ -12165,6 +12166,47 @@ fi; +# Check whether --enable-iconv or --disable-iconv was given. +if test "${enable_iconv+set}" = set; then + enableval="$enable_iconv" + +echo "$as_me:$LINENO: checking for iconv" >&5 +echo $ECHO_N "checking for iconv... $ECHO_C" >&6 + for dir in $enableval /usr/local /usr /usr/pkg; do + iconvdir="$dir" + if test -f "$dir/include/iconv.h" ; then + echo "$as_me:$LINENO: result: found in $iconvdir" >&5 +echo "${ECHO_T}found in $iconvdir" >&6 + found_iconv="yes" ; + if test "$iconvdir" = "/usr" ; then + CFLAGS="$CFLAGS -DWITH_ICONV" ; + else + CFLAGS="$CFLAGS -I$iconvdir/include -DWITH_ICONV" ; + fi + break ; + fi + done + if test x_$found_iconv != x_yes ; then + echo "$as_me:$LINENO: result: not found" >&5 +echo "${ECHO_T}not found" >&6 + { echo "$as_me:$LINENO: WARNING: disabling iconv support" >&5 +echo "$as_me: WARNING: disabling iconv support" >&2;} + else + case `uname -s` in + *BSD*) + IRCDLIBS="$IRCDLIBS -liconv" ; + if test "$iconvdir" != "/usr" ; then + LDFLAGS="$LDFLAGS -L$iconvdir/lib" ; + fi + ;; + esac + HAVE_ICONV=yes + + fi + + +fi; + # Check whether --enable-dynamic-linking or --disable-dynamic-linking was given. if test "${enable_dynamic_linking+set}" = set; then enableval="$enable_dynamic_linking" @@ -13374,6 +13416,7 @@ s,@MODULEFLAGS@,$MODULEFLAGS,;t t s,@HAVE_ZLIB@,$HAVE_ZLIB,;t t s,@URL@,$URL,;t t +s,@HAVE_ICONV@,$HAVE_ICONV,;t t s,@IRCDDIR@,$IRCDDIR,;t t s,@BINDIR@,$BINDIR,;t t s,@FD_SETSIZE@,$FD_SETSIZE,;t t diff -Nura include/common.h include/common.h --- include/common.h 2005-04-18 22:30:09.000000000 +0300 +++ include/common.h 2007-07-16 10:25:07.000000000 +0300 @@ -175,16 +175,18 @@ #undef isspace #undef iscntrl #endif -extern MODVAR unsigned char char_atribs[]; +extern MODVAR unsigned short char_atribs[]; + +#define PRINT 0x001 +#define CNTRL 0x002 +#define ALPHA 0x004 +#define PUNCT 0x008 +#define DIGIT 0x010 +#define SPACE 0x020 +#define ALLOW 0x040 +#define ALLOWN 0x080 +#define HICHAR 0x100 -#define PRINT 1 -#define CNTRL 2 -#define ALPHA 4 -#define PUNCT 8 -#define DIGIT 16 -#define SPACE 32 -#define ALLOW 64 -#define ALLOWN 128 #ifndef KLINE_TEMP #define KLINE_PERM 0 @@ -198,8 +200,8 @@ #define iscntrl(c) (char_atribs[(u_char)(c)]&CNTRL) #define isalpha(c) (char_atribs[(u_char)(c)]&ALPHA) #define isspace(c) (char_atribs[(u_char)(c)]&SPACE) -#define islower(c) ((char_atribs[(u_char)(c)]&ALPHA) && ((u_char)(c) > 0x5f)) -#define isupper(c) ((char_atribs[(u_char)(c)]&ALPHA) && ((u_char)(c) < 0x60)) +#define islower(c) ((char_atribs[(u_char)(c)]&ALPHA) && (!(char_atribs[(u_char)(c)]&HICHAR))) +#define isupper(c) ((char_atribs[(u_char)(c)]&ALPHA) && (char_atribs[(u_char)(c)]&HICHAR)) #define isdigit(c) (char_atribs[(u_char)(c)]&DIGIT) #define isxdigit(c) (isdigit(c) || ('a' <= (c) && (c) <= 'f') || \ ('A' <= (c) && (c) <= 'F')) diff -Nura include/dynconf.h include/dynconf.h --- include/dynconf.h 2006-12-01 17:39:44.000000000 +0200 +++ include/dynconf.h 2007-07-16 10:27:19.000000000 +0300 @@ -83,6 +83,10 @@ unsigned allow_part_if_shunned:1; unsigned check_target_nick_bans:1; unsigned use_egd; +#ifdef WITH_ICONV + char *default_codepage; + ConfigItem_codepage *cp; +#endif long host_timeout; int host_retries; char *name_server; @@ -304,6 +308,11 @@ unsigned has_egd_path:1; unsigned has_static_quit:1; unsigned has_static_part:1; +#ifdef WITH_ICONV + unsigned has_codepage:1; + unsigned has_cp_default:1; + unsigned has_cplist:1; +#endif #ifdef USE_SSL unsigned has_ssl_certificate:1; unsigned has_ssl_key:1; diff -Nura include/h.h include/h.h --- include/h.h 2006-12-12 19:25:19.000000000 +0200 +++ include/h.h 2007-07-16 10:29:57.000000000 +0300 @@ -73,34 +73,37 @@ * Configuration linked lists */ extern MODVAR ConfigItem_me *conf_me; -extern MODVAR ConfigItem_class *conf_class; +extern MODVAR ConfigItem_class *conf_class; extern MODVAR ConfigItem_class *default_class; -extern MODVAR ConfigItem_admin *conf_admin; +extern MODVAR ConfigItem_admin *conf_admin; extern MODVAR ConfigItem_admin *conf_admin_tail; -extern MODVAR ConfigItem_drpass *conf_drpass; -extern MODVAR ConfigItem_ulines *conf_ulines; +extern MODVAR ConfigItem_drpass *conf_drpass; +extern MODVAR ConfigItem_ulines *conf_ulines; extern MODVAR ConfigItem_tld *conf_tld; extern MODVAR ConfigItem_oper *conf_oper; -extern MODVAR ConfigItem_listen *conf_listen; +extern MODVAR ConfigItem_listen *conf_listen; extern MODVAR ConfigItem_allow *conf_allow; -extern MODVAR ConfigItem_except *conf_except; +extern MODVAR ConfigItem_except *conf_except; extern MODVAR ConfigItem_vhost *conf_vhost; extern MODVAR ConfigItem_link *conf_link; extern MODVAR ConfigItem_ban *conf_ban; extern MODVAR ConfigItem_badword *conf_badword_channel; -extern MODVAR ConfigItem_badword *conf_badword_message; +extern MODVAR ConfigItem_badword *conf_badword_message; extern MODVAR ConfigItem_badword *conf_badword_quit; extern MODVAR ConfigItem_deny_dcc *conf_deny_dcc; -extern MODVAR ConfigItem_deny_channel *conf_deny_channel; +extern MODVAR ConfigItem_deny_channel *conf_deny_channel; extern MODVAR ConfigItem_deny_link *conf_deny_link; -extern MODVAR ConfigItem_allow_channel *conf_allow_channel; -extern MODVAR ConfigItem_allow_dcc *conf_allow_dcc; +extern MODVAR ConfigItem_allow_channel *conf_allow_channel; +extern MODVAR ConfigItem_allow_dcc *conf_allow_dcc; extern MODVAR ConfigItem_deny_version *conf_deny_version; extern MODVAR ConfigItem_log *conf_log; extern MODVAR ConfigItem_alias *conf_alias; extern MODVAR ConfigItem_include *conf_include; extern MODVAR ConfigItem_help *conf_help; extern MODVAR ConfigItem_offchans *conf_offchans; +#ifdef WITH_ICONV +extern MODVAR ConfigItem_codepage *conf_codepage; +#endif extern int completed_connection(aClient *); extern void clear_unknown(); extern EVENT(e_unload_module_delayed); @@ -125,13 +128,17 @@ ConfigItem_except *Find_except(aClient *, char *host, short type); ConfigItem_tld *Find_tld(aClient *cptr, char *host); ConfigItem_link *Find_link(char *username, char *hostname, char *ip, char *servername); -ConfigItem_cgiirc *Find_cgiirc(char *username, char *hostname, char *ip, CGIIRCType type); +ConfigItem_cgiirc *Find_cgiirc(char *username, char *hostname, char *ip, CGIIRCType type); ConfigItem_ban *Find_ban(aClient *, char *host, short type); ConfigItem_ban *Find_banEx(aClient *,char *host, short type, short type2); ConfigItem_vhost *Find_vhost(char *name); ConfigItem_deny_channel *Find_channel_allowed(char *name); ConfigItem_alias *Find_alias(char *name); ConfigItem_help *Find_Help(char *command); +#ifdef WITH_ICONV +ConfigItem_codepage *Find_codepage(char *name); +ConfigItem_codepage *Find_def_codepage(void); +#endif int AllowClient(aClient *cptr, struct hostent *hp, char *sockhost, char *username); int parse_netmask(const char *text, struct irc_netmask *netmask); int match_ip(struct IN_ADDR addr, char *uhost, char *mask, struct irc_netmask *netmask); diff -Nura include/msg.h include/msg.h --- include/msg.h 2006-02-26 03:06:09.000000000 +0200 +++ include/msg.h 2007-07-16 10:30:37.000000000 +0300 @@ -297,6 +297,11 @@ #define MSG_EOS "EOS" #define TOK_EOS "ES" +#define MSG_CODEPAGE "CODEPAGE" +#define TOK_CODEPAGE "CP" +#define MSG_CODEPAGES "CODEPAGES" +#define TOK_CODEPAGES "CPS" + #define MAXPARA 15 extern int m_error(); diff -Nura include/numeric.h include/numeric.h --- include/numeric.h 2005-09-26 00:49:18.000000000 +0300 +++ include/numeric.h 2007-07-16 10:34:13.000000000 +0300 @@ -358,6 +358,14 @@ #define RPL_WHOISSECURE 671 +#ifdef WITH_ICONV +#define RPL_CODEPAGE 700 +#define RPL_CODEPAGES 701 +#define RPL_ENDOFCODEPAGES 702 +#define RPL_WHOISSCHEME 703 +#define RPL_STATSCODEPAGE 704 +#endif + #define ERR_CANNOTDOCOMMAND 972 #define ERR_CANNOTCHANGECHANMODE 974 #define ERR_NUMERICERR 999 diff -Nura include/struct.h include/struct.h --- include/struct.h 2007-06-14 21:23:38.000000000 +0300 +++ include/struct.h 2007-07-16 10:37:36.000000000 +0300 @@ -124,6 +124,9 @@ typedef struct _configitem_include ConfigItem_include; typedef struct _configitem_help ConfigItem_help; typedef struct _configitem_offchans ConfigItem_offchans; +#ifdef WITH_ICONV +typedef struct _configitem_codepage ConfigItem_codepage; +#endif typedef struct liststruct ListStruct; #define CFG_TIME 0x0001 @@ -943,6 +946,9 @@ char info[REALLEN + 1]; /* Free form additional client information */ aClient *srvptr; /* Server introducing this. May be &me */ short status; /* client type */ +#ifdef WITH_ICONV + char *codepage; /* Codepage */ +#endif /* ** The following fields are allocated only for local clients ** (directly connected to *this* server with a socket. @@ -1190,6 +1196,9 @@ ConfigItem *prev, *next; ConfigFlag flag; char *ip; +#ifdef WITH_ICONV + char *codepage; +#endif int port; int options, clients; aClient *listener; @@ -1365,6 +1374,18 @@ regex_t expr; }; +#ifdef WITH_ICONV +struct _configitem_codepage { + ConfigItem *prev, *next; + ConfigFlag flag; + short defcpage; + char *file; + char repl1[256]; + char repl2[256]; + char *name; +}; +#endif + #define INCLUDE_NOTLOADED 0x1 #define INCLUDE_REMOTE 0x2 #define INCLUDE_DLQUEUED 0x4 diff -Nura locales/belarussian-w1251 locales/belarussian-w1251 --- locales/belarussian-w1251 1970-01-01 03:00:00.000000000 +0300 +++ locales/belarussian-w1251 2007-07-16 10:58:16.000000000 +0300 @@ -0,0 +1,6 @@ +xC0 xC1 xC2 xC3 xC4 xC5 xC6 xC7 xC8 xC9 xCA xCB xCC xCD xCE xCF xD0 xD1 xD2 xD3 xD4 xD5 xD6 xD7 xD8 xD9 xDA xDB xDC xDD xDE xDF xE0 xE1 xE2 xE3 xE4 xE5 xE6 xE7 xE8 xE9 xEA xEB xEC xED xEE xEF xF0 xF1 xF2 xF3 xF4 xF5 xF6 xF7 xF8 xF9 xFA xFB xFC xFD xFE xFF xA8 xB8 xA1 xA2 xB2 xB3 + +.ÉÖÓÊÅÍÃØÙÇÕÚÔÛÂÀÏÐÎËÄÆÝß×ÑÌÈÒÜÁÞ¨¡² +0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa,0xb, 0xc, 0xd, 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14,0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d,0x1e, 0x1f,' ', '!', '"', '#', '$', '%', '&', 0x27, '(', ')','*', '+', ',', '-', '.', '/','0', '1', '2', '3', '4', '5', '6', '7', '8', '9',':', ';', '<', '=', '>', '?','@', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i','j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's','t', 'u', 'v', 'w', 'x', 'y', 'z', '[', '\\', ']', '^','_','`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i','j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's','t', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~',0x7f,0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,0xa0, 'y', 'y', 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xb8, 0xa9,0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,0xb0, 0xb1, 'i', 'i', 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9,0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 'a', 0xe1, 'b', 0xe3, 0xe4, 'e', 0xe6, '3', 0xe8, 0xe9, 'k', 0xeb, 'm', 'h', 'o', 0xef, 'p', 'c', 't', 'y', 0xf4, 'x', 0xf6, 0xf7, 0xf8, 0xf9,0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, 'a', 0xe1, 'b', 0xe3, 0xe4, 'e', 0xe6, '3', 0xe8, 0xe9, 'k', 0xeb, 'm', 'h', 'o', 0xef, 'p', 'c', 't', 'y', 0xf4, 'x', 0xf6, 0xf7, 0xf8, 0xf9,0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff +0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa,0xb, 0xc, 0xd, 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14,0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d,0x1e, 0x1f,' ', '!', '"', '#', '$', '%', '&', 0x27, '(', ')','*', '+', ',', '-', '.', '/','0', '1', '2', '3', '4', '5', '6', '7', '8', '9',':', ';', '<', '=', '>', '?','@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I','J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S','T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^',0x5f,'`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I','J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S','T', 'U', 'V', 'W', 'X', 'Y', 'Z', '{', '|', '}', '~',0x7f,0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,0xa0, 'Y', 'Y', 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xb8, 0xa9,0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,0xb0, 0xb1, 'I', 'I', 0xb4, 0xb5, 0xb6, 0xb7, 0xa8, 0xb9,0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 'A', 0xc1, 'B', 0xc3, 0xc4, 'E', 0xc6, '3', 0xc8, 0xc9, 'K', 0xcb, 'M', 'H', 'O', 0xcf, 'P', 'C', 'T', 'Y', 0xd4, 'X', 0xd6, 0xd7, 0xd8, 0xd9,0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 'A', 0xc1, 'B', 0xc3, 0xc4, 'E', 0xc6, '3', 0xc8, 0xc9, 'K', 0xcb, 'M', 'H', 'O', 0xcf, 'P', 'C', 'T', 'Y', 0xd4, 'X', 0xd6, 0xd7, 0xd8, 0xd9,0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf + diff -Nura locales/catalan locales/catalan --- locales/catalan 1970-01-01 03:00:00.000000000 +0300 +++ locales/catalan 2007-07-16 10:58:42.000000000 +0300 @@ -0,0 +1,4 @@ +xE0 xC0 xE8 xC8 xE9 xC9 xED xCD xF2 xD2 xF3 xD3 xFA xDA xEF xCF xFC xDC + + + diff -Nura locales/chinese locales/chinese --- locales/chinese 1970-01-01 03:00:00.000000000 +0300 +++ locales/chinese 2007-07-16 10:59:51.000000000 +0300 @@ -0,0 +1,4 @@ + +xA4 xA4 xA1 xF3 xA5 xA5 xA1 xF6 xB0 xD6 xA1 xFE xD7 xD7 xA1 xF9 xD8 xF7 xA1 xFE x81 xA0 x40 x7E x81 xA0 x80 xFE xAA xFE x40 x7E xAA xFE x80 xA0 + + diff -Nura locales/chinese-ja locales/chinese-ja --- locales/chinese-ja 1970-01-01 03:00:00.000000000 +0300 +++ locales/chinese-ja 2007-07-16 11:00:09.000000000 +0300 @@ -0,0 +1,4 @@ + +xA4 xA4 xA1 xF3 xA5 xA5 xA1 xF6 + + diff -Nura locales/chinese-simp locales/chinese-simp --- locales/chinese-simp 1970-01-01 03:00:00.000000000 +0300 +++ locales/chinese-simp 2007-07-16 11:00:18.000000000 +0300 @@ -0,0 +1,4 @@ + +xB0 xD6 xA1 xFE xD7 xD7 xA1 xF9 xD8 xF7 xA1 xFE + + diff -Nura locales/chinese-trad locales/chinese-trad --- locales/chinese-trad 1970-01-01 03:00:00.000000000 +0300 +++ locales/chinese-trad 2007-07-16 11:00:26.000000000 +0300 @@ -0,0 +1,4 @@ + +x81 xA0 x40 x7E x81 xA0 x80 xFE xAA xFE x40 x7E xAA xFE x80 xA0 + + diff -Nura locales/czech-w1250 locales/czech-w1250 --- locales/czech-w1250 1970-01-01 03:00:00.000000000 +0300 +++ locales/czech-w1250 2007-07-16 11:00:42.000000000 +0300 @@ -0,0 +1,4 @@ +x8A x8D x8E x9A x9D x9E xC1 xC8 xC9 xCC xF8 xF9 xFA xFD x22 x29 x3B x0A x09 x7D x0A x09 x69 x66 x20 x28 xF8 xF9 xFA xFD + + + diff -Nura locales/danish locales/danish --- locales/danish 1970-01-01 03:00:00.000000000 +0300 +++ locales/danish 2007-07-16 11:00:52.000000000 +0300 @@ -0,0 +1,4 @@ +xE6 xC6 xE5 xC5 xF8 xD8 + + + diff -Nura locales/dutch locales/dutch --- locales/dutch 1970-01-01 03:00:00.000000000 +0300 +++ locales/dutch 2007-07-16 11:01:00.000000000 +0300 @@ -0,0 +1,4 @@ +xE9 xEB xF6 xEF xFC xE8 + + + diff -Nura locales/french locales/french --- locales/french 1970-01-01 03:00:00.000000000 +0300 +++ locales/french 2007-07-16 11:05:48.000000000 +0300 @@ -0,0 +1,4 @@ +xC0 xC2 xE0 xE2 xC7 xE7 xC8 xC9 xCA xCB xE8 xE9 xEA xEB xCE xCF xEE xEF xD4 xF4 xD9 xDB xDC xF9 xFB xFC xFF + + + diff -Nura locales/gbk locales/gbk --- locales/gbk 1970-01-01 03:00:00.000000000 +0300 +++ locales/gbk 2007-07-16 11:05:58.000000000 +0300 @@ -0,0 +1,4 @@ + +xA4 xA4 xA1 xF3 xA5 xA5 xA1 xF6 xB0 xD6 xA1 xFE xD7 xD7 xA1 xF9 xD8 xF7 xA1 xFE x81 xA0 x40 x7E x81 xA0 x80 xFE xAA xFE x40 x7E xAA xFE x80 xA0 + + diff -Nura locales/german locales/german --- locales/german 1970-01-01 03:00:00.000000000 +0300 +++ locales/german 2007-07-16 11:06:06.000000000 +0300 @@ -0,0 +1,4 @@ +xE4 xC4 xF6 xD6 xFC xDC xDF + + + diff -Nura locales/greek locales/greek --- locales/greek 1970-01-01 03:00:00.000000000 +0300 +++ locales/greek 2007-07-16 11:06:17.000000000 +0300 @@ -0,0 +1,4 @@ +x22 xB6 xB8 xB9 xBA xBC xBE xBF xC0 xC1 xC2 xC3 xC4 xC5 xC6 xC7 xC8 xC9 xCA xCB xCC xCD xCE xCF xD0 xD1 xD3 xD4 xD5 xD6 xD7 xD8 xD9 xDA xDB xDC xDD xDE xDF xE0 xE1 xE2 xE3 xE4 xE5 xE6 xE7 xE8 xE9 xEA xEB xEC xED xEE xEF xF0 xF1 xF2 xF3 xF4 + + + diff -Nura locales/hebrew locales/hebrew --- locales/hebrew 1970-01-01 03:00:00.000000000 +0300 +++ locales/hebrew 2007-07-16 11:06:26.000000000 +0300 @@ -0,0 +1,4 @@ +xE0 xE1 xE2 xE3 xE4 xE5 xE6 xE7 xE8 xE9 xEA xEB xEC xED xEE xEF xF0 xF1 xF2 xF3 xF4 xF5 xF6 xF7 xF8 xF9 xFA xFB xFC xFD xFE + + + diff -Nura locales/hungarian locales/hungarian --- locales/hungarian 1970-01-01 03:00:00.000000000 +0300 +++ locales/hungarian 2007-07-16 11:06:36.000000000 +0300 @@ -0,0 +1,4 @@ +xE1 xE9 xED xF3 xF6 xF5 xFA xFC xFB xC1 xC9 xCD xD3 xD6 xD5 xDA xDC xDB + + + diff -Nura locales/icelandic locales/icelandic --- locales/icelandic 1970-01-01 03:00:00.000000000 +0300 +++ locales/icelandic 2007-07-16 11:06:45.000000000 +0300 @@ -0,0 +1,4 @@ +xC6 xE6 xD6 xF6 xC1 xE1 xCD xED xD0 xF0 xDA xFA xD3 xF3 xDD xFD xDE xFE + + + diff -Nura locales/italian locales/italian --- locales/italian 1970-01-01 03:00:00.000000000 +0300 +++ locales/italian 2007-07-16 11:06:53.000000000 +0300 @@ -0,0 +1,4 @@ +xC0 xC8 xC9 xCC xCD xD2 xD3 xD9 xDA xE0 xE8 xE9 xEC xED xF2 xF3 xF9 xFA + + + diff -Nura locales/latin1 locales/latin1 --- locales/latin1 1970-01-01 03:00:00.000000000 +0300 +++ locales/latin1 2007-07-16 11:07:02.000000000 +0300 @@ -0,0 +1,4 @@ +xE4 xC4 xF6 xD6 xFC xDC xDF xE4 xC4 xF6 xD6 xFC xDC xE9 xEB xF6 xEF xFC xE8 xE6 xC6 xE5 xC5 xF8 xD8 xC0 xC2 xE0 xE2 xC7 xE7 xC8 xC9 xCA xCB xE8 xE9 xEA xEB xCE xCF xEE xEF xD4 xF4 xD9 xDB xDC xF9 xFB xFC xFF xE1 xC1 xE9 xC9 xED xCD xF3 xD3 xFA xDA xFC xDC xF1 xD1 xC0 xC8 xC9 xCC xCD xD2 xD3 xD9 xDA xE0 xE8 xE9 xEC xED xF2 xF3 xF9 xFA xC0 xC8 xC9 xCC xCD xD2 xD3 xD9 xDA xE0 xE8 xE9 xEC xED xF2 xF3 xF9 xFA xE0 xC0 xE8 xC8 xE9 xC9 xED xCD xF2 xD2 xF3 xD3 xFA xDA xEF xCF xFC xDC xE5 xC5 xE4 xC4 xF6 xD6 xC6 xE6 xD6 xF6 xC1 xE1 xCD xED xD0 xF0 xDA xFA xD3 xF3 xDD xFD xDE xFE + + + diff -Nura locales/latin2 locales/latin2 --- locales/latin2 1970-01-01 03:00:00.000000000 +0300 +++ locales/latin2 2007-07-16 11:07:06.000000000 +0300 @@ -0,0 +1,4 @@ +xE1 xE9 xED xF3 xF6 xF5 xFA xFC xFB xC1 xC9 xCD xD3 xD6 xD5 xDA xDC xDB xAA xBA xC2 xC3 xCE xDE xE2 xE3 xEE xFE xB1 xE6 xEA xB3 xF1 xF3 xB6 xBF xBC xA1 xC6 x77 x65 x64 x28 + + + diff -Nura locales/polish locales/polish --- locales/polish 1970-01-01 03:00:00.000000000 +0300 +++ locales/polish 2007-07-16 11:07:13.000000000 +0300 @@ -0,0 +1,4 @@ +xB1 xE6 xEA xB3 xF1 xF3 xB6 xBF xBC xA1 xC6 x77 x65 x64 x28 + + + diff -Nura locales/polish-w1250 locales/polish-w1250 --- locales/polish-w1250 1970-01-01 03:00:00.000000000 +0300 +++ locales/polish-w1250 2007-07-16 11:07:18.000000000 +0300 @@ -0,0 +1,4 @@ +xB9 xE6 xEA xB3 xF1 xF3 x9C xBF x9F xA5 xC6 xCA xA3 xD1 xD3 x8C xAF x8F + + + diff -Nura locales/readme.txt locales/readme.txt --- locales/readme.txt 1970-01-01 03:00:00.000000000 +0300 +++ locales/readme.txt 2006-12-05 17:27:47.000000000 +0200 @@ -0,0 +1,27 @@ +Here you can find locales configuration files. + +Each file consists of five lines: +1: List of additional allowed charachters + +2: List of additional allowed multibyte charachters ranges. In form: Sa_1 Ea_1 Sa_2 Ea_2 Sb_1 Eb_1 Sb_2 Eb_2... Total numbers count should be dividend of 4 + Sx_1 Start of highest byte + Ex_1 End of highest byte + Sx_2 Start of lowest byte + Ex_2 End of lowest byte + +3: List of additional charachters that should be treated as upper-case + +4: 255 charachters table - to-lower case conversion table. Can be usefull for example for comparing nicknames that contains similar-looking charachters with different codes. + +5: 255 charachters table - to-upper case conversion table. Can be usefull for example for comparing nicknames that contains similar-looking charachters with different codes. + +Each line can be list of charachters or decimal/hexadecimal codes divided by spaces or commas in form like: +x01 x02 x03... +or +'a', 'b', 'c' +or combined: +x01, \x02 'a', 'b', \10, 'c', + +It is also possible to write plain-text line of charachters. In this case it should begin by . (dot) charachter. For example: +.abcdefABCDEF23432*&^* +In this case every charachter of line except first dot specifies one charachter-code for table diff -Nura locales/romanian locales/romanian --- locales/romanian 1970-01-01 03:00:00.000000000 +0300 +++ locales/romanian 2007-07-16 11:07:25.000000000 +0300 @@ -0,0 +1,4 @@ +xAA xBA xC2 xC3 xCE xDE xE2 xE3 xEE xFE + + + diff -Nura locales/russian-w1251 locales/russian-w1251 --- locales/russian-w1251 1970-01-01 03:00:00.000000000 +0300 +++ locales/russian-w1251 2007-07-16 11:07:42.000000000 +0300 @@ -0,0 +1,5 @@ +xC0 xC1 xC2 xC3 xC4 xC5 xC6 xC7 xC8 xC9 xCA xCB xCC xCD xCE xCF xD0 xD1 xD2 xD3 xD4 xD5 xD6 xD7 xD8 xD9 xDA xDB xDC xDD xDE xDF xE0 xE1 xE2 xE3 xE4 xE5 xE6 xE7 xE8 xE9 xEA xEB xEC xED xEE xEF xF0 xF1 xF2 xF3 xF4 xF5 xF6 xF7 xF8 xF9 xFA xFB xFC xFD xFE xFF xA8 xB8 + +.ÉÖÓÊÅÍÃØÙÇÕÚÔÛÂÀÏÐÎËÄÆÝß×ÑÌÈÒÜÁÞ¨ +0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, ' ', '!', '"', '#', '$', '%', '&', 0x27, '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?', '@', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '[', '\\', ']', '^', '_', '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xb8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 'a', 0xe1, 'b', 0xe3, 0xe4, 'e', 0xe6, '3', 0xe8, 0xe9, 'k', 0xeb, 'm', 'h', 'o', 0xef, 'p', 'c', 't', 'y', 0xf4, 'x', 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, 'a', 0xe1, 'b', 0xe3, 0xe4, 'e', 0xe6, '3', 0xe8, 0xe9, 'k', 0xeb, 'm', 'h', 'o', 0xef, 'p', 'c', 't', 'y', 0xf4, 'x', 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff +0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, ' ', '!', '"', '#', '$', '%', '&', 0x27, '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^',0x5f, '`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '{', '|', '}', '~',0x7f,0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9,0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xa8, 0xb9,0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 'A', 0xc1, 'B', 0xc3, 0xc4, 'E', 0xc6, '3', 0xc8, 0xc9, 'K', 0xcb, 'M', 'H', 'O', 0xcf, 'P', 'C', 'T', 'Y', 0xd4, 'X', 0xd6, 0xd7, 0xd8, 0xd9,0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 'A', 0xc1, 'B', 0xc3, 0xc4, 'E', 0xc6, '3', 0xc8, 0xc9, 'K', 0xcb, 'M', 'H', 'O', 0xcf, 'P', 'C', 'T', 'Y', 0xd4, 'X', 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf diff -Nura locales/slovak-w1250 locales/slovak-w1250 --- locales/slovak-w1250 1970-01-01 03:00:00.000000000 +0300 +++ locales/slovak-w1250 2007-07-16 11:07:49.000000000 +0300 @@ -0,0 +1,4 @@ +x8A x8D x8E x9A x9D x9E xBC xBE xC0 xC1 xC4 xC5 xC8 xC9 xCD xCF xE0 xE1 xE4 xE5 xE8 xE9 xED xEF xF2 xF3 xF4 xFA xFD + + + diff -Nura locales/spanish locales/spanish --- locales/spanish 1970-01-01 03:00:00.000000000 +0300 +++ locales/spanish 2007-07-16 11:07:56.000000000 +0300 @@ -0,0 +1,4 @@ +xE1 xC1 xE9 xC9 xED xCD xF3 xD3 xFA xDA xFC xDC xF1 xD1 + + + diff -Nura locales/swedish locales/swedish --- locales/swedish 1970-01-01 03:00:00.000000000 +0300 +++ locales/swedish 2007-07-16 11:08:05.000000000 +0300 @@ -0,0 +1,4 @@ +xE5 xC5 xE4 xC4 xF6 xD6 + + + diff -Nura locales/swiss-german locales/swiss-german --- locales/swiss-german 1970-01-01 03:00:00.000000000 +0300 +++ locales/swiss-german 2007-07-16 11:08:12.000000000 +0300 @@ -0,0 +1,4 @@ +xE4 xC4 xF6 xD6 xFC xDC + + + diff -Nura locales/turkish locales/turkish --- locales/turkish 1970-01-01 03:00:00.000000000 +0300 +++ locales/turkish 2007-07-16 11:08:22.000000000 +0300 @@ -0,0 +1,4 @@ +xF6 xD6 xE7 xC7 xFE xDE xFC xDC xF0 xD0 x42 + + + diff -Nura locales/ukrainian-w1251 locales/ukrainian-w1251 --- locales/ukrainian-w1251 1970-01-01 03:00:00.000000000 +0300 +++ locales/ukrainian-w1251 2007-07-16 11:08:30.000000000 +0300 @@ -0,0 +1,5 @@ +0xc0, 0xc1, 0xc2, 0xc3, 0xa5, 0xc4, 0xc5, 0xaa, 0xc6, 0xc7, 0xc8, 0xb2, 0xaf, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xdc, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xb4, 0xe4, 0xe5, 0xba, 0xe6, 0xe7, 0xe8, 0xb3, 0xbf, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfc, 0xfe, 0xff + +0xc0, 0xc1, 0xc2, 0xc3, 0xa5, 0xc4, 0xc5, 0xaa, 0xc6, 0xc7, 0xc8, 0xb2, 0xaf, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xdc, 0xde, 0xdf +0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0x79, 0x79, 0xa3, 0xa4, 0xe3, 0xa6, 0xa7, 0xb8, 0xa9, 0xba, 0xab, 0xac, 0xad, 0xae, 0x69, 0xb0, 0xb1, 0x69, 0x69, 0xe3, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0x69, 0x61, 0xe1, 0x62, 0xe3, 0xe4, 0x65, 0xe6, 0x33, 0xe8, 0xe9, 0x6b, 0xeb, 0x6d, 0x68, 0x6f, 0xef, 0x70, 0x63, 0x74, 0x79, 0xf4, 0x78, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, 0x61, 0xe1, 0x62, 0xe3, 0xe4, 0x65, 0xe6, 0x33, 0xe8, 0xe9, 0x6b, 0xeb, 0x6d, 0x68, 0x6f, 0xef, 0x70, 0x63, 0x74, 0x79, 0xf4, 0x78, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff +0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0x59, 0x59, 0xa3, 0xa4, 0xc3, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0x49, 0xb0, 0xb1, 0x49, 0x49, 0xc3, 0xb5, 0xb6, 0xb7, 0xa8, 0xb9, 0xaa, 0xbb, 0xbc, 0xbd, 0xbe, 0x49, 0x41, 0xc1, 0x42, 0xc3, 0xc4, 0x45, 0xc6, 0x33, 0xc8, 0xc9, 0x4b, 0xcb, 0x4d, 0x48, 0x4f, 0xcf, 0x50, 0x43, 0x54, 0x59, 0xd4, 0x58, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0x41, 0xc1, 0x42, 0xc3, 0xc4, 0x45, 0xc6, 0x33, 0xc8, 0xc9, 0x4b, 0xcb, 0x4d, 0x48, 0x4f, 0xcf, 0x50, 0x43, 0x54, 0x59, 0xd4, 0x58, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf diff -Nura locales/windows-1250 locales/windows-1250 --- locales/windows-1250 1970-01-01 03:00:00.000000000 +0300 +++ locales/windows-1250 2007-07-16 11:08:51.000000000 +0300 @@ -0,0 +1,4 @@ +xE1 xE9 xED xF3 xF6 xF5 xFA xFC xFB xC1 xC9 xCD xD3 xD6 xD5 xDA xDC xDB xAA xBA xC2 xC3 xCE xDE xE2 xE3 xEE xFE xB9 xE6 xEA xB3 xF1 xF3 x9C xBF x9F xA5 xC6 xCA xA3 xD1 xD3 x8C xAF x8F x8A x8D x8E x9A x9D x9E xC1 xC8 xC9 xCC xF8 xF9 xFA xFD x22 x29 x3B x0A x09 x7D x0A x09 x69 x66 x20 x28 xF8 xF9 xFA xFD x8A x8D x8E x9A x9D x9E xBC xBE xC0 xC1 xC4 xC5 xC8 xC9 xCD xCF xE0 xE1 xE4 xE5 xE8 xE9 xED xEF xF2 xF3 xF4 xFA xFD + + + diff -Nura locales/windows-1251 locales/windows-1251 --- locales/windows-1251 1970-01-01 03:00:00.000000000 +0300 +++ locales/windows-1251 2007-07-16 11:08:45.000000000 +0300 @@ -0,0 +1,4 @@ +xC0 xC1 xC2 xC3 xC4 xC5 xC6 xC7 xC8 xC9 xCA xCB xCC xCD xCE xCF xD0 xD1 xD2 xD3 xD4 xD5 xD6 xD7 xD8 xD9 xDA xDB xDC xDD xDE xDF xE0 xE1 xE2 xE3 xE4 xE5 xE6 xE7 xE8 xE9 xEA xEB xEC xED xEE xEF xF0 xF1 xF2 xF3 xF4 xF5 xF6 xF7 xF8 xF9 xFA xFB xFC xFD xFE xFF xA8 xB8 + + + diff -Nura Makefile.in Makefile.in --- Makefile.in 2006-06-06 02:16:34.000000000 +0300 +++ Makefile.in 2007-07-16 14:56:12.000000000 +0300 @@ -134,6 +134,13 @@ 'CRYPTOINCLUDES=${CRYPTOINCLUDES}' \ 'URL=${URL}' +INSTALL_CONFS = badwords.channel.conf badwords.message.conf \ + badwords.quit.conf dccallow.conf help.conf doc/help.ru.conf \ + spamfilter.conf LICENSE Donation + +INSTALL_DOCS = doc/Authors doc/example.conf doc/coding-guidelines \ + doc/tao.of.irc doc/unreal32docs.html + custommodule: cd src; ${MAKE} ${MAKEARGS} MODULEFILE=${MODULEFILE} 'EXLIBS=${EXLIBS}' custommodule @@ -205,22 +212,26 @@ $(INSTALL) -m 0700 -d $(IRCDDIR) $(INSTALL) -m 0700 src/ircd $(BINDIR) $(INSTALL) -m 0700 -d $(IRCDDIR)/networks - $(INSTALL) -m 0600 networks/*.network $(IRCDDIR)/networks - $(INSTALL) -m 0700 networks/makenet $(IRCDDIR)/networks - $(INSTALL) -m 0600 networks/networks.ndx $(IRCDDIR)/networks + $(INSTALL) -m 0700 -d $(IRCDDIR)/locales + $(INSTALL) -m 0600 locales/* $(IRCDDIR)/locales $(INSTALL) -m 0700 -d $(IRCDDIR)/doc - $(INSTALL) -m 0600 doc/Authors doc/example.conf doc/coding-guidelines doc/tao.of.irc doc/unreal32docs.html $(IRCDDIR)/doc + $(INSTALL) -m 0600 $(INSTALL_DOCS) $(IRCDDIR)/doc $(INSTALL) -m 0700 -d $(IRCDDIR)/aliases $(INSTALL) -m 0600 aliases/*.conf $(IRCDDIR)/aliases $(TOUCH) $(IRCDDIR)/unrealircd.conf chmod 0600 $(IRCDDIR)/unrealircd.conf - $(INSTALL) -m 0600 spamfilter.conf dccallow.conf $(IRCDDIR) - $(INSTALL) -m 0600 badwords.*.conf help.conf LICENSE Donation $(IRCDDIR) + $(INSTALL) -m 0600 spamfilter.conf dccallow.conf codepage.conf $(IRCDDIR) + $(INSTALL) -m 0600 $(INSTALL_CONFS) $(IRCDDIR) $(INSTALL) -m 0700 unreal $(IRCDDIR) $(INSTALL) -m 0700 -d $(IRCDDIR)/modules $(INSTALL) -m 0700 src/modules/*.so $(IRCDDIR)/modules -@if [ ! -f "$(IRCDDIR)/curl-ca-bundle.crt" ] ; then \ - $(INSTALL) -m 0700 curl-ca-bundle.crt $(IRCDDIR) ; \ + $(INSTALL) -b -m 0700 curl-ca-bundle.crt $(IRCDDIR) ; \ + fi + -@if [ -f server.key.pem ] ; then \ + if [ ! -f "$(IRCDDIR)/server.key.pem" ] ; then \ + $(INSTALL) -b -m 0600 server.*.pem $(IRCDDIR) ; \ + fi ; \ fi pem: src/ssl.cnf diff -Nura makefile.win32 makefile.win32 --- makefile.win32 2007-07-10 13:41:24.000000000 +0300 +++ makefile.win32 2007-07-17 00:28:43.498694750 +0300 @@ -54,6 +54,21 @@ # ######### END SSL ######## +##### ICONV SUPPORT ###### +#To enable ICONV support you must have libiconv installed on your system +# +# +#To enable ICONV uncomment the next line: +#USE_ICONV=1 +# +#If your ICONV library and include files are not in your compiler's +#default locations, specify the locations here: +#ICONV_INC_DIR="c:\libiconv\include" +#ICONV_LIB_DIR="c:\libiconv\lib" +# +# +####### END ICONV ######## + ###### _EXTRA_ DEBUGGING ##### # We always build releases with debugging information, since otherwise # we cannot trace the source of a crash. Plus we do not mind the extra @@ -108,6 +123,17 @@ !ENDIF !ENDIF +!IFDEF USE_ICONV +ICONVCFLAGS=/D WITH_ICONV +ICONVLIB=libiconv.lib +!IFDEF ICONV_INC_DIR +ICONV_INC=/I "$(ICONV_INC_DIR)" +!ENDIF +!IFDEF ICONV_LIB_DIR +ICONV_LIB=/LIBPATH:"$(ICONV_LIB_DIR)" +!ENDIF +!ENDIF + !IFDEF DEBUGEXTRA DBGCFLAG=/MDd /Zi /Od DBGCFLAGST=/MTd /Zi /Od @@ -121,19 +147,19 @@ !ENDIF FD_SETSIZE=/D FD_SETSIZE=16384 -CFLAGS=$(DBGCFLAG) $(LIBCURL_INC) $(ZLIB_INC) $(OPENSSL_INC) /J /I ./INCLUDE /I ./INCLUDE/WIN32/ARES /Fosrc/ /nologo \ - $(ZIPCFLAGS) $(CURLCFLAGS) $(FD_SETSIZE) $(SSLCFLAGS) $(NS_ADDRESS) /D NOSPOOF=1 /c /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _USE_32BIT_TIME_T -CFLAGSST=$(DBGCFLAGST) $(LIBCURL_INC) $(ZLIB_INC) $(OPENSSL_INC) /J /I ./INCLUDE /I ./INCLUDE/WIN32/ARES /Fosrc/ /nologo \ - $(ZIPCFLAGS) $(CURLCFLAGS) $(FD_SETSIZE) $(SSLCFLAGS) $(NS_ADDRESS) /D NOSPOOF=1 /c /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _USE_32BIT_TIME_T +CFLAGS=$(DBGCFLAG) $(LIBCURL_INC) $(ZLIB_INC) $(OPENSSL_INC) $(ICONV_INC) /J /I ./INCLUDE /I ./INCLUDE/WIN32/ARES /Fosrc/ /nologo \ + $(ZIPCFLAGS) $(CURLCFLAGS) $(FD_SETSIZE) $(SSLCFLAGS) $(ICONVCFLAGS) $(NS_ADDRESS) /D NOSPOOF=1 /c /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _USE_32BIT_TIME_T +CFLAGSST=$(DBGCFLAGST) $(LIBCURL_INC) $(ZLIB_INC) $(OPENSSL_INC) $(ICONV_INC) /J /I ./INCLUDE /I ./INCLUDE/WIN32/ARES /Fosrc/ /nologo \ + $(ZIPCFLAGS) $(CURLCFLAGS) $(FD_SETSIZE) $(SSLCFLAGS) $(ICONVCFLAGS) $(NS_ADDRESS) /D NOSPOOF=1 /c /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _USE_32BIT_TIME_T LFLAGS=kernel32.lib user32.lib gdi32.lib shell32.lib ws2_32.lib advapi32.lib \ dbghelp.lib oldnames.lib comctl32.lib comdlg32.lib $(ZLIB_LIB) $(ZIPLIB) \ - $(OPENSSL_LIB) $(SSLLIBS) $(LIBCURL_LIB) $(CURLLIB) /def:wircd.def /implib:wircd.lib \ + $(OPENSSL_LIB) $(SSLLIBS) $(LIBCURL_LIB) $(CURLLIB) $(ICONV_LIB) $(ICONVLIB) /def:wircd.def /implib:wircd.lib \ /nologo $(DBGLFLAG) /out:WIRCD.EXE -MODCFLAGS=$(MODDBGCFLAG) $(SSLCFLAGS) $(ZIPCFLAGS) $(CURLCFLAGS) /J /Fesrc/modules/ \ - /Fosrc/modules/ /nologo $(LIBCURL_INC) $(ZLIB_INC) $(OPENSSL_INC) /I ./INCLUDE /D \ +MODCFLAGS=$(MODDBGCFLAG) $(SSLCFLAGS) $(ZIPCFLAGS) $(CURLCFLAGS) $(ICONVCFLAGS) /J /Fesrc/modules/ \ + /Fosrc/modules/ /nologo $(LIBCURL_INC) $(ZLIB_INC) $(OPENSSL_INC) $(ICONV_INC) /I ./INCLUDE /D \ DYNAMIC_LINKING /D NOSPOOF /D MODULE_COMPILE /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _USE_32BIT_TIME_T MODLFLAGS=/link /def:src/modules/module.def wircd.lib $(OPENSSL_LIB) $(SSLLIBS) \ - $(ZLIB_LIB) $(ZIPLIB) $(LIBCURL_LIB) $(CURLLIB) + $(ZLIB_LIB) $(ZIPLIB) $(LIBCURL_LIB) $(CURLLIB) $(ICONV_LIB) $(ICONVLIB) INCLUDES=./include/struct.h ./include/config.h ./include/sys.h \ ./include/common.h ./include/version.h ./include/h.h ./include/numeric.h \ @@ -187,7 +213,8 @@ SRC/MODULES/M_NICK.C SRC/MODULES/M_USER.C SRC/MODULES/M_MODE.C \ SRC/MODULES/M_WATCH.C SRC/MODULES/M_PART.C SRC/MODULES/M_JOIN.C \ SRC/MODULES/M_MOTD.C SRC/MODULES/M_OPERMOTD.C SRC/MODULES/M_BOTMOTD.C \ - SRC/MODULES/M_LUSERS.C SRC/MODULES/M_NAMES.C SRC/MODULES/M_SVSNOLAG.C + SRC/MODULES/M_LUSERS.C SRC/MODULES/M_NAMES.C SRC/MODULES/M_SVSNOLAG.C \ + SRC/MODULES/M_CODEPAGE.C SRC/MODULES/CALLERID.C SRC/MODULES/TEXTBAN.C SRC/MODULES/M_BANSERVER.C DLL_FILES=SRC/MODULES/M_CHGHOST.DLL SRC/MODULES/M_SDESC.DLL SRC/MODULES/M_SETIDENT.DLL \ SRC/MODULES/M_SETNAME.DLL SRC/MODULES/M_SETHOST.DLL SRC/MODULES/M_CHGIDENT.DLL \ @@ -223,7 +250,8 @@ SRC/MODULES/M_WATCH.DLL SRC/MODULES/M_PART.DLL SRC/MODULES/M_JOIN.DLL \ SRC/MODULES/M_MOTD.DLL SRC/MODULES/M_OPERMOTD.DLL SRC/MODULES/M_BOTMOTD.DLL \ SRC/MODULES/M_LUSERS.DLL SRC/MODULES/M_NAMES.DLL SRC/MODULES/M_SVSNOLAG.DLL \ - SRC/MODULES/CLOAK.DLL + SRC/MODULES/M_CODEPAGE.DLL SRC/MODULES/CALLERID.DLL SRC/MODULES/TEXTBAN.DLL \ + SRC/MODULES/M_BANSERVER.DLL SRC/MODULES/CLOAK.DLL ALL: CONF UNREAL.EXE WIRCD.EXE src/modules/commands.dll MODULES @@ -466,8 +494,8 @@ MODULES: $(DLL_FILES) src/modules/commands.dll: $(MOD_FILES) $(INCLUDES) - $(CC) $(MODDBGCFLAG) $(LIBCURL_INC) $(ZLIB_INC) $(OPENSSL_INC) /nologo \ - $(SSLCFLAGS) $(ZIPCFLAGS) $(CURLCFLAGS) /Fosrc/modules/ \ + $(CC) $(MODDBGCFLAG) $(LIBCURL_INC) $(ZLIB_INC) $(OPENSSL_INC) $(ICONV_INC) /nologo \ + $(SSLCFLAGS) $(ZIPCFLAGS) $(CURLCFLAGS) $(ICONVCFLAGS) /Fosrc/modules/ \ /I ./INCLUDE /D NOSPOOF /D MODULE_COMPILE /D _CRT_SECURE_NO_DEPRECATE \ /D _USE_32BIT_TIME_T $(MOD_FILES) \ $(MODLFLAGS) src/win32/tre.lib /OUT:src/modules/commands.dll @@ -781,6 +809,19 @@ src/modules/m_svsnolag.dll: src/modules/m_svsnolag.c $(INCLUDES) $(CC) $(MODCFLAGS) src/modules/m_svsnolag.c $(MODLFLAGS) +src/modules/m_codepage.dll: src/modules/m_codepage.c $(INCLUDES) + $(CC) $(MODCFLAGS) src/modules/m_codepage.c $(MODLFLAGS) + +src/modules/m_banserver.dll: src/modules/m_banserver.c $(INCLUDES) + $(CC) $(MODCFLAGS) src/modules/m_banserver.c $(MODLFLAGS) + +src/modules/textban.dll: src/modules/textban.c $(INCLUDES) + $(CC) $(MODCFLAGS) src/modules/textban.c $(MODLFLAGS) + +src/modules/callerid.dll: src/modules/callerid.c $(INCLUDES) + $(CC) $(MODCFLAGS) src/modules/callerid.c $(MODLFLAGS) + + dummy: diff -Nura src/api-isupport.c src/api-isupport.c --- src/api-isupport.c 2006-02-26 03:06:09.000000000 +0200 +++ src/api-isupport.c 2007-07-16 11:30:41.000000000 +0300 @@ -145,6 +145,7 @@ ircsprintf(tmpbuf, "#:%d", MAXCHANNELSPERUSER); IsupportAdd(NULL, "CHANLIMIT", tmpbuf); IsupportAdd(NULL, "MAXCHANNELS", my_itoa(MAXCHANNELSPERUSER)); + IsupportAdd(NULL, "CODEPAGES", NULL); IsupportAdd(NULL, "HCN", NULL); IsupportAdd(NULL, "SAFELIST", NULL); IsupportAdd(NULL, "NAMESX", NULL); diff -Nura src/charsys.c src/charsys.c --- src/charsys.c 2006-11-24 23:07:11.000000000 +0200 +++ src/charsys.c 2007-06-14 09:06:34.000000000 +0300 @@ -150,6 +150,20 @@ */ const char *illegalnickchars = "\xA0!+%@&~#$:'\"?*,."; +/** Set specified attribute for all characters in the specified string. */ +void charsys_addattribute(char *s, unsigned short a) +{ + for (; *s; s++) + { + char_atribs[(unsigned int)*s] |= a; + } +} + +extern void charsys_addallowed(char *s) +{ + charsys_addattribute(s, ALLOWN); +} + /** Called on boot and just before config run */ void charsys_reset(void) { @@ -158,7 +172,7 @@ /* First, reset everything */ for (i=0; i < 256; i++) - char_atribs[i] &= ~ALLOWN; + char_atribs[i] &= ~(ALLOWN|HICHAR); for (m=mblist; m; m=m_next) { m_next = m->next; @@ -166,7 +180,12 @@ } mblist=mblist_tail=NULL; /* Then add the default which will always be allowed */ - charsys_addallowed("0123456789-ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyzy{|}"); + charsys_addattribute("0123456789-ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}",ALLOWN); + charsys_addattribute("\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"\ + "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"\ + "\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f"\ + "\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f"\ + "@ABCDEFGHIJKLMNOPQRSTUVWYZ",HICHAR); langav = 0; langsinuse[0] = '\0'; #ifdef DEBUGMODE @@ -259,20 +278,150 @@ mblist_tail = m; } -/** Adds all characters in the specified string to the allowed list. */ -void charsys_addallowed(char *s) +/** Loads allowed characters and case conversion tables from specified file */ + +int charsys_htoi(char *t) { - for (; *s; s++) +int ret=0; +while(*t) + { + int x=-1; + if((*t>='0')&&(*t<='9')) + { + x=(*t-'0'); + }else if((*t>='a')&&(*t<='f')) + { + x=10+(*t-'a'); + }else if((*t>='A')&&(*t<='F')) + { + x=10+(*t-'A'); + } + if (x!=-1) + { + ret*=16; + ret+=x; + }else break; + t++; + } +return ret; +} + +int charsys_loadchartable(FILE *fd, char *chartable, unsigned int maxindex) +{ +#define LINE_BUFFER_LENGTH (0x10000) + + char *buf=(char *)malloc(LINE_BUFFER_LENGTH); + unsigned int i=0; + int fail=0; + memset(buf, 0, LINE_BUFFER_LENGTH); + fgets(buf, LINE_BUFFER_LENGTH-0x10, fd); + if (buf[0]&&(buf[strlen(buf)-1]=='\n'))buf[strlen(buf)-1] = 0; + + if (buf[0]=='.') /* simple plain-text string after dot */ + { + i=strlen(buf+1); + if (i>(maxindex+1)) i=maxindex+1; + memcpy(chartable,buf+1,i); + }else { - if ((*s <= 32) || strchr(illegalnickchars, *s)) + char *p=buf; + for (;;) + { + char *n; + if (*p!='\'') /* decimal or hexadecimal char code */ { - config_error("INTERNAL ERROR: charsys_addallowed() called for illegal characters: %s", s); -#ifdef DEBUGMODE - abort(); -#endif + if (*p=='0') p++; + if (*p=='x') /* hex form */ + { + p++; + if(!*p){fail = 1; break;} + chartable[i] = (char)(unsigned char)charsys_htoi(p); + }else /* decimal form */ + { + chartable[i] = (char)(unsigned char)atoi(p); + } + n=p+1; + }else /* plain-text char between '' */ + { + if (*(p+1)=='\\') + { + chartable[i] = *(p+2); + n=p+4; + }else + { + chartable[i] = *(p+1); + n=p+3; + } } - char_atribs[(unsigned int)*s] |= ALLOWN; + while (*n&&(*n!=',')&&(*n!=' ')) n++; + if(*n==' ') + { + while (*n&&(*n==' ')) n++; + } + if (*n==',') n++; + i++; + if ((!*n)||(i>maxindex))break; + + while (*n&&(*n==' ')) n++; + if (!*n) break; + p = n; + + } } + + free(buf); + return fail; +} + +int charsys_loadchartables(char *fname) +{ + int fail = 2,i; + FILE *fd = fopen(fname, "r"); + if (fd) + { + char tmp_tbl[256] = {0}; + /* additional allowed charachters table */ + fail = charsys_loadchartable(fd, tmp_tbl, sizeof(tmp_tbl)-1); + if (!fail) + { + charsys_addattribute(tmp_tbl,ALLOWN); + + /* multibyte allowed charachters ranges */ + memset(tmp_tbl, 0, sizeof(tmp_tbl)); + fail = charsys_loadchartable(fd, tmp_tbl, sizeof(tmp_tbl)-1); + } + + if (!fail) + { + for(i=0;tmp_tbl[i];i+=4) + { + charsys_addmultibyterange(tmp_tbl[i], tmp_tbl[i+1], tmp_tbl[i+2], tmp_tbl[i+3]); + } + + /* additional high-case charachters table */ + memset(tmp_tbl, 0, sizeof(tmp_tbl)); + fail = charsys_loadchartable(fd, tmp_tbl, sizeof(tmp_tbl)-1); /* multibyte ranges */ + if (!fail) charsys_addattribute(tmp_tbl,HICHAR); + } + +#ifndef USE_LOCALE + /* case conversion tables */ + if (!fail) + fail=charsys_loadchartable(fd, tolowertab, 255); + if (!fail) + fail=charsys_loadchartable(fd, touppertab, 255); +#endif + fclose(fd); + + if (fail) + config_error("INTERNAL ERROR: charsys_loadchartables() called for illegal file: %s", fname); + }else + config_error("INTERNAL ERROR: charsys_loadchartables() called for missing file: %s", fname); + +#ifdef DEBUGMODE + if (fail) abort(); +#endif + return fail; } int do_nick_name(char *nick) @@ -475,205 +624,19 @@ void charsys_add_language(char *name) { -char latin1=0, latin2=0, w1250=0, w1251=0, chinese=0; - - /** Note: there could well be some characters missing in the lists below. - * While I've seen other altnernatives that just allow pretty much - * every accent that exists even for dutch (where we rarely use - * accents except for like 3 types), I rather prefer to use a bit more - * reasonable aproach ;). That said, anyone is welcome to make - * suggestions about characters that should be added (or removed) - * of course. -- Syzop - */ - + char chartable_file[256]; /* Add our language to our list */ charsys_doadd_language(name); - /* GROUPS */ - if (!strcmp(name, "latin1")) - latin1 = 1; - else if (!strcmp(name, "latin2")) - latin2 = 1; - else if (!strcmp(name, "windows-1250")) - w1250 = 1; - else if (!strcmp(name, "windows-1251")) - w1251 = 1; - else if (!strcmp(name, "chinese") || !strcmp(name, "gbk")) - chinese = 1; - /* INDIVIDUAL CHARSETS */ + sprintf(chartable_file,"locales/%s",name); + charsys_loadchartables(chartable_file); +} + +int g_sim(char gl_c) { +char *gl_s = "0123456789[]-_{}|`^\0"; + for(;*gl_s;gl_s++) + if (gl_c == *gl_s) return 1; + return 0; - /* [LATIN1] */ - if (latin1 || !strcmp(name, "german")) - { - /* a", A", o", O", u", U" and es-zett */ - charsys_addallowed("äÄöÖüÜß"); - } - if (latin1 || !strcmp(name, "swiss-german")) - { - /* a", A", o", O", u", U" */ - charsys_addallowed("äÄöÖüÜ"); - } - if (latin1 || !strcmp(name, "dutch")) - { - /* Ok, even though I'm Dutch myself, I've trouble getting - * a proper list of this ;). I think I got them all now, but - * I did not include "borrow-words" like words we use in Dutch - * that are literal French. So if you really want to use them all, - * I suggest you to use just latin1 :P. - */ - /* e', e", o", i", u", e`. */ - charsys_addallowed("éëöïüè"); - } - if (latin1 || !strcmp(name, "danish")) - { - /* supplied by klaus: - * , , ao, Ao, o/, O/ */ - charsys_addallowed("æÆåÅøØ"); - } - if (latin1 || !strcmp(name, "french")) - { - /* A`, A^, a`, a^, weird-C, weird-c, E`, E', E^, E", e`, e', e^, e", - * I^, I", i^, i", O^, o^, U`, U^, U", u`, u", u`, y" [not in that order, sry] - * Hmm.. there might be more, but I'm not sure how common they are - * and I don't think they are always displayed correctly (?). - */ - charsys_addallowed("ÀÂàâÇçÈÉÊËèéêëÎÏîïÔôÙÛÜùûüÿ"); - } - if (latin1 || !strcmp(name, "spanish")) - { - /* a', A', e', E', i', I', o', O', u', U', u", U", n~, N~ */ - charsys_addallowed("áÁéÉíÍóÓúÚüÜñÑ"); - } - if (latin1 || !strcmp(name, "italian")) - { - /* A`, E`, E', I`, I', O`, O', U`, U', a`, e`, e', i`, i', o`, o', u`, u' */ - charsys_addallowed("ÀÈÉÌÍÒÓÙÚàèéìíòóùú"); - } - if (latin1 || !strcmp(name, "catalan")) - { - /* supplied by Trocotronic */ - /* a`, A`, e`, weird-c, weird-C, E`, e', E', i', I', o`, O`, o', O', u', U', i", I", u", U", weird-dot */ - charsys_addallowed("àÀçÇèÈéÉíÍòÒóÓúÚïÏüÜ"); - } - if (latin1 || !strcmp(name, "swedish")) - { - /* supplied by Tank */ - /* ao, Ao, a", A", o", O" */ - charsys_addallowed("åÅäÄöÖ"); - } - if (latin1 || !strcmp(name, "icelandic")) - { - /* supplied by Saevar */ - charsys_addallowed("ÆæÖöÁáÍíÐðÚúÓóÝýÞþ"); - } - - /* [LATIN2] */ - /* actually hungarian is a special case, include it in both w1250 and latin2 ;p */ - if (latin2 || w1250 || !strcmp(name, "hungarian")) - { - /* supplied by AngryWolf */ - /* a', e', i', o', o", o~, u', u", u~, A', E', I', O', O", O~, U', U", U~ */ - charsys_addallowed("áéíóöõúüûÁÉÍÓÖÕÚÜÛ"); - } - /* same is true for romanian: latin2 & w1250 compatible */ - if (latin2 || w1250 || !strcmp(name, "romanian")) - { - /* With some help from crazytoon */ - /* 'S,' 's,' 'A^' 'A<' 'I^' 'T,' 'a^' 'a<' 'i^' 't,' */ - charsys_addallowed("ªºÂÃÎÞâãîþ"); - } - - if (latin2 || !strcmp(name, "polish")) - { - /* supplied by k4be */ - charsys_addallowed("±æê³ñó¶¿¼¡ÆÊ£ÑÓ¦¯¬"); - } - - /* [windows 1250] */ - if (w1250 || !strcmp(name, "polish-w1250")) - { - /* supplied by k4be */ - charsys_addallowed("¹æê³ñ󜿟¥ÆÊ£ÑÓŒ¯"); - } - if (w1250 || !strcmp(name, "czech-w1250")) - { - /* Syzop [probably incomplete] */ - charsys_addallowed("ŠŽšžÁÈÉÌÍÏÒÓØÙÚÝáèéìíïòóøùúý"); - } - if (w1250 || !strcmp(name, "slovak-w1250")) - { - /* Syzop [probably incomplete] */ - charsys_addallowed("ŠŽšž¼¾ÀÁÄÅÈÉÍÏàáäåèéíïòóôúý"); - } - - /* [windows 1251] */ - if (w1251 || !strcmp(name, "russian-w1251")) - { - /* supplied by Roman Parkin: - * 128-159 and 223-254 - */ - charsys_addallowed("ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ¨¸"); - } - - if (w1251 || !strcmp(name, "belarussian-w1251")) - { - /* supplied by Bock (Samets Anton) & ss: - * 128-159, 161, 162, 178, 179 and 223-254 - * Corrected 01.11.2006 to more "correct" behavior by Bock - */ - charsys_addallowed("ÀÁÂÃÄŨÆÇ²ÉÊËÌÍÎÏÐÑÒÓ¡ÔÕÖרÛÜÝÞßàáâãä叿ç³éêëìíîïðñòó¢ôõö÷øûüýþÿ"); - } - - if (w1251 || !strcmp(name, "ukrainian-w1251")) - { - /* supplied by Anton Samets & ss: - * 128-159, 170, 175, 178, 179, 186, 191 and 223-254 - * Corrected 01.11.2006 to more "correct" behavior by core - */ - charsys_addallowed("ÀÁÂÃ¥ÄŪÆÇȲ¯ÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÜÞßàáâã´äåºæç賿éêëìíîïðñòóôõö÷øùüþÿ"); - } - - /* [GREEK] */ - if (!strcmp(name, "greek")) - { - /* supplied by GSF */ - /* ranges from rfc1947 / iso 8859-7 */ - charsys_addallowed("¶¸¹º¼¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóô"); - } - - /* [TURKISH] */ - if (!strcmp(name, "turkish")) - { - /* Supplied by Ayberk Yancatoral */ - charsys_addallowed("öÖçÇþÞüÜðÐý"); - } - - /* [HEBREW] */ - if (!strcmp(name, "hebrew")) - { - /* Supplied by PHANTOm. */ - /* 0xE0 - 0xFE */ - charsys_addallowed("àáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþ"); - } - - /* [CHINESE] */ - if (chinese || !strcmp(name, "chinese-ja")) - { - charsys_addmultibyterange(0xa4, 0xa4, 0xa1, 0xf3); /* JIS_PIN */ - charsys_addmultibyterange(0xa5, 0xa5, 0xa1, 0xf6); /* JIS_PIN */ - } - if (chinese || !strcmp(name, "chinese-simp")) - { - charsys_addmultibyterange(0xb0, 0xd6, 0xa1, 0xfe); /* GBK/2 BC with GB2312 */ - charsys_addmultibyterange(0xd7, 0xd7, 0xa1, 0xf9); /* GBK/2 BC with GB2312 */ - charsys_addmultibyterange(0xd8, 0xf7, 0xa1, 0xfe); /* GBK/2 BC with GB2312 */ - } - if (chinese || !strcmp(name, "chinese-trad")) - { - charsys_addmultibyterange(0x81, 0xa0, 0x40, 0x7e); /* GBK/3 - lower half */ - charsys_addmultibyterange(0x81, 0xa0, 0x80, 0xfe); /* GBK/3 - upper half */ - charsys_addmultibyterange(0xaa, 0xfe, 0x40, 0x7e); /* GBK/4 - lower half */ - charsys_addmultibyterange(0xaa, 0xfe, 0x80, 0xa0); /* GBK/4 - upper half */ - } } diff -Nura src/ircd.c src/ircd.c --- src/ircd.c 2007-06-27 14:36:31.000000000 +0300 +++ src/ircd.c 2007-07-16 11:47:03.000000000 +0300 @@ -523,6 +523,7 @@ char killflag = 0; int i = 0; char banbuf[1024]; + char scratch[32]; /* way too generous but... */ int ping = 0; for (i = 0; i <= LastSlot; i++) { @@ -697,7 +698,9 @@ Debug((DEBUG_DEBUG, "ssl accept handshake timeout: %s (%li-%li > %li)", cptr->sockhost, currenttime, cptr->since, ping)); #endif - exit_client(cptr, cptr, &me, "Ping timeout"); + ircsprintf(scratch, "Ping timeout: %d seconds", + (int)(TStime() - cptr->lasttime)); + exit_client(cptr, cptr, &me, scratch); continue; } diff -Nura src/match.c src/match.c --- src/match.c 2006-02-05 19:20:36.000000000 +0200 +++ src/match.c 2007-07-16 11:48:37.000000000 +0300 @@ -332,7 +332,7 @@ }; #endif -u_char char_atribs[] = { +unsigned short char_atribs[] = { /* 0-7 */ CNTRL, CNTRL, CNTRL, CNTRL, CNTRL, CNTRL, CNTRL, CNTRL, /* 8-12 */ CNTRL, CNTRL | SPACE, CNTRL | SPACE, CNTRL | SPACE, CNTRL | SPACE, diff -Nura src/modules/callerid.c src/modules/callerid.c --- src/modules/callerid.c 1970-01-01 03:00:00.000000000 +0300 +++ src/modules/callerid.c 2006-12-26 09:27:00.000000000 +0200 @@ -0,0 +1,547 @@ +#include "config.h" +#include "struct.h" +#include "common.h" +#include "sys.h" +#include "numeric.h" +#include "msg.h" +#include "channel.h" +#include "proto.h" +#include +#include +#include +#include +#include +#ifdef _WIN32 +#include +#endif +#include +#include "h.h" +#ifdef STRIPBADWORDS +#include "badwords.h" +#endif +#ifdef _WIN32 +#include "version.h" +#endif + +/* Ok, here's our CallerID data info... Fun stuff. */ +/* It's up to you to decide on this. Usually you don't want this too much more than MAXTARGETS or it won't be that much useful. + * However, some user may want/need to /accept a whole channel of users, for example, prior to /ctcp'ing the channel itself (since replies will be private + * and thus filtered by CALLERID. Your call. */ +#define MAX_ACCEPTS 24 + +/* How long between CALLERID notices... This really shouldn't be too low, or malicious users can still flood out people using server-side ignore. + If undefined, CALLERID notices will be disabled entirely. */ +#define CALLERID_COOLDOWN 60 + +typedef struct _CallerIDLink { + aClient* who; +#ifdef CALLERID_COOLDOWN + time_t nextnotice; +#endif + aClient* acceptlist[MAX_ACCEPTS]; + struct _CallerIDLink* prev; + struct _CallerIDLink* next; +} CallerIDLink, *PCallerIDLink; + +static PCallerIDLink pHead = NULL; + +/* Now some general functions to deal with these. */ +static PCallerIDLink CID_AllocLink(aClient* who) +{ + int i; + PCallerIDLink p = NULL; + if (!who) return NULL; + if (!(p = malloc(sizeof(CallerIDLink)))) + return NULL; + p->who = who; + p->nextnotice = time(NULL); + for (i = 0; i < MAX_ACCEPTS; p->acceptlist[i++] = NULL); + p->prev = NULL; + p->next = NULL; + return p; +} +static PCallerIDLink CID_FindLink(aClient* who) +{ + PCallerIDLink p = NULL; + if (!who) return NULL; + for (p = pHead; p; p = p->next) + if (p->who == who) return p; + return NULL; +} +static int CID_AddLink(PCallerIDLink what) +{ + if (!what) return 0; + if (CID_FindLink(what->who)) return 0; + what->next = pHead; + if (pHead) pHead->prev = what; + pHead = what; + return 1; +} +static int CID_DelLink(PCallerIDLink what) +{ + if (!what) return 0; + if (what == pHead) pHead = pHead->next; + if (what->prev) what->prev->next = what->next; + if (what->next) what->next->prev = what->prev; + what->prev = NULL; + what->next = NULL; + return 1; +} +static void CID_FreeLink(PCallerIDLink what) +{ + if (!what) return; + CID_DelLink(what); + free(what); +} + +static int cb_local_quit(aClient* sptr, char* comment); +static Hook* LocalQuitHook = NULL; + +static int cb_remote_quit(aClient* sptr, char* comment); +static Hook* RemoteQuitHook = NULL; + +static int cb_local_nickchange(aClient* sptr, char* nick); +static Hook* LocalNickHook = NULL; + +static int cb_remote_nickchange(aClient* cptr, aClient* sptr, char* nick); +static Hook* RemoteNickHook = NULL; + +static char* cb_privmsg(aClient* cptr, aClient* sptr, aClient* acptr, char* text, int notice); +static Hook* PrivMsgHook = NULL; + +static int cb_umode_change(aClient* sptr, int setflags, int usermodes); +static Hook* UmodeHook = NULL; + +static long UMODE_CALLERID = 0; +#define CHUM_CALLERID 'I' +static Umode* UmodeCallerID = NULL; + +#define TOK005_CALLERID "CALLERID" +static Isupport* ISupportCallerID = NULL; + +static int m_accept(aClient* cptr, aClient* sptr, int parc, char** parv); +#define MSG_ACCEPT "ACCEPT" +#define TOK_ACCEPT "ACC" +Command* CmdAccept = NULL; + +static Hook *HookConfTest = NULL; +static int cb_config_test(ConfigFile *, ConfigEntry *, int, int *); + +static Hook *HookConfRun = NULL; +static int cb_config_run(ConfigFile *, ConfigEntry *, int); + +static Hook *HookConfRehash = NULL; +static int cb_config_rehash(); + +static Hook *HookStats = NULL; +static int cb_stats(aClient *sptr, char *stats); + +/* RUN-TIME CONFIGURATION */ +/* This is stuff from unrealircd.conf :) */ + +/* set { + * # All options are optional, and default to false. + * dont-filter-ircops [yes|no]; # Determines if an IRCop is affected by callerid. U:Lines will always bypass callerid. + * callerid-alert-notice [yes|no]; # Determines if the CALLERID alert is sent as a Server Notice or as a numeric 718. + * callierd-reply-notice [yes|no]; # Determines if the CALLERID reply is sent as a Server Notice or as a numeric 716/717. + * }; + */ + +static int dont_filter_ircops = 0; +static int callerid_notice = 0; +static int callerid_reply_notice = 0; + +static void InitConf(); + +ModuleHeader MOD_HEADER(callerid) + = { + "callerid", + "v1.0", + "callerid / server-side ignore implementation", + "3.2-b8-1", + NULL + }; + +ModuleInfo* myinfo = NULL; + +void CleanUp() { + while (pHead) CID_FreeLink(pHead); + if (LocalQuitHook) HookDel(LocalQuitHook); + if (RemoteQuitHook) HookDel(RemoteQuitHook); + if (LocalNickHook) HookDel(LocalNickHook); + if (RemoteNickHook) HookDel(RemoteNickHook); + if (PrivMsgHook) HookDel(PrivMsgHook); + if (UmodeHook) HookDel(UmodeHook); + if (UmodeCallerID) UmodeDel(UmodeCallerID); + if (ISupportCallerID) IsupportDel(ISupportCallerID); + if (HookStats) HookDel(HookStats); + if (HookConfRehash) HookDel(HookConfRehash); + if (HookConfRun) HookDel(HookConfRun); + if (HookConfTest) HookDel(HookConfTest); +} + +DLLFUNC int MOD_TEST(callerid)(ModuleInfo *modinfo) +{ + myinfo = modinfo; + if (!(HookConfTest = HookAddEx(myinfo->handle, HOOKTYPE_CONFIGTEST, cb_config_test))) { + CleanUp(); + config_error("callerid: Failed to add config test hook."); + return MOD_FAILED; + } + return MOD_SUCCESS; +} + +DLLFUNC int MOD_INIT(callerid)(ModuleInfo *modinfo) +{ + myinfo = modinfo; + InitConf(); + /* Config stuff... */ + if (!(HookConfRun = HookAddEx(myinfo->handle, HOOKTYPE_CONFIGRUN, cb_config_run))) { + CleanUp(); + config_error("callerid: Failed to add config run hook."); + return MOD_FAILED; + } + if (!(HookConfRehash = HookAddEx(myinfo->handle, HOOKTYPE_REHASH, cb_config_rehash))) { + CleanUp(); + config_error("callerid: Failed to add config rehash hook."); + return MOD_FAILED; + } + if (!(HookStats = HookAddEx(myinfo->handle, HOOKTYPE_STATS, cb_stats))) { + config_error("callerid: Failed to add stats hook (non-fatal)."); + HookStats = NULL; + } + /* First, add the 005 Token. */ + if (!(ISupportCallerID = IsupportAdd(myinfo->handle, TOK005_CALLERID, NULL))) { + CleanUp(); + config_error("callerid: Failed to add 005 token 'CALLERID': %s", ModuleGetErrorStr(myinfo->handle)); + return MOD_FAILED; + } + /* Now the usermode. */ + if (!(UmodeCallerID = UmodeAdd(myinfo->handle, CHUM_CALLERID, UMODE_GLOBAL, umode_allow_all, &UMODE_CALLERID))) { + CleanUp(); + config_error("callerid: Failed to add Usermode %c: %s", CHUM_CALLERID, ModuleGetErrorStr(myinfo->handle)); + return MOD_FAILED; + } + if (!(UmodeHook = HookAddEx(myinfo->handle, HOOKTYPE_UMODE_CHANGE, cb_umode_change))) { + CleanUp(); + config_error("callerid: Failed to add required hook: %s", ModuleGetErrorStr(myinfo->handle)); + return MOD_FAILED; + } + /* Now the privmsg hook. */ + if (!(PrivMsgHook = HookAddPCharEx(myinfo->handle, HOOKTYPE_USERMSG, cb_privmsg))) { + CleanUp(); + config_error("callerid: Failed to add required hook: %s", ModuleGetErrorStr(myinfo->handle)); + return MOD_FAILED; + } + /* Now the local quit hook. */ + if (!(LocalQuitHook = HookAddEx(myinfo->handle, HOOKTYPE_LOCAL_QUIT, cb_local_quit))) { + CleanUp(); + config_error("callerid: Failed to add required hook: %s", ModuleGetErrorStr(myinfo->handle)); + return MOD_FAILED; + } + /* Now the remote quit hook. */ + if (!(RemoteQuitHook = HookAddEx(myinfo->handle, HOOKTYPE_REMOTE_QUIT, cb_remote_quit))) { + CleanUp(); + config_error("callerid: Failed to add required hook: %s", ModuleGetErrorStr(myinfo->handle)); + return MOD_FAILED; + } + /* Now the local nickchange hook. */ + if (!(LocalNickHook = HookAddEx(myinfo->handle, HOOKTYPE_LOCAL_NICKCHANGE, cb_local_nickchange))) { + CleanUp(); + config_error("callerid: Failed to add required hook: %s", ModuleGetErrorStr(myinfo->handle)); + return MOD_FAILED; + } + /* Now the remote nickchange hook. */ + if (!(RemoteNickHook = HookAddEx(myinfo->handle, HOOKTYPE_REMOTE_NICKCHANGE, cb_remote_nickchange))) { + CleanUp(); + config_error("callerid: Failed to add required hook: %s", ModuleGetErrorStr(myinfo->handle)); + return MOD_FAILED; + } + if (!(CmdAccept = CommandAdd(myinfo->handle, MSG_ACCEPT, TOK_ACCEPT, m_accept, 1, 0))) { + CleanUp(); + config_error("callerid: Failed to add command /ACCEPT: %s", ModuleGetErrorStr(myinfo->handle)); + return MOD_FAILED; + } + ModuleSetOptions(modinfo->handle, MOD_OPT_PERM); + return MOD_SUCCESS; +} + +DLLFUNC int MOD_LOAD(callerid)(int module_load) +{ + return MOD_SUCCESS; +} + +DLLFUNC int MOD_UNLOAD(callerid)(int module_unload) +{ + CleanUp(); + return MOD_SUCCESS; +} + +static void InitConf() +{ + dont_filter_ircops = 0; + callerid_notice = 0; + callerid_reply_notice = 0; +} + +static int cb_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs) +{ + int errors = 0; + if (type != CONFIG_SET) return 0; + if (!strcmp(ce->ce_varname, "dont-filter-ircops") || !strcmp(ce->ce_varname, "callerid-notice") || !strcmp(ce->ce_varname, "callerid-reply-notice")) + return 1; + else + return 0; +} + +static int cb_config_run(ConfigFile *cf, ConfigEntry *ce, int type) +{ + if (type != CONFIG_SET) return 0; + if (!strcmp(ce->ce_varname, "dont-filter-ircops")) + { + if (!ce->ce_vardata) { + dont_filter_ircops = 1; + } + else { + dont_filter_ircops = config_checkval(ce->ce_vardata, CFG_YESNO); + } + return 1; + } + else if (!strcmp(ce->ce_varname, "callerid-notice")) + { + if (!ce->ce_vardata) { + callerid_notice = 1; + } + else { + callerid_notice = config_checkval(ce->ce_vardata, CFG_YESNO); + } + return 1; + } + else if (!strcmp(ce->ce_varname, "callerid-reply-notice")) + { + if (!ce->ce_vardata) { + callerid_reply_notice = 1; + } + else { + callerid_reply_notice = config_checkval(ce->ce_vardata, CFG_YESNO); + } + return 1; + } + else + return 0; +} + +static int cb_config_rehash() +{ + InitConf(); + return 1; +} + +static int cb_stats(aClient *sptr, char *stats) +{ + if (*stats == 'S') { + sendto_one(sptr, ":%s %i %s :dont-filter-ircops: %d", me.name, RPL_TEXT, sptr->name, dont_filter_ircops); + sendto_one(sptr, ":%s %i %s :callerid-notice: %d", me.name, RPL_TEXT, sptr->name, callerid_notice); + sendto_one(sptr, ":%s %i %s :callerid-reply-notice: %d", me.name, RPL_TEXT, sptr->name, callerid_reply_notice); + } + return 0; +} + +static int cb_local_quit(aClient* sptr, char* comment) +{ + PCallerIDLink pcid = NULL; + int i = 0; + if (MyClient(sptr)) { + pcid = CID_FindLink(sptr); + CID_FreeLink(pcid); pcid = NULL; + } + for (pcid = pHead; pcid; pcid = pcid->next) { + for (i = 0; i < MAX_ACCEPTS; i++) { + if (pcid->acceptlist[i] == sptr) { + pcid->acceptlist[i] = NULL; + } + } + } + return HOOK_CONTINUE; +} + +static int cb_remote_quit(aClient* sptr, char* comment) +{ + PCallerIDLink pcid = NULL; + int i = 0; + for (pcid = pHead; pcid; pcid = pcid->next) { + for (i = 0; i < MAX_ACCEPTS; i++) { + if (pcid->acceptlist[i] == sptr) { + pcid->acceptlist[i] = NULL; + } + } + } + return HOOK_CONTINUE; +} + +static int cb_local_nickchange(aClient* sptr, char* nick) +{ + PCallerIDLink pcid = NULL; + int i = 0; + for (pcid = pHead; pcid; pcid = pcid->next) { + for (i = 0; i < MAX_ACCEPTS; i++) { + if (pcid->acceptlist[i] == sptr) { + pcid->acceptlist[i] = NULL; + } + } + } + if ((pcid = CID_FindLink(sptr))) { + for (i = 0; i < MAX_ACCEPTS; i++) + pcid->acceptlist[i] = NULL; + } + return HOOK_CONTINUE; +} + +static int cb_remote_nickchange(aClient* cptr, aClient* sptr, char* nick) +{ + PCallerIDLink pcid = NULL; + int i = 0; + for (pcid = pHead; pcid; pcid = pcid->next) { + for (i = 0; i < MAX_ACCEPTS; i++) { + if (pcid->acceptlist[i] == sptr) { + pcid->acceptlist[i] = NULL; + } + } + } + return HOOK_CONTINUE; +} + +static char* cb_privmsg(aClient* cptr, aClient* sptr, aClient* acptr, char* text, int notice) +{ + PCallerIDLink pcid = NULL; + int i = 0; + time_t t = time(NULL); + if (!(pcid = CID_FindLink(acptr))) return text; + if (!MyClient(acptr)) return text; + if (IsULine(sptr) || IsServer(sptr) || (dont_filter_ircops && IsAnOper(sptr))) return text; + for (i = 0; i < MAX_ACCEPTS; i++) { + if (pcid->acceptlist[i] == sptr) + return text; + } + if (callerid_reply_notice) + sendto_one(sptr, ":%s NOTICE %s :%s is in +%c mode (server-side ignore).", me.name, sptr->name, acptr->name, CHUM_CALLERID); + else + sendto_one(sptr, ":%s 716 %s %s :is in +%c mode (server-side ignore).", me.name, sptr->name, acptr->name, CHUM_CALLERID); +#ifdef CALLERID_COOLDOWN + if (pcid->nextnotice <= t) { + if (callerid_reply_notice) + sendto_one(sptr, ":%s NOTICE %s :%s has been informed that you messaged them.", me.name, sptr->name, acptr->name); + else + sendto_one(sptr, ":%s 717 %s %s :has been informed that you messaged them.", me.name, sptr->name, acptr->name); + if (callerid_notice) + sendto_one(acptr, ":%s NOTICE %s :%s (%s@%s) is messaging you, and you have umode +%c.", me.name, acptr->name, sptr->name, sptr->user->username, (IsHidden(sptr) ? sptr->user->virthost : sptr->user->realhost), CHUM_CALLERID); + else + sendto_one(acptr, ":%s 718 %s %s %s@%s :is messaging you, and you have umode +%c.", me.name, acptr->name, sptr->name, sptr->user->username, (IsHidden(sptr) ? sptr->user->virthost : sptr->user->realhost), CHUM_CALLERID); + pcid->nextnotice = t + CALLERID_COOLDOWN; + } +#endif + return NULL; +} + +static int m_accept(aClient* cptr, aClient* sptr, int parc, char** parv) +{ + PCallerIDLink pcid = NULL; + char* nick = NULL, *tmp = NULL; + aClient* acptr = NULL; + char* p = NULL; + int i = 0; + int remove = 0, found = 0; /* remove is boolean, but found is dual-purpose. If !remove, then found is an index, if remove, then found is boolean. */ + if (parc < 2) { + sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS), me.name, parv[0], "ACCEPT"); + return -1; + } + if (!MyClient(sptr)) return 0; + if (!(pcid = CID_FindLink(sptr))) { +#ifdef ERR_CANNOTDOCOMMAND + tmp = malloc(32); + memset(tmp, 0, 32); + snprintf(tmp, 31, "You are not +%c", CHUM_CALLERID); + sendto_one(sptr, err_str(ERR_CANNOTDOCOMMAND), me.name, sptr->name, MSG_ACCEPT, tmp); + free(tmp); +#else + sendto_one(sptr, ":%s NOTICE %s :You are not +%c, so ACCEPT is meaningless for you.", me.name, sptr->name, CHUM_CALLERID); +#endif + return 0; + } + if (!strcmp(parv[1], "*")) { + /* He wants a list. */ + for (i = 0; i < MAX_ACCEPTS; i++) { + if (pcid->acceptlist[i]) { + sendto_one(sptr, ":%s 281 %s %s", me.name, sptr->name, pcid->acceptlist[i]->name); + } + } + sendto_one(sptr, ":%s 282 %s :End of ACCEPT list", me.name, sptr->name); + return 0; + } + for (tmp = parv[1]; (nick = strtoken(&p, tmp, ",")); tmp = NULL) { + found = 0; + remove = 0; + if (index(nick, '?') || index(nick, '*')) + continue; + if (*nick == '-') { + remove = 1; + nick++; + } + if ((acptr = find_client(nick, NULL))) + { + if (IsServer(acptr)) continue; + if (IsMe(acptr)) continue; + if (!IsPerson(acptr)) continue; + if (remove) { + for (i = 0; i < MAX_ACCEPTS; i++) { + if (pcid->acceptlist[i] == acptr) { + found = 1; + pcid->acceptlist[i] = NULL; + } + } + if (!found) + sendto_one(sptr, ":%s 458 %s %s :is not on your accept list", me.name, sptr->name, nick); + } + else { + found = -1; + for (i = 0; i < MAX_ACCEPTS; i++) { + if (pcid->acceptlist[i] == acptr) { + sendto_one(sptr, ":%s 457 %s %s :is already on your accept list", me.name, sptr->name, nick); + found = -2; + break; + } + else if (pcid->acceptlist[i] == NULL) { + found = i; + } + } + if (found >= 0) { + pcid->acceptlist[found] = acptr; + } + else if (found == -1) { + sendto_one(sptr, ":%s 456 %s :Accept list is full", me.name, sptr->name); + } + } + } + else { + sendto_one(sptr, err_str(ERR_NOSUCHNICK), me.name, sptr->name, nick); + } + if (p) p[-1] = ','; + } + return 0; +} + +static int cb_umode_change(aClient* sptr, int setflags, int usermodes) +{ + PCallerIDLink pcid = NULL; + if (!MyClient(sptr)) return HOOK_CONTINUE; + if (usermodes & UMODE_CALLERID) { + if (!(pcid = CID_FindLink(sptr))) { + pcid = CID_AllocLink(sptr); + CID_AddLink(pcid); + } + } + else { + if ((pcid = CID_FindLink(sptr))) CID_FreeLink(pcid); + } + return HOOK_CONTINUE; +} diff -Nura src/modules/l_commands.c src/modules/l_commands.c --- src/modules/l_commands.c 2007-01-22 14:46:54.000000000 +0200 +++ src/modules/l_commands.c 2007-07-16 11:52:12.000000000 +0300 @@ -125,6 +125,7 @@ #ifdef GUEST extern int m_guest_Init(ModuleInfo *modinfo); #endif +extern int m_codepage_Init(ModuleInfo *modinfo); extern int m_sethost_Load(int module_load), m_setname_Load(int module_load), m_chghost_Load(int module_load); extern int m_chgident_Load(int module_load), m_setident_Load(int module_load), m_sdesc_Load(int module_load); @@ -174,6 +175,7 @@ #ifdef GUEST extern int m_guest_Load(int module_load); #endif +extern int m_codepage_Load(int module_load); extern int m_sethost_Unload(), m_setname_Unload(), m_chghost_Unload(), m_chgident_Unload(); extern int m_setident_Unload(), m_sdesc_Unload(), m_svsmode_Unload(), m_swhois_Unload(); @@ -209,6 +211,7 @@ #ifdef GUEST extern int m_guest_Unload(); #endif +extern int m_codepage_Unload(); #ifdef DYNAMIC_LINKING DLLFUNC int Mod_Test(ModuleInfo *modinfo) @@ -350,6 +353,8 @@ #ifdef GUEST m_guest_Init(ModCmdsInfo); #endif + m_codepage_Init(ModCmdsInfo); + MARK_AS_OFFICIAL_MODULE(modinfo); return MOD_SUCCESS; } @@ -463,6 +468,8 @@ #ifdef GUEST m_guest_Load(module_load); #endif + m_codepage_Load(module_load); + return MOD_SUCCESS; } @@ -576,6 +583,8 @@ #ifdef GUEST m_guest_Unload(); #endif + m_codepage_Unload(); + return MOD_SUCCESS; } diff -Nura src/modules/Makefile.in src/modules/Makefile.in --- src/modules/Makefile.in 2007-01-22 14:46:54.000000000 +0200 +++ src/modules/Makefile.in 2007-07-16 11:54:35.000000000 +0300 @@ -53,7 +53,8 @@ m_svsfline.so m_dccdeny.so m_undccdeny.so m_whowas.so \ m_connect.so m_dccallow.so m_userip.so m_nick.so m_user.so \ m_mode.so m_watch.so m_part.so m_join.so m_motd.so m_opermotd.so \ - m_botmotd.so m_lusers.so m_names.so m_svsnolag.so + m_botmotd.so m_lusers.so m_names.so m_svsnolag.so callerid.so \ + textban.so m_banserver.so m_codepage.so #note change of .c to .o COMMANDS=m_sethost.o m_chghost.o m_chgident.o m_setname.o m_setident.o \ @@ -75,7 +76,9 @@ m_svsfline.o m_dccdeny.o m_undccdeny.o m_whowas.o \ m_connect.o m_dccallow.o m_userip.o m_nick.o m_user.o \ m_mode.o m_watch.o m_part.o m_join.o m_motd.o m_opermotd.o \ - m_botmotd.o m_lusers.o m_names.o m_svsnolag.o + m_botmotd.o m_lusers.o m_names.o m_svsnolag.o callerid.o \ + textban.o m_banserver.o m_codepage.o + MODULES=commands.so cloak.so $(R_MODULES) @@ -406,6 +409,18 @@ m_svsnolag.o: m_svsnolag.c $(INCLUDES) $(CC) $(CFLAGS) $(MODULEFLAGS) -c m_svsnolag.c +textban.o: textban.c $(INCLUDES) + $(CC) $(CFLAGS) $(MODULEFLAGS) -c textban.c + +callerid.o: callerid.c $(INCLUDES) + $(CC) $(CFLAGS) $(MODULEFLAGS) -c callerid.c + +m_banserver.o: m_banserver.c $(INCLUDES) + $(CC) $(CFLAGS) $(MODULEFLAGS) -c m_banserver.c + +m_codepage.o: m_codepage.c $(INCLUDES) + $(CC) $(CFLAGS) $(MODULEFLAGS) -c m_codepage.c + ############################################################################# # .so's section ############################################################################# @@ -818,6 +833,22 @@ $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \ -o m_svsnolag.so m_svsnolag.c +textban.so: textban.c $(INCLUDES) + $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \ + -o textban.so textban.c + +callerid.so: callerid.c $(INCLUDES) + $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \ + -o callerid.so callerid.c + +m_banserver.so: m_banserver.c $(INCLUDES) + $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \ + -o m_banserver.so m_banserver.c + +m_codepage.so: m_codepage.c $(INCLUDES) + $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \ + -o m_codepage.so m_codepage.c + ############################################################################# # and now the remaining modules... ############################################################################# diff -Nura src/modules/m_banserver.c src/modules/m_banserver.c --- src/modules/m_banserver.c 1970-01-01 03:00:00.000000000 +0300 +++ src/modules/m_banserver.c 2007-06-14 09:06:34.000000000 +0300 @@ -0,0 +1,90 @@ +#include "config.h" +#include "struct.h" +#include "common.h" +#include "sys.h" +#include "numeric.h" +#include "msg.h" +#include "proto.h" +#include "channel.h" +#include +#include +#include +#include +#include +#ifdef _WIN32 +#include +#endif +#include +#include "h.h" +#ifdef STRIPBADWORDS +#include "badwords.h" +#endif +#ifdef _WIN32 +#include "version.h" +#endif + +char *extban_modes_conv_param (char *para); +int extban_modes_is_banned(aClient *sptr, aChannel *chptr, char *banin, int type); + +ModuleHeader MOD_HEADER(m_banserver) + = { + "banserver", /* Name of module */ + "1.0.0", /* Version */ + "Extban ~s", /* Short description of module */ + "3.2-b8-1", + NULL, + }; + +/* This is called on module init, before Server Ready */ +DLLFUNC int MOD_INIT(m_banserver)(ModuleInfo *modinfo) +{ + ExtbanInfo req; + + memset(&req, 0, sizeof(ExtbanInfo)); + req.flag = 's'; + req.conv_param = extban_modes_conv_param; + req.is_banned = extban_modes_is_banned; + ExtbanAdd(modinfo->handle, req); +// ircd_log(LOG_ERROR, "debug: mod_init called"); + + ModuleSetOptions(modinfo->handle, MOD_OPT_PERM); + return MOD_SUCCESS; +} + +/* Is first run when server is 100% ready */ +DLLFUNC int MOD_LOAD(m_banserver)(int module_load) +{ + return MOD_SUCCESS; +} + +/* Called when module is unloaded */ +DLLFUNC int MOD_UNLOAD(m_banserver)(int module_unload) +{ + return MOD_FAILED; +} + +char *extban_modes_conv_param (char *para) +{ + char *mask, *ret = NULL; + static char retbuf[HOSTLEN + 32]; + char tmpbuf[HOSTLEN + 32]; + + strncpyzt(tmpbuf, para, sizeof(retbuf)); + mask = tmpbuf + 3; + + if (!strchr(mask, '.')) + return NULL; + + ircsprintf(retbuf, "~s:%s", mask); + return retbuf; + +} + +int extban_modes_is_banned(aClient *sptr, aChannel *chptr, char *banin, int type) +{ + char *ban = banin+3; + if (!match(ban, sptr->srvptr->name)) + return 1; + return 0; + +} diff -Nura src/modules/m_codepage.c src/modules/m_codepage.c --- src/modules/m_codepage.c 1970-01-01 03:00:00.000000000 +0300 +++ src/modules/m_codepage.c 2007-06-14 09:06:34.000000000 +0300 @@ -0,0 +1,210 @@ +/* + * IRC - Internet Relay Chat, src/modules/m_codepage.c + * (C) 1999-2001 Carsten Munk (Techie/Stskeeps) + * + * See file AUTHORS in IRC package for additional names of + * the programmers. + * + * 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 1, 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#include "config.h" +#include "struct.h" +#include "common.h" +#include "sys.h" +#include "numeric.h" +#include "msg.h" +#include "channel.h" +#include +#include +#include +#include +#include +#ifdef _WIN32 +#include +#endif +#include +#include "h.h" +#include "proto.h" +#ifdef STRIPBADWORDS +#include "badwords.h" +#endif +#ifdef _WIN32 +#include "version.h" +#endif + +#define MSG_CODEPAGE "CODEPAGE" +#define TOK_CODEPAGE "CP" +#define MSG_CODEPAGES "CODEPAGES" +#define TOK_CODEPAGES "CPS" + +DLLFUNC int m_codepage(aClient *cptr, aClient *sptr, int parc, char *parv[]); +DLLFUNC int m_codepages(aClient *cptr, aClient *sptr, int parc, char *parv[]); + +ModuleHeader MOD_HEADER(m_codepage) + = { + "codepage", /* Name of module */ + "$Id: m_codepage.c,v 1.1 2006/10/12 23:45:10 i Exp $", /* Version */ + "/codepage", /* Short description of module */ + "3.2-b8-1", + }; + +/* + * The purpose of these ifdefs, are that we can "static" link the ircd if we + * want to +*/ + + +DLLFUNC int MOD_INIT(m_codepage)(ModuleInfo *modinfo) +{ + add_Command(MSG_CODEPAGE, TOK_CODEPAGE, m_codepage, MAXPARA); + add_Command(MSG_CODEPAGES, TOK_CODEPAGES, m_codepages, MAXPARA); + MARK_AS_OFFICIAL_MODULE(modinfo); + return MOD_SUCCESS; + +} + +DLLFUNC int MOD_LOAD(m_codepage)(int module_load) +{ + return MOD_SUCCESS; + +} + +DLLFUNC int MOD_UNLOAD(m_codepage)(int module_unload) +{ + if (del_Command(MSG_CODEPAGE, TOK_CODEPAGE, m_codepage) < 0) + { + sendto_realops("Failed to delete commands when unloading %s", + MOD_HEADER(m_codepage).name); + } + return MOD_SUCCESS; + +} + +/* + * m_codepage - 12/29/2002 - ECTb + * :prefix CODEPAGE + * parv[0] - sender + * parv[1] - codepage + * +*/ + +DLLFUNC int m_codepage(aClient *cptr, aClient *sptr, int parc, char *parv[]) +{ +#ifndef WITH_ICONV + if (MyClient(sptr)) + { + sendto_one(sptr, ":%s NOTICE %s :*** The /codepage command is disabled on this server", + me.name, sptr->name); + return 0; + } +#else + if (!MyClient(sptr)) { + aClient *acptr; + + if (parc < 3) + return 0; + acptr = find_person(parv[1], (aClient *)NULL); + if (!acptr) + return 0; + if (Find_codepage(parv[2])) { + if (!acptr->codepage) + acptr->codepage=strdup(parv[2]); + else + strcpy(acptr->codepage, parv[2]); + } +#endif + return 0; + } + +#ifdef WITH_ICONV + + if (parc < 2) + { + sendto_one(sptr, + ":%s NOTICE %s :*** /codepage syntax is /codepage ", + me.name, sptr->name); + sendto_one(sptr, + ":%s NOTICE %s :*** Your current codepage is: %s Port: %d", + me.name, sptr->name, sptr->codepage, cptr->listener->port); + return 0; + } + + if (strlen(parv[1]) < 1) + { + sendto_one(sptr, + ":%s NOTICE %s :*** Write atleast something to change the codepage to!", + me.name, sptr->name); + return 0; + } + + if (strlen(parv[1]) > 16) + { + sendto_one(sptr, + ":%s NOTICE %s :*** Codepage Error: Too long codepage!!", + me.name, sptr->name); + return 0; + } + do { + char *p; + for (p = parv[1]; *p; p++) + if (*p >= 'a' && *p <= 'z') + *p -= 'a' - 'A'; + } while (0); + + if (Find_codepage(parv[1])) + { + sptr->codepage = strdup(parv[1]); + sendto_one(sptr, rpl_str(RPL_CODEPAGE), me.name, parv[0], sptr->codepage); + sendto_serv_butone_token(cptr, sptr->name, + MSG_CODEPAGE, TOK_CODEPAGE, "%s :%s", sptr->name, sptr->codepage); + return 0; + } + else + { + sendto_one(sptr, + ":%s NOTICE %s :*** /Codepage Error: Unknown codepage %s", + me.name, parv[0], parv[1]); + return 0; + } + return 0; +} +#endif + +/* + * m_codepages - 2/09/2003 - ECTb + * :prefix CODEPAGES + * parv[0] - sender + * +*/ + +DLLFUNC int m_codepages(aClient *cptr, aClient *sptr, int parc, char *parv[]) +{ +#ifdef WITH_ICONV + ConfigItem_codepage *cpage = NULL; + for (cpage = conf_codepage; cpage; cpage = (ConfigItem_codepage *)cpage->next) + { + + sendto_one(sptr, rpl_str(RPL_CODEPAGES), me.name, + parv[0], cpage->name, cpage->defcpage?" default":""); + + } + sendto_one(sptr, rpl_str(RPL_ENDOFCODEPAGES), me.name, parv[0]); +#else + sendto_one(sptr, ":%s NOTICE %s :*** The /codepages command is disabled on this server", + me.name, sptr->name); +#endif + return 0; +} + diff -Nura src/modules/m_map.c src/modules/m_map.c --- src/modules/m_map.c 2007-06-15 22:58:45.000000000 +0300 +++ src/modules/m_map.c 2007-07-16 12:03:04.000000000 +0300 @@ -89,17 +89,24 @@ char *p = &prompt[prompt_length]; int cnt = 0; aClient *acptr; + char tbuf[256]; Link *lp; *p = '\0'; - if (prompt_length > 60) + if (prompt_length > 40) sendto_one(cptr, rpl_str(RPL_MAPMORE), me.name, cptr->name, prompt, length, server->name); else { + int len = length - strlen( server->name ) + 1; + if ( len < 0 ) len = 0; + if ( len > 255 ) len = 255; + tbuf[len--] = '\0'; + while ( len >= 0 ) tbuf[len--] = '-'; sendto_one(cptr, rpl_str(RPL_MAP), me.name, cptr->name, prompt, - length, server->name, server->serv->users, + server->name, tbuf, server->serv->users, + (server->serv->users*100.0/IRCstats.clients), ((IsAnOper(cptr) && server->serv->numeric) ? (char *)my_itoa(server->serv-> numeric) : "")); cnt = 0; @@ -111,7 +118,7 @@ if (p[-2] == '`') p[-2] = ' '; } - if (prompt_length > 60) + if (prompt_length >40) return; strcpy(p, "|-"); @@ -151,13 +158,20 @@ char buf[4]; Link *lp; aClient *acptr; +char tbuf[256]; +int len = length - strlen( server->name ) + 1; int cnt = 0, hide_ulines; hide_ulines = (HIDE_ULINES && !IsOper(cptr)) ? 1 : 0; + if ( len < 0 ) len = 0; + if ( len > 255 ) len = 255; + tbuf[len--] = '\0'; + while ( len >= 0 ) tbuf[len--] = '-'; sendto_one(cptr, rpl_str(RPL_MAP), me.name, cptr->name, "", - length, server->name, server->serv->users, - (server->serv->numeric ? (char *)my_itoa(server->serv->numeric) : "")); + server->name, tbuf, server->serv->users, + (server->serv->users*100.0/IRCstats.clients), + (server->serv->numeric ? (char *)my_itoa(server->serv->numeric) : "")); for (lp = Servers; lp; lp = lp->next) { @@ -177,7 +191,8 @@ *buf = '`'; sendto_one(cptr, rpl_str(RPL_MAP), me.name, cptr->name, buf, length-2, acptr->name, acptr->serv->users, - (acptr->serv->numeric ? my_itoa(acptr->serv->numeric) : "")); + (server->serv->users*100.0/IRCstats.clients), + (acptr->serv->numeric ? my_itoa(acptr->serv->numeric) : "")); } } @@ -203,8 +218,8 @@ if ((strlen(acptr->name) + acptr->hopcount * 2) > longest) longest = strlen(acptr->name) + acptr->hopcount * 2; } - if (longest > 60) - longest = 60; + if (longest > 40) + longest = 40; longest += 2; if (FLAT_MAP && !IsAnOper(sptr)) dump_flat_map(sptr, &me, longest); diff -Nura src/modules/m_nick.c src/modules/m_nick.c --- src/modules/m_nick.c 2006-12-19 14:52:53.000000000 +0200 +++ src/modules/m_nick.c 2007-07-16 12:07:39.000000000 +0300 @@ -832,6 +832,9 @@ int _register_user(aClient *cptr, aClient *sptr, char *nick, char *username, char *umode, char *virthost, char *ip) { ConfigItem_ban *bconf; +#ifdef WITH_ICONV + ConfigItem_listen *plisten; +#endif char *parv[3], *tmpstr; #ifdef HOSTILENAME char stripuser[USERLEN + 1], *u1 = stripuser, *u2, olduser[USERLEN + 1], @@ -863,6 +866,21 @@ if (MyConnect(sptr)) { +#ifdef WITH_ICONV + plisten = Find_listen("*",cptr->listener->port); + if (plisten) + { + cptr->codepage = strdup(plisten->codepage); + sendto_one(cptr, ":%s NOTICE AUTH :*** You connected on %d port. Using %s translation scheme as default.", + me.name, cptr->listener->port, cptr->codepage); + } + else + { + cptr->codepage = strdup(Find_def_codepage()->name); + sendto_one(cptr, ":%s NOTICE AUTH :*** You connected on %d port. Translation scheme not specified for this port.", + me.name, cptr->listener->port); + } +#endif if ((i = check_client(sptr, username))) { /* This had return i; before -McSkaf */ if (i == -5) @@ -1173,6 +1191,18 @@ (!buf || *buf == '\0' ? "+" : buf), sptr->umodes & UMODE_SETHOST ? sptr->user->virthost : NULL); +#ifdef WITH_ICONV + if (MyConnect(sptr)) + { + if (sptr->codepage) + { + sendto_one(sptr, rpl_str(RPL_CODEPAGE), sptr->name, parv[0], sptr->codepage); + sendto_serv_butone_token(sptr, sptr->name, + MSG_CODEPAGE, TOK_CODEPAGE, "%s :%s", sptr->name, sptr->codepage); + } + } +#endif + /* Send password from sptr->passwd to NickServ for identification, * if passwd given and if NickServ is online. * - by taz, modified by Wizzu diff -Nura src/modules/m_server.c src/modules/m_server.c --- src/modules/m_server.c 2006-08-19 16:34:20.000000000 +0300 +++ src/modules/m_server.c 2007-07-16 12:09:32.000000000 +0300 @@ -894,6 +894,14 @@ MSG_SWHOIS), acptr->name, acptr->user->swhois); +#ifdef WITH_ICONV + if (acptr->codepage) + if (*acptr->codepage != '\0') + sendto_one(cptr, "%s %s :%s", + (IsToken(cptr) ? TOK_CODEPAGE : + MSG_CODEPAGE), acptr->name, acptr->codepage); +#endif + if (!SupportSJOIN(cptr)) send_user_joins(cptr, acptr); } @@ -1420,7 +1428,7 @@ /* RULES: * - Use 'tbuf' as a working buffer, use 'p' to advance in 'tbuf'. * Thus, be sure to do a 'p = tbuf' at the top of the loop. - * - When one entry has been build, check if strlen(buf) + strlen(tbuf) > BUFSIZE - 8, + * - When one entry has been build, check if strlen(buf) + strlen(tbuf) > BUFSIZE - 80, * if so, do not concat but send the current result (buf) first to the server * and reset 'buf' to only the prebuf part (all until the ':'). * Then, in both cases, concat 'tbuf' to 'buf' and continue @@ -1457,8 +1465,8 @@ *p++ = ' '; *p = '\0'; - /* this is: if (strlen(tbuf) + strlen(buf) > BUFSIZE - 8) */ - if ((p - tbuf) + (bufptr - buf) > BUFSIZE - 8) + /* this is: if (strlen(tbuf) + strlen(buf) > BUFSIZE - 80) */ + if ((p - tbuf) + (bufptr - buf) > BUFSIZE - 80) { /* Would overflow, so send our current stuff right now (except new stuff) */ sendto_one(cptr, "%s", buf); @@ -1477,8 +1485,8 @@ *p++ = ' '; *p = '\0'; - /* this is: if (strlen(tbuf) + strlen(buf) > BUFSIZE - 8) */ - if ((p - tbuf) + (bufptr - buf) > BUFSIZE - 8) + /* this is: if (strlen(tbuf) + strlen(buf) > BUFSIZE - 80) */ + if ((p - tbuf) + (bufptr - buf) > BUFSIZE - 80) { /* Would overflow, so send our current stuff right now (except new stuff) */ sendto_one(cptr, "%s", buf); @@ -1497,8 +1505,8 @@ *p++ = ' '; *p = '\0'; - /* this is: if (strlen(tbuf) + strlen(buf) > BUFSIZE - 8) */ - if ((p - tbuf) + (bufptr - buf) > BUFSIZE - 8) + /* this is: if (strlen(tbuf) + strlen(buf) > BUFSIZE - 80) */ + if ((p - tbuf) + (bufptr - buf) > BUFSIZE - 80) { /* Would overflow, so send our current stuff right now (except new stuff) */ sendto_one(cptr, "%s", buf); @@ -1517,8 +1525,8 @@ *p++ = ' '; *p = '\0'; - /* this is: if (strlen(tbuf) + strlen(buf) > BUFSIZE - 8) */ - if ((p - tbuf) + (bufptr - buf) > BUFSIZE - 8) + /* this is: if (strlen(tbuf) + strlen(buf) > BUFSIZE - 80) */ + if ((p - tbuf) + (bufptr - buf) > BUFSIZE - 80) { /* Would overflow, so send our current stuff right now (except new stuff) */ sendto_one(cptr, "%s", buf); diff -Nura src/modules/m_stats.c src/modules/m_stats.c --- src/modules/m_stats.c 2006-05-28 21:08:48.000000000 +0300 +++ src/modules/m_stats.c 2007-07-16 12:14:46.000000000 +0300 @@ -120,6 +120,10 @@ int stats_officialchannels(aClient *, char *); int stats_spamfilter(aClient *, char *); +#ifdef WITH_ICONV +int stats_codepages(aClient *, char *); +#endif + #define SERVER_AS_PARA 0x1 #define FLAGS_AS_PARA 0x2 @@ -145,6 +149,9 @@ { 'L', "linkinfoall", stats_linkinfoall, SERVER_AS_PARA }, { 'M', "command", stats_command, 0 }, { 'O', "oper", stats_oper, 0 }, +#ifdef WITH_ICONV + { 'p', "codepages", stats_codepages, 0 }, +#endif { 'P', "port", stats_port, 0 }, { 'Q', "sqline", stats_sqline, FLAGS_AS_PARA }, { 'R', "usage", stats_usage, 0 }, @@ -273,6 +280,10 @@ "n - banrealname - Send the ban realname block list"); sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, sptr->name, "O - oper - Send the oper block list"); +#ifdef WITH_ICONV + sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, sptr->name, + "p - codepages - Send information about codepages"); +#endif sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, sptr->name, "P - port - Send information about ports"); sendto_one(sptr, rpl_str(RPL_STATSHELP), me.name, sptr->name, @@ -684,12 +695,21 @@ continue; if (!IsListening(acptr)) continue; - sendto_one(sptr, ":%s %s %s :*** Listener on %s:%i, clients %i. is %s %s", - me.name, IsWebTV(sptr) ? "PRIVMSG" : "NOTICE", sptr->name, +#ifdef WITH_ICONV + sendto_one(sptr, ":%s %s %s :*** Listener on %s:%i, clients %i. is %s %s %s", +#else + sendto_one(sptr, ":%s %s %s :*** Listener on %s:%i, clients %i. is %s %s %s", +#endif + me.name, IsWebTV(sptr) ? "PRIVMSG" : "NOTICE", sptr->name, ((ConfigItem_listen *)acptr->class)->ip, ((ConfigItem_listen *)acptr->class)->port, ((ConfigItem_listen *)acptr->class)->clients, ((ConfigItem_listen *)acptr->class)->flag.temporary ? "TEMPORARY" : "PERM", +#ifdef WITH_ICONV + ((ConfigItem_listen *)acptr->class)->codepage ? + ((ConfigItem_listen *)acptr->class)->codepage : + (conf_codepage->defcpage?Find_def_codepage()->name:"CP1251"), +#endif stats_port_helper(acptr)); } return 0; @@ -709,6 +729,17 @@ return 0; } +#ifdef WITH_ICONV +int stats_codepages(aClient *sptr, char *para) +{ + ConfigItem_codepage *x; + for (x = conf_codepage; x; x = (ConfigItem_codepage *)x->next) + sendto_one(sptr, ":%s %i %s :%s %s", + me.name, RPL_TEXT, sptr->name, x->name, x->defcpage ? "- default" : ""); + return 0; +} +#endif + int stats_traffic(aClient *sptr, char *para) { aClient *acptr; diff -Nura src/modules/m_whois.c src/modules/m_whois.c --- src/modules/m_whois.c 2007-01-22 14:36:51.000000000 +0200 +++ src/modules/m_whois.c 2007-07-16 12:15:54.000000000 +0300 @@ -321,6 +321,16 @@ me.name, RPL_WHOISSPECIAL, parv[0], name, acptr->user->swhois); + /* CODEPAGE USE by i (admin@i386.net.ru) */ +#ifdef WITH_ICONV + if (MyConnect(acptr)) + { + sendto_one(sptr, rpl_str(RPL_WHOISSCHEME), + me.name, parv[0], name, + acptr->codepage ? acptr->codepage : Find_def_codepage()->name); + } +#endif + /* * Fix /whois to not show idle times of * global opers to anyone except another diff -Nura src/modules/textban.c src/modules/textban.c --- src/modules/textban.c 1970-01-01 03:00:00.000000000 +0300 +++ src/modules/textban.c 2007-01-22 21:08:47.000000000 +0200 @@ -0,0 +1,525 @@ +/* + * Text ban. (C) Copyright 2004-2006 Bram Matthys. + * + * 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. + * + * See README for instructions + * Or scroll down ~30 lines to see the define's which you can tweak. + */ + +#include "config.h" +#include "struct.h" +#include "common.h" +#include "sys.h" +#include "numeric.h" +#include "msg.h" +#include "proto.h" +#include "channel.h" +#include +#include +#include +#include +#include +#ifdef _WIN32 +#include +#endif +#include +#include "h.h" +#ifdef STRIPBADWORDS +#include "badwords.h" +#endif +#ifdef _WIN32 +#include "version.h" +#endif + +/** Max number of text bans per channel. + * This is basically the most important setting. It directly affects + * how much CPU you want to spend on text processing. + * For comparison: with 10 textbans of max length (150), and messages said in + * the channel with max length (~500 bytes), on an A1800+ (1.53GHz) machine + * this consumes 30 usec per-channel message PEAK/MAX (usec = 1/1000000 of a + * second), and in normal (non-supersize messages) count on 10-15 usec. + * Basically this means this allows for like >25000 messages per second at + * 100% CPU usage in a worth case scenario. Which seems by far sufficient to me. + * Also note that (naturally) only local clients are processed, only people + * that do not have halfops or higher, and only channels that have any + * textbans set. + * UPDATE: The speed impact for 15 bans per channel is 42 usec PEAK. + * HINT: If you are hitting the "normal banlimit" before you actually hit this + * one, then you might want to tweak the #define MAXBANS and #define + * MAXBANLENGTH in include/struct.h. Doubling MAXBANLENGTH is usually + * a good idea, and then you can enlarge MAXBANS too a bit if you want to. + */ +#define MAX_EXTBANT_PER_CHAN 15 /* Max number of ~T bans in a channel. */ + +/** Max length of a ban. + * NOTE: This is mainly for 'cosmetic' purposes. Lowering it does not + * decrease CPU usage for text processing. + */ +#define MAX_LENGTH 150 /* Max length of a ban */ + +/** Allow user@host in the textban? This changes the syntax! */ +#undef UHOSTFEATURE + +/** Enable 'censor' support. What this type will do is replace the + * matched word with "" (or another word, see later) + * Like: + * hey check out my fucking new car + * will become: + * hey check out my new car + * + * SPEED: See README + */ +#define CENSORFEATURE + +/** Which censor replace word to use when CENSORFEATURE is enabled. */ +#define CENSORWORD "" + +/** Benchmark mode. + * Should never be used on production servers. + * Mainly meant for debugging/profiling purposes for myself, but if you + * have a test server and are curious about the speed of this module, + * then you can enable it of course ;). + */ +#undef BENCHMARK + + +ModuleHeader MOD_HEADER(textban) + = { + "textban", + "v2.0", + "ExtBan ~T (textban) by Syzop", + "3.2-b8-1", + NULL + }; + +/* Forward declarations */ +char *extban_modeT_conv_param(char *para_in); +int extban_modeT_is_banned(aClient *sptr, aChannel *chptr, char *ban, int type); +int extban_modeT_is_ok(aClient *sptr, aChannel *chptr, char *para, int checkt, int what, int what2); +DLLFUNC char *textban_chanmsg(aClient *, aClient *, aChannel *, char *, int); + +DLLFUNC int MOD_INIT(textban)(ModuleInfo *modinfo) +{ +ExtbanInfo req; + + memset(&req, 0, sizeof(ExtbanInfo)); + req.flag = 'T'; + req.conv_param = extban_modeT_conv_param; + req.is_banned = extban_modeT_is_banned; + req.is_ok = extban_modeT_is_ok; + + if (!ExtbanAdd(modinfo->handle, req)) + { + config_error("textban module: adding extban ~T failed! module NOT loaded"); + return MOD_FAILED; + } + + ModuleSetOptions(modinfo->handle, MOD_OPT_PERM); + + HookAddPCharEx(modinfo->handle, HOOKTYPE_CHANMSG, textban_chanmsg); + + return MOD_SUCCESS; +} + +DLLFUNC int MOD_LOAD(textban)(int module_load) +{ + return MOD_SUCCESS; +} + +DLLFUNC int MOD_UNLOAD(textban)(int module_unload) +{ + return MOD_SUCCESS; +} + +#if defined(CENSORFEATURE) || defined(STRIPFEATURE) +static char *my_strcasestr(char *haystack, char *needle) { +int i; +int nlength = strlen (needle); +int hlength = strlen (haystack); + + if (nlength > hlength) return NULL; + if (hlength <= 0) return NULL; + if (nlength <= 0) return haystack; + for (i = 0; i <= (hlength - nlength); i++) { + if (strncasecmp (haystack + i, needle, nlength) == 0) + return haystack + i; + } + return NULL; /* not found */ +} + +#define TEXTBAN_WORD_LEFT 0x1 +#define TEXTBAN_WORD_RIGHT 0x2 +#define TEXTBAN_WORD_STRIP 0x4 + +/* textban_replace: + * a fast replace routine written by Syzop used for replacing. + * searches in line for huntw and replaces it with replacew, + * buf is used for the result and max is sizeof(buf). + * (Internal assumptions: size of 'buf' is 512 characters or more) + */ +inline int textban_replace(int type, char *badword, char *line, char *buf) +{ +char *replacew; +char *pold = line, *pnew = buf; /* Pointers to old string and new string */ +char *poldx = line; +int replacen; +int searchn = -1; +char *startw, *endw; +char *c_eol = buf + 510 - 1; /* Cached end of (new) line */ +int cleaned = 0; + + if (type & TEXTBAN_WORD_STRIP) + { + replacew = ""; + replacen = 0; + } else { + replacew = CENSORWORD; + replacen = sizeof(CENSORWORD)-1; + } + + while (1) { + pold = my_strcasestr(pold, badword); + if (!pold) + break; + if (searchn == -1) + searchn = strlen(badword); + /* Hunt for start of word */ + if (pold > line) { + for (startw = pold; (!iswseperator(*startw) && (startw != line)); startw--); + if (iswseperator(*startw)) + startw++; /* Don't point at the space/seperator but at the word! */ + } else { + startw = pold; + } + + if (!(type & TEXTBAN_WORD_LEFT) && (pold != startw)) { + /* not matched */ + pold++; + continue; + } + + /* Hunt for end of word */ + for (endw = pold; ((*endw != '\0') && (!iswseperator(*endw))); endw++); + + if (!(type & TEXTBAN_WORD_RIGHT) && (pold+searchn != endw)) { + /* not matched */ + pold++; + continue; + } + + cleaned = 1; /* still too soon? Syzop/20050227 */ + + /* Do we have any not-copied-yet data? */ + if (poldx != startw) { + int tmp_n = startw - poldx; + if (pnew + tmp_n >= c_eol) { + /* Partial copy and return... */ + memcpy(pnew, poldx, c_eol - pnew); + *c_eol = '\0'; + return 1; + } + + memcpy(pnew, poldx, tmp_n); + pnew += tmp_n; + } + /* Now update the word in buf (pnew is now something like startw-in-new-buffer */ + + if (replacen) { + if ((pnew + replacen) >= c_eol) { + /* Partial copy and return... */ + memcpy(pnew, replacew, c_eol - pnew); + *c_eol = '\0'; + return 1; + } + memcpy(pnew, replacew, replacen); + pnew += replacen; + } + poldx = pold = endw; + } + /* Copy the last part */ + if (*poldx) { + strncpy(pnew, poldx, c_eol - pnew); + *(c_eol) = '\0'; + } else { + *pnew = '\0'; + } + return cleaned; +} +#endif + +unsigned int counttextbans(aChannel *chptr) +{ +Ban *ban; +unsigned int cnt = 0; + + for (ban = chptr->banlist; ban; ban=ban->next) + if ((ban->banstr[0] == '~') && (ban->banstr[1] == 'T') && (ban->banstr[2] == ':')) + cnt++; + for (ban = chptr->exlist; ban; ban=ban->next) + if ((ban->banstr[0] == '~') && (ban->banstr[1] == 'T') && (ban->banstr[2] == ':')) + cnt++; + return cnt; +} + + +int extban_modeT_is_ok(aClient *sptr, aChannel *chptr, char *para, int checkt, int what, int what2) +{ +int n; + + if ((what == MODE_ADD) && (what2 == EXBTYPE_EXCEPT) && MyClient(sptr)) + return 0; /* except is not supported */ + + /* We check the # of bans in the channel, may not exceed MAX_EXTBANT_PER_CHAN */ + if ((what == MODE_ADD) && (checkt == EXBCHK_PARAM) && + MyClient(sptr) && !IsAnOper(sptr) && + ((n = counttextbans(chptr)) >= MAX_EXTBANT_PER_CHAN)) + { + /* We check the # of bans in the channel, may not exceed MAX_EXTBANT_PER_CHAN */ + sendto_one(sptr, err_str(ERR_BANLISTFULL), me.name, sptr->name, chptr->chname, para); + sendnotice(sptr, "Too many textbans for this channel"); + return 0; + } + return 1; +} + +/** Ban callbacks */ +char *extban_modeT_conv_param(char *para_in) +{ +static char retbuf[MAX_LENGTH+1]; +char para[MAX_LENGTH+1], *action, *text, *p; +#ifdef UHOSTFEATURE +char *uhost; +int ap = 0; +#endif + + strlcpy(para, para_in+3, sizeof(para)); /* work on a copy (and truncate it) */ + + /* ~T:: + * ~T:user@host:: if UHOSTFEATURE is enabled + */ + +#ifdef UHOSTFEATURE + action = strchr(para, ':'); + if (!action) + return NULL; + *action++ = '\0'; + if (!*action) + return NULL; + text = strchr(action, ':'); + if (!text || !text[1]) + return NULL; + *text++ = '\0'; + uhost = para; + + for (p = uhost; *p; p++) + { + if (*p == '@') + ap++; + else if ((*p <= ' ') || (*p > 128)) + return NULL; /* cannot be in a username/host */ + } + if (ap != 1) + return NULL; /* no @ */ +#else + text = strchr(para, ':'); + if (!text) + return NULL; + *text++ = '\0'; + /* para=action, text=text */ + if (!*text) + return NULL; /* empty text */ + action = para; +#endif + + /* ~T:: */ + if (!strcasecmp(action, "block")) + action = "block"; /* ok */ +#ifdef CENSORFEATURE + else if (!strcasecmp(action, "censor")) + { + char *p; + action = "censor"; + for (p = text; *p; p++) + if ((*p == '*') && !(p == text) && !(p[1] == '\0')) + return NULL; /* can only be *word, word* or *word* or word */ + if (!strcmp(p, "*") || !strcmp(p, "**")) + return NULL; /* cannot match everything ;p */ + } +#endif + else + return NULL; /* unknown action */ + + /* check the string.. */ + for (p=text; *p; p++) + if ((*p == '\003') || (*p == '\002') || + (*p == '\037') || (*p == '\026') || + (*p == ' ')) + return NULL; /* codes not permitted, would be confusing since they are stripped */ + + /* Rebuild the string.. */ +#ifdef UHOSTFEATURE + snprintf(retbuf, sizeof(retbuf), "~T:%s:%s:%s", uhost, action, text); /* can be cut off if too long */ +#else + snprintf(retbuf, sizeof(retbuf), "~T:%s:%s", action, text); /* can be cut off if too long */ +#endif + return retbuf; +} + +int extban_modeT_is_banned(aClient *sptr, aChannel *chptr, char *ban, int type) +{ + /* Never banned here */ + return 0; +} + +void parse_word(const char *s, char **word, int *type) +{ +static char buf[512]; +const char *tmp; +int len; +int tpe = 0; +char *o = buf; + + for (tmp = s; *tmp; tmp++) + { + if (*tmp != '*') + *o++ = *tmp; + else + { + if (s == tmp) + tpe |= TEXTBAN_WORD_LEFT; + if (*(tmp + 1) == '\0') + tpe |= TEXTBAN_WORD_RIGHT; + } + } + *o = '\0'; + + *word = buf; + *type = tpe; +} + +/* Filters out double spaces */ +void spacefilter(char *i, char *o) +{ +char *s = i; + + for (; *s; s++) + if ((*s != ' ') || /* NOT a space, or... */ + ((s != i) && (s[-1] != ' '))) /* not a space before and not last nor first char */ + { + *o++ = *s; + } + *o = '\0'; +} + + +/* Channel message callback */ +DLLFUNC char *textban_chanmsg(aClient *cptr, aClient *sptr, aChannel *chptr, char *text, int notice) +{ +static char filtered[512]; /* temp buffer */ +Ban *ban; +long fl; +int done=0, cleaned=0; +char *p; +#ifdef UHOSTFEATURE +char buf[512], uhost[USERLEN + HOSTLEN + 16]; +#endif +char tmp[1024], *word; +int type; +#ifdef BENCHMARK +struct timeval tv_alpha, tv_beta; + + gettimeofday(&tv_alpha, NULL); +#endif + + if (!MyClient(sptr)) + return text; /* Remote and servers are not affected */ + + fl = get_access(sptr, chptr); + if (fl & (CHFL_HALFOP|CHFL_CHANOP|CHFL_CHANPROT|CHFL_CHANOWNER)) + return text; /* halfop or higher */ + + filtered[0] = '\0'; /* NOT needed, but... :P */ + +#ifdef UHOSTFEATURE + ircsprintf(uhost, "%s@%s", sptr->user->username, GetHost(sptr)); +#endif + + for (ban = chptr->banlist; ban; ban=ban->next) + { + if ((ban->banstr[0] == '~') && (ban->banstr[1] == 'T') && (ban->banstr[2] == ':')) + { + if (!done) + { + /* Prepare the text [done here, to avoid useless CPU time] */ + strlcpy(filtered, StripControlCodes(text), sizeof(filtered)); + done = 1; + } + p = ban->banstr + 3; +#ifdef UHOSTFEATURE + /* First.. deal with userhost... */ + strcpy(buf, p); + p = strchr(buf, ':'); + if (!p) continue; + *p++ = '\0'; + if (!_match(buf, uhost)) +#else + if (1) +#endif + { + if (!strncasecmp(p, "block:", 6)) + { + if (!_match(p+6, filtered)) + { + sendto_one(sptr, err_str(ERR_CANNOTSENDTOCHAN), + me.name, sptr->name, chptr->chname, + "Message blocked due to a text ban", chptr->chname); + return NULL; + } + } +#ifdef CENSORFEATURE + else if (!strncasecmp(p, "censor:", 7)) + { + parse_word(p+7, &word, &type); + if (textban_replace(type, word, filtered, tmp)) + { + strcpy(filtered, tmp); + cleaned = 1; + } + } +#endif + } + } + } + +#ifdef BENCHMARK + gettimeofday(&tv_beta, NULL); + ircd_log(LOG_ERROR, "TextBan Timing: %ld microseconds (%s / %s / %d)", + ((tv_beta.tv_sec - tv_alpha.tv_sec) * 1000000) + (tv_beta.tv_usec - tv_alpha.tv_usec), + sptr->name, chptr->chname, strlen(text)); +#endif + + if (cleaned) + { + /* check for null string */ + char *p; + for (p = filtered; *p; p++) + if (*p != ' ') + return filtered; + return NULL; /* nothing but spaces found.. */ + } + else + return text; +} diff -Nura src/s_bsd.c src/s_bsd.c --- src/s_bsd.c 2007-06-14 21:01:01.000000000 +0300 +++ src/s_bsd.c 2007-07-16 13:43:46.000000000 +0300 @@ -79,6 +79,11 @@ int rr; #endif + +#ifdef WITH_ICONV +#include +#endif + #ifdef INET6 static unsigned char minus_one[] = { 255, 255, 255, 255, 255, 255, 255, 255, 255, @@ -1381,6 +1386,47 @@ start_auth(acptr); } +#ifdef WITH_ICONV +/* + * decoding codepage... + */ + +int dech_codepage(char *codepage, int *length) +{ + static char buf[READBUF_SIZE]; + const char *p1 = readbuf; + char *p2 = buf; + size_t s1, s2, bytes; + iconv_t cd; + ConfigItem_codepage *cp = Find_def_codepage(); + if (!codepage || !cp) + return 0; + if (!stricmp(codepage, cp->name)) + { + return 0; + } + cd = iconv_open (cp->name, codepage); + if (cd == (iconv_t)(-1)) + return 0; + s1 = *length; + s2 = READBUF_SIZE; +#ifdef ICONV_SET_DISCARD_ILSEQ + bytes = iconv (cd, &p1, &s1, &p2, &s2); +#else + bytes = iconv (cd,(char **) &p1, &s1, &p2, &s2); +#endif + if (bytes < 0 || s1 != 0) + { + iconv_close (cd); + return 0; + } + *length = READBUF_SIZE - s2; + memcpy(readbuf,buf,*length); + readbuf[*length]='\0'; + iconv_close(cd); +} +#endif + void proceed_normal_client_handshake(aClient *acptr, struct hostent *he) { ClearDNS(acptr); @@ -1416,6 +1462,9 @@ else #endif length = recv(cptr->fd, readbuf, sizeof(readbuf), 0); +#ifdef WITH_ICONV + if (!IsServer(cptr)) dech_codepage(cptr->codepage,&length); +#endif cptr->lasttime = now; if (cptr->lasttime > cptr->since) cptr->since = cptr->lasttime; @@ -1663,6 +1712,7 @@ int auth = 0; int sockerr; + char errmsg[512]; #ifndef NO_FDLIST /* if it is called with NULL we check all active fd's */ @@ -1947,10 +1997,20 @@ nfds--; FD_CLR(cptr->fd, &read_set); } - (void)exit_client(cptr, cptr, &me, - ((sockerr = get_sockerr(cptr)) - ? STRERROR(sockerr) : "Client exited")); - continue; + if (!(sockerr = get_sockerr(cptr))) + { + ircsprintf(errmsg, "%s", "Remote host closed the connection"); + exit_client(cptr, cptr, &me, errmsg); + continue; + } + else + { + ircsprintf(errmsg, "Read error: %s", + STRERROR(sockerr)); + exit_client(cptr, cptr, &me, errmsg); + continue; + } + } } length = 1; /* for fall through case */ @@ -2034,9 +2094,16 @@ report_baderror("Lost connection to %s:%s", cptr); } if (length != FLUSH_BUFFER) - (void)exit_client(cptr, cptr, &me, - ((sockerr = get_sockerr(cptr)) - ? STRERROR(sockerr) : "Client exited")); + if (!(sockerr = get_sockerr(cptr))) + { + ircsprintf(errmsg, "%s", "Remote host closed the connection"); + exit_client(cptr, cptr, &me, errmsg); + } + else + { + ircsprintf(errmsg, "Read error: %s", STRERROR(sockerr)); + exit_client(cptr, cptr, &me, errmsg); + } } return 0; } diff -Nura src/s_conf.c src/s_conf.c --- src/s_conf.c 2007-06-27 14:36:31.000000000 +0300 +++ src/s_conf.c 2007-07-17 00:29:13.472568000 +0300 @@ -108,7 +108,10 @@ static int _conf_help (ConfigFile *conf, ConfigEntry *ce); static int _conf_offchans (ConfigFile *conf, ConfigEntry *ce); static int _conf_spamfilter (ConfigFile *conf, ConfigEntry *ce); -static int _conf_cgiirc (ConfigFile *conf, ConfigEntry *ce); +static int _conf_cgiirc (ConfigFile *conf, ConfigEntry *ce); +#ifdef WITH_ICONV +static int _conf_codepage (ConfigFile *conf, ConfigEntry *ce); +#endif /* * Validation commands @@ -141,7 +144,10 @@ static int _test_help (ConfigFile *conf, ConfigEntry *ce); static int _test_offchans (ConfigFile *conf, ConfigEntry *ce); static int _test_spamfilter (ConfigFile *conf, ConfigEntry *ce); -static int _test_cgiirc (ConfigFile *conf, ConfigEntry *ce); +static int _test_cgiirc (ConfigFile *conf, ConfigEntry *ce); +#ifdef WITH_ICONV +static int _test_codepage (ConfigFile *conf, ConfigEntry *ce); +#endif /* This MUST be alphabetized */ static ConfigCommand _ConfigCommands[] = { @@ -152,8 +158,11 @@ { "badword", _conf_badword, _test_badword }, #endif { "ban", _conf_ban, _test_ban }, - { "cgiirc", _conf_cgiirc, _test_cgiirc }, - { "class", _conf_class, _test_class }, + { "cgiirc", _conf_cgiirc, _test_cgiirc }, + { "class", _conf_class, _test_class }, +#ifdef WITH_ICONV + { "codepage", _conf_codepage, _test_codepage }, +#endif { "deny", _conf_deny, _test_deny }, { "drpass", _conf_drpass, _test_drpass }, { "except", _conf_except, _test_except }, @@ -164,10 +173,10 @@ { "loadmodule", NULL, _test_loadmodule}, { "log", _conf_log, _test_log }, { "me", _conf_me, _test_me }, - { "official-channels", _conf_offchans, _test_offchans }, + { "official-channels", _conf_offchans, _test_offchans }, { "oper", _conf_oper, _test_oper }, { "set", _conf_set, _test_set }, - { "spamfilter", _conf_spamfilter, _test_spamfilter }, + { "spamfilter", _conf_spamfilter, _test_spamfilter }, { "tld", _conf_tld, _test_tld }, { "ulines", _conf_ulines, _test_ulines }, { "vhost", _conf_vhost, _test_vhost }, @@ -384,6 +393,10 @@ #endif ConfigItem_offchans *conf_offchans = NULL; +#ifdef WITH_ICONV +ConfigItem_codepage *conf_codepage = NULL; +#endif + aConfiguration iConf; MODVAR aConfiguration tempiConf; MODVAR ConfigFile *conf = NULL; @@ -1818,6 +1831,9 @@ ConfigItem_help *help_ptr; ConfigItem_offchans *of_ptr; OperStat *os_ptr; +#ifdef WITH_ICONV + ConfigItem_codepage *codepage_ptr; +#endif ListStruct *next, *next2; aTKline *tk, *tk_next; SpamExcept *spamex_ptr; @@ -2135,6 +2151,15 @@ DelListItem(alias_ptr, conf_alias); MyFree(alias_ptr); } +#ifdef WITH_ICONV + for (codepage_ptr = conf_codepage; codepage_ptr; codepage_ptr = (ConfigItem_codepage *)next) + { + next = (ListStruct *)codepage_ptr->next; + ircfree(codepage_ptr->name); + DelListItem(codepage_ptr, conf_codepage); + MyFree(codepage_ptr); + } +#endif for (help_ptr = conf_help; help_ptr; help_ptr = (ConfigItem_help *)next) { aMotd *text; next = (ListStruct *)help_ptr->next; @@ -2187,6 +2212,9 @@ int config_post_test() { #define Error(x) { config_error((x)); errors++; } +#ifdef WITH_ICONV + ConfigItem_listen *p = NULL; +#endif int errors = 0; Hook *h; @@ -2425,6 +2453,28 @@ return NULL; } +#ifdef WITH_ICONV +ConfigItem_codepage *Find_codepage(char *name) { + ConfigItem_codepage *codepage; + if (!name) + return NULL; + for (codepage = conf_codepage; codepage; codepage = (ConfigItem_codepage *)codepage->next) { + if (!stricmp(codepage->name, name)) + return codepage; + } + return NULL; +} + +ConfigItem_codepage *Find_def_codepage(void) { + ConfigItem_codepage *codepage; + for (codepage = conf_codepage; codepage; codepage = (ConfigItem_codepage *)codepage->next) { + if (codepage->defcpage) + return codepage; + } + return NULL; +} +#endif + ConfigItem_class *Find_class(char *name) { ConfigItem_class *p; @@ -4095,6 +4145,9 @@ char copy[256]; char *ip; char *port; +#ifdef WITH_ICONV + char *tempcodepage; +#endif int start, end, iport, isnew; int tmpflags =0; @@ -4129,6 +4182,12 @@ tmpflags |= ofp->flag; } } +#ifdef WITH_ICONV + if (!strcmp(cep->ce_varname, "codepage")) + { + tempcodepage = strdup(cep->ce_vardata); + } +#endif } #ifndef USE_SSL tmpflags &= ~LISTENER_SSL; @@ -4148,6 +4207,10 @@ tmpflags |= LISTENER_BOUND; listen->options = tmpflags; +#ifdef WITH_ICONV + if (!tempcodepage) listen->codepage = strdup(Find_def_codepage()->name); + else listen->codepage = strdup(tempcodepage); +#endif if (isnew) AddListItem(listen, conf_listen); listen->flag.temporary = 0; @@ -4164,7 +4227,10 @@ char *port; int start, end; int errors = 0; - char has_options = 0; + char has_options = 0; +#ifdef WITH_ICONV + char has_codepage = 0; +#endif OperFlag *ofp; if (!ce->ce_vardata) @@ -4280,6 +4346,12 @@ #endif } } +#ifdef WITH_ICONV + else if (!strcmp(cep->ce_varname, "codepage")) { + /*do nothing*/ + has_codepage = 1; + } +#endif else { config_error_unknown(cep->ce_fileptr->cf_filename, cep->ce_varlinenum, @@ -4289,6 +4361,13 @@ } } +#ifdef WITH_ICONV + if (!has_codepage) { + config_error("%s:%i: listen: without default codepage define", + ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + return 1; + } +#endif requiredstuff.conf_listen = 1; return errors; } @@ -7982,6 +8061,65 @@ return errors; } +#ifdef WITH_ICONV +int _conf_codepage(ConfigFile *conf, ConfigEntry *ce) +{ + ConfigEntry *cep,*cepp; + ConfigItem_codepage *cp; + char *defcp; + cep = config_find_entry(ce->ce_entries, "default"); + defcp = strdup(cep->ce_vardata); + cep = config_find_entry(ce->ce_entries, "codepages"); + for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) + { + cp = MyMallocEx(sizeof(ConfigItem_codepage)); + ircstrdup(cp->name, cepp->ce_varname); + if (!stricmp(cepp->ce_varname,defcp)) { cp->defcpage = 1; } + else cp->defcpage = 0; + AddListItem(cp, conf_codepage); + } + config_status("default codepage = %s",defcp); + ircfree(defcp); + return 1; +} + +int _test_codepage(ConfigFile *conf, ConfigEntry *ce) +{ + ConfigEntry *cep, *cepp; + char *defcp; + short find=0; + if (!(cep = config_find_entry(ce->ce_entries, "default"))) + { + config_status("%s:%i: codepage::default: no dafult codepage given", + ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + return -1; + } + defcp = strdup(cep->ce_vardata); + if ((cep = config_find_entry(ce->ce_entries, "codepages"))) + { + for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) + { + if (!cepp->ce_varname) + { + config_error("%s:%i: codepage::codepages: item without variable name", + cepp->ce_fileptr->cf_filename, cepp->ce_varlinenum); + continue; + } + if (!find && (stricmp(cepp->ce_varname,defcp)==0)) find=1; + } + } + else + { + config_status("%s:%i: codepage::codepages: no allowed codepages given", + ce->ce_fileptr->cf_filename, ce->ce_varlinenum); + ircfree(defcp); + return -1; + } + ircfree(defcp); + return 0; +} +#endif + int _conf_loadmodule(ConfigFile *conf, ConfigEntry *ce) { #ifdef GLOBH diff -Nura src/s_err.c src/s_err.c --- src/s_err.c 2007-01-22 14:36:50.000000000 +0200 +++ src/s_err.c 2007-07-16 13:32:59.000000000 +0300 @@ -35,7 +35,7 @@ /* 003 RPL_CREATED */ ":%s 003 %s :This server was created %s", /* 004 RPL_MYINFO */ ":%s 004 %s %s %s %s %s", /* 005 RPL_ISUPPORT */ ":%s 005 %s %s :are supported by this server", -/* 006 RPL_MAP */ ":%s 006 %s :%s%-*s(%ld) %s", +/* 006 RPL_MAP */ ":%s 006 %s :%s%s %s | (Users: %4ld) (%2.2f%%) %s", /* 007 RPL_MAPEND */ ":%s 007 %s :End of /MAP", /* 008 RPL_SNOMASK */ ":%s 008 %s :Server notice mask (%s)", /* 009 */ NULL, /* ircu */ @@ -756,11 +756,19 @@ /* 697 */ NULL, /* 698 */ NULL, /* 699 */ NULL, +#ifdef WITH_ICONV +/* 700 RPL_CODEPAGE */ ":%s 700 %s :Your codepage is now %s", +/* 701 RPL_CODEPAGES */ ":%s 701 %s :%s%s", +/* 702 RPL_ENDOFCODEPAGES */ ":%s 702 %s :End of /CODEPAGES list", +/* 703 RPL_WHOISSCHEME */ ":%s 703 %s %s :is using codepage %s", +/* 704 RPL_STATSCODEPAGE */ ":%s 704 %s j %s %d :%s", +#else /* 700 */ NULL, /* 701 */ NULL, /* 702 */ NULL, /* 703 */ NULL, /* 704 */ NULL, +#endif /* 705 */ NULL, /* 706 */ NULL, /* 707 */ NULL, diff -Nura src/ssl.cnf src/ssl.cnf --- src/ssl.cnf 2002-08-25 05:08:13.000000000 +0300 +++ src/ssl.cnf 2007-06-14 09:06:35.000000000 +0300 @@ -9,21 +9,22 @@ x509_extensions = cert_type [ req_dn ] -countryName = Country Name -countryName_default = US +countryName = Country (2 letters) +countryName_default = BY countryName_min = 2 countryName_max = 2 -stateOrProvinceName = State/Province -stateOrProvinceName_default = New York +stateOrProvinceName = Country (full) +stateOrProvinceName_default = Belarus -localityName = Locality Name (eg, city) +localityName = City +localityName_default = Minsk -0.organizationName = Organization Name (eg, company) -0.organizationName_default = IRC geeks +0.organizationName = Company/organization name +0.organizationName_default = organization_name -organizationalUnitName = Organizational Unit Name (eg, section) -organizationalUnitName_default = IRCd +organizationalUnitName = Unit/department name +organizationalUnitName_default = department_name 0.commonName = Common Name (Full domain of your server) 1.commonName_value = localhost --- src/send.c.orig 2006-04-29 18:51:37.000000000 +0400 +++ src/send.c 2007-09-28 17:43:49.000000000 +0400 @@ -39,7 +39,10 @@ #include #endif #include - +#ifdef WITH_ICONV +#include +#endif + void vsendto_one(aClient *to, char *pattern, va_list vl); void sendbufto_one(aClient *to, char *msg, unsigned int quick); @@ -68,6 +71,10 @@ */ static int sentalong[MAXCONNECTIONS]; +#ifdef WITH_ICONV +char *translit(char *text, char *res, size_t *len); +#endif + void vsendto_prefix_one(struct Client *to, struct Client *from, const char *pattern, va_list vl); @@ -152,7 +159,7 @@ int send_queued(aClient *to) { char *msg; - int len, rlen; + size_t len, rlen; #ifdef ZIP_LINKS int more = 0; #endif @@ -238,6 +245,96 @@ va_end(vl); } +#ifdef WITH_ICONV + +char *translit(char *text, char *res, size_t *len) +{ + int index; + char rusalfa[] = "ÀÁÂÃÄŨÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞß²¡àáâãä叿çèéêëìíîïðñòóôõö÷øùúûüýþÿ³¢"; + char transalfa[][3] = { "A","B","V","G","D","E","YO","ZH","Z","I","Y", + "K","L","M","N","O","P","R","S","T","U","F","H", + "C","CH","SH","S4","'","Y","`","E","YU","YA","I","W","a", + "b","v","g","d","e","yo","zh","z","i","y","k","l", + "m","n","o","p","r","s","t","u","f","h","c","ch", + "sh","s4","'","y","`","e","yu","ya","i","w" }; + char cur[2]; + int i; + + cur[1] = '\0'; + + for (i=0;iname)) + { + return text; + } +#ifdef ICONV_SET_DISCARD_ILSEQ + cd = iconv_open (codepage, cp->name); +#else + strncpy(ignore_codepage, codepage, 39); + strncat(ignore_codepage, "//IGNORE", 39 - strlen(codepage)); + cd = iconv_open(ignore_codepage, cp->name); +#endif + + if (cd == (iconv_t)(-1)) + { + if (!strcasecmp(codepage, "TRANSLIT")) + { + translit(text, res, len); + return res; + } + return text; + } + outsize = 2048; +#ifdef ICONV_SET_DISCARD_ILSEQ + iconvctl(cd,ICONV_SET_DISCARD_ILSEQ,&one); + r = iconv (cd, &msghold, len, &holder, &outsize); +#else + r = iconv (cd,(char **) &msghold, len, &holder, &outsize); +#endif + if (r < 0 || (*len) != 0) + { + ircd_log(LOG_ERROR, "iconv: errno=%d, msg=%s, len=in:%dout:%d", errno, text, *len, outsize); + iconv_close (cd); + return text; + } + *len = 2048 - outsize; + buf[*len] = 0; + iconv_close (cd); + return &buf[0]; +} +#endif + void vsendto_one(aClient *to, char *pattern, va_list vl) { ircvsprintf(sendbuf, pattern, vl); @@ -258,8 +355,11 @@ */ void sendbufto_one(aClient *to, char *msg, unsigned int quick) { - int len; - + size_t len; + +#ifdef WITH_ICONV + char *holder=msg; +#endif Debug((DEBUG_ERROR, "Sending [%s] to %s", msg, to->name)); if (to->from) @@ -278,10 +378,10 @@ to->fd)); return; } - if (!quick) { len = strlen(msg); +#ifndef WITH_ICONV if (!len || (msg[len - 1] != '\n')) { if (len > 510) @@ -290,10 +390,25 @@ msg[len++] = '\n'; msg[len] = '\0'; } +#endif } else len = quick; - +#ifdef WITH_ICONV + if (!IsServer(to)) msg=ch_codepage(to->codepage,msg,&len); + if (!len || (msg[len - 1] != '\n')) + { + if (len > 2048) // 510 + len = 2048; // 510 + msg[len++] = '\r'; + msg[len++] = '\n'; + msg[len] = '\0'; + } +#endif +#ifdef WITH_ICONV + if (len > 2048) // 512 +#else if (len > 512) +#endif { ircd_log(LOG_ERROR, "sendbufto_one: len=%u, quick=%u", len, quick); abort();