mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-06-12 17:14:46 +02:00
Big 3.4.x commit containing bug fixes and enhancements. Modularizing
user & channel modes. Fixing Windows build. Etc..
This commit is contained in:
+1
-1
@@ -7,7 +7,7 @@
|
|||||||
\___/|_| |_|_| \___|\__,_|_|\___/\_| \_| \____/\__,_|
|
\___/|_| |_|_| \___|\__,_|_|\___/\_| \_| \____/\__,_|
|
||||||
|
|
||||||
Configuration Program
|
Configuration Program
|
||||||
for Unreal3.4-dev
|
for Unreal3.4-alpha0
|
||||||
|
|
||||||
This program will help you to compile your IRC server, and ask you
|
This program will help you to compile your IRC server, and ask you
|
||||||
questions regarding the compile-time settings of it during the process.
|
questions regarding the compile-time settings of it during the process.
|
||||||
|
|||||||
+66
-27
@@ -1,52 +1,91 @@
|
|||||||
Unreal3.4-dev Release Notes
|
Unreal3.4-alpha0 Release Notes
|
||||||
===========================
|
===============================
|
||||||
|
|
||||||
|
This will be the first alpha version of UnrealIRCd 3.4.
|
||||||
|
Some important remarks:
|
||||||
|
* This version is NOT STABLE and since this is the very first alpha release
|
||||||
|
it will probably CRASH or hang from time to time. Security issues are also
|
||||||
|
more likely in this 3.4-alpha series.
|
||||||
|
DO NOT EVEN THINK ABOUT USING THIS ON ANY SERIOUS (PRODUCTION) SERVER!!
|
||||||
|
Use this alpha version to play around with the latest features and
|
||||||
|
improvements, test them, and give us feedback(!) on bugs.unrealircd.org
|
||||||
|
and/or on the forums.
|
||||||
|
* Linking of 3.2 <-> 3.4 is supported. However, because this is such an
|
||||||
|
early alpha version we can make no guarantees about the impact of this 3.4
|
||||||
|
server on the rest of the net. At this point WE DO NOT RECOMMEND LINKING
|
||||||
|
3.4-alpha* to a 3.2 PRODUCTION/LIVE NETWORK.
|
||||||
|
* Things are likely to change between alpha versions. Including configuration,
|
||||||
|
commands, etc. You should not make any assumptions as long as 3.4 is in
|
||||||
|
alpha stage.
|
||||||
|
* If you are moving from 3.2.x then be sure to read 'CONFIGURATION CHANGES'!
|
||||||
|
|
||||||
==[ GENERAL INFORMATION ]==
|
==[ GENERAL INFORMATION ]==
|
||||||
- If you are upgrading on *NIX, then make sure you run 'make clean' and
|
* The official UnrealIRCd documentation for 3.4 is currently not up to date.
|
||||||
'./Config' first, before running 'make'.
|
Translations have not been updated at all, don't use them for now!
|
||||||
- The official UnrealIRCd documentation is doc/unreal32docs.html
|
The online version is available at www.unrealircd.com/unreal32docs.html
|
||||||
online version at: http://www.vulnscan.org/UnrealIRCd/unreal32docs.html
|
FAQ: http://www.unrealircd.com/faq
|
||||||
FAQ: http://www.vulnscan.org/UnrealIRCd/faq/
|
|
||||||
Read them before asking for help.
|
Read them before asking for help.
|
||||||
- Report bugs at http://bugs.unrealircd.org/
|
* Report bugs at http://bugs.unrealircd.org/
|
||||||
- The purpose of the sections below (NEW, CHANGED, MINOR, etc) is to be a
|
* The purpose of the sections below (NEW, CHANGED, MINOR, etc) is to be a
|
||||||
SUMMARY of the changes in this release. There have been many changes in
|
SUMMARY of the changes in this release. There have been many changes in
|
||||||
total, for the full list of changes see the Changelog.
|
total, for the full list of changes see the Changelog.
|
||||||
|
|
||||||
|
==[ CONFIGURATION CHANGES ]==
|
||||||
|
* In your me { } block, change your "numeric" to "sid", and change the
|
||||||
|
value as follows: pick a 3 character Server ID that starts with a digit.
|
||||||
|
For example: sid "001";
|
||||||
|
* For loadmodule lines you can (and should) now use the shorter syntax.
|
||||||
|
Instead of:
|
||||||
|
loadmodule "src/modules/cloaks.so";
|
||||||
|
You should now use:
|
||||||
|
loadmodule "modules/cloak";
|
||||||
|
UnrealIRCd will figure out the exact name of the module. Doesn't matter
|
||||||
|
if you are on Windows or *NIX, and if your modules are in src/modules/ or
|
||||||
|
in modules/.
|
||||||
|
* The commands module is gone and replaced with many individual modules:
|
||||||
|
1) Remove the loadmodule line for commands.so
|
||||||
|
2) Add the following line to your unrealircd.conf:
|
||||||
|
include "modules.conf";
|
||||||
|
|
||||||
==[ NEW ]==
|
==[ NEW ]==
|
||||||
- Entirely rewritten I/O and event loop. This allows the IRCd to scale to
|
* Entirely rewritten I/O and event loop. This allows the IRCd to scale
|
||||||
tens of thousands of clients on a single process using kernel-evented I/O
|
more easily to tens of thousands of clients by using kernel-evented I/O
|
||||||
mechanisms such as epoll and kqueue.
|
mechanisms such as epoll and kqueue.
|
||||||
- Full command modularity is now provided by default. Each command is it's
|
* Memory pooling has been added to improve memory allocation efficiency
|
||||||
own module and all of them are loaded in the default config. See modules.conf.
|
and performance.
|
||||||
- The local nickname length can be modified without recompiling the IRCd, the
|
* The local nickname length can be modified without recompiling the IRCd
|
||||||
compiled limit is displayed as MAXNICKLEN, per IRCv3 group discussions.
|
|
||||||
- Memory pooling has been added to improve memory allocation efficiency on
|
|
||||||
'hot' codepaths.
|
|
||||||
|
|
||||||
==[ CHANGED ]==
|
==[ CHANGED ]==
|
||||||
- Numerics have been removed. You will need to remove the numeric setting
|
* Numerics have been removed. Instead we now use SIDs (Server ID's) and
|
||||||
from me {} in unrealircd.conf. Instead, proper SID and UIDs are implemented.
|
UIDs (User ID's). SIDs work very similar to server numerics and UIDs
|
||||||
See me::sid.
|
help us to fix a number of lag-related race conditions / bugs.
|
||||||
|
* The module commands.so / commands.dll has been removed. All commands
|
||||||
|
(those that are modular) are now in their own module.
|
||||||
|
* We are in the process of moving channel and user modes to individual
|
||||||
|
modules. All usual modes are included in modules.conf by default but
|
||||||
|
you can decide not to load some of them, simply by commenting them out.
|
||||||
|
Not only does this provide more customizability, it also makes it much
|
||||||
|
easier for developers to look at all the code for a particular feature.
|
||||||
|
|
||||||
==[ MAJOR BUGS FIXED ]==
|
==[ MAJOR BUGS FIXED ]==
|
||||||
- None?
|
* None?
|
||||||
|
|
||||||
==[ MINOR BUGS FIXED ]==
|
==[ MINOR BUGS FIXED ]==
|
||||||
- None?
|
* None?
|
||||||
|
|
||||||
==[ REMOVED / DROPPED ]==
|
==[ REMOVED / DROPPED ]==
|
||||||
- Numeric server IDs, see above.
|
* Numeric server IDs, see above.
|
||||||
- PROTOCTL TOKEN and SJB64 are no longer implemented.
|
* PROTOCTL TOKEN and SJB64 are no longer implemented.
|
||||||
- Ziplinks -- use the built-in compression of TLS/SSL instead.
|
* Ziplinks have been removed. We recommend to use SSL/TLS for all server
|
||||||
|
connections. SSL/TSL already includes compression (when available).
|
||||||
|
|
||||||
==[ KNOWN ISSUES ]==
|
==[ KNOWN ISSUES ]==
|
||||||
- Regexes: Be careful with backreferences (\1, etc), certain regexes can
|
* Regexes: Be careful with backreferences (\1, etc), certain regexes can
|
||||||
slow the IRCd down considerably and even bring it to a near-halt.
|
slow the IRCd down considerably and even bring it to a near-halt.
|
||||||
In the spamfilter user target it's usually safe though.
|
In the spamfilter user target it's usually safe though.
|
||||||
Slow spamfilter detection can help prevent the slowdown/freeze, but
|
Slow spamfilter detection can help prevent the slowdown/freeze, but
|
||||||
might not work in worst-case scenario's.
|
might not work in worst-case scenario's.
|
||||||
- Regexes: Possessive quantifiers such as, for example, "++" (not to be
|
* Regexes: Possessive quantifiers such as, for example, "++" (not to be
|
||||||
confused with "+") are not safe to use, they can easily freeze the IRCd.
|
confused with "+") are not safe to use, they can easily freeze the IRCd.
|
||||||
|
|
||||||
==[ ADDITIONAL INFO ]==
|
==[ ADDITIONAL INFO ]==
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ syntax: regexp
|
|||||||
|
|
||||||
# autotools
|
# autotools
|
||||||
^config\.(status|log)$
|
^config\.(status|log)$
|
||||||
|
^autom4te.cache
|
||||||
|
^aclocal\.m4$
|
||||||
|
|
||||||
# not quite autotools
|
# not quite autotools
|
||||||
^config\.settings$
|
^config\.settings$
|
||||||
|
|||||||
+2
-2
@@ -20,7 +20,7 @@
|
|||||||
#*/
|
#*/
|
||||||
|
|
||||||
CC=@CC@
|
CC=@CC@
|
||||||
INCLUDEDIR=../include
|
INCLUDEDIR=@UNRLINCDIR@
|
||||||
NETWORKSDIR=
|
NETWORKSDIR=
|
||||||
FROMDOS=/home/cmunk/bin/4dos
|
FROMDOS=/home/cmunk/bin/4dos
|
||||||
|
|
||||||
@@ -218,7 +218,7 @@ install: all
|
|||||||
$(INSTALL) -m 0700 -d $(IRCDDIR)/aliases
|
$(INSTALL) -m 0700 -d $(IRCDDIR)/aliases
|
||||||
$(INSTALL) -m 0600 aliases/*.conf $(IRCDDIR)/aliases
|
$(INSTALL) -m 0600 aliases/*.conf $(IRCDDIR)/aliases
|
||||||
$(INSTALL) -m 0600 doc/example.conf $(IRCDDIR)/unrealircd.conf
|
$(INSTALL) -m 0600 doc/example.conf $(IRCDDIR)/unrealircd.conf
|
||||||
$(INSTALL) -m 0600 spamfilter.conf dccallow.conf $(IRCDDIR)
|
$(INSTALL) -m 0600 spamfilter.conf dccallow.conf modules.conf $(IRCDDIR)
|
||||||
$(INSTALL) -m 0600 badwords.*.conf help.conf LICENSE Donation $(IRCDDIR)
|
$(INSTALL) -m 0600 badwords.*.conf help.conf LICENSE Donation $(IRCDDIR)
|
||||||
$(INSTALL) -m 0700 unreal $(IRCDDIR)
|
$(INSTALL) -m 0700 unreal $(IRCDDIR)
|
||||||
$(INSTALL) -m 0700 -d $(IRCDDIR)/modules
|
$(INSTALL) -m 0700 -d $(IRCDDIR)/modules
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
===============================================
|
===============================================
|
||||||
= UnrealIRCd v3.2.4-dev1 =
|
= UnrealIRCd v3.4-alpha0 =
|
||||||
===============================================
|
===============================================
|
||||||
This release was brought to you by:
|
This release was brought to you by:
|
||||||
|
|
||||||
@@ -10,7 +10,6 @@
|
|||||||
Coders:
|
Coders:
|
||||||
========
|
========
|
||||||
* binki
|
* binki
|
||||||
* nenolod
|
|
||||||
|
|
||||||
Contributors:
|
Contributors:
|
||||||
=============
|
=============
|
||||||
@@ -20,6 +19,7 @@
|
|||||||
================
|
================
|
||||||
* Stskeeps
|
* Stskeeps
|
||||||
* codemastr
|
* codemastr
|
||||||
|
* nenolod
|
||||||
* Many more..
|
* Many more..
|
||||||
|
|
||||||
Internet Presence:
|
Internet Presence:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Guess values for system-dependent variables and create Makefiles.
|
# Guess values for system-dependent variables and create Makefiles.
|
||||||
# Generated by GNU Autoconf 2.69 for unrealircd 3.4-dev.
|
# Generated by GNU Autoconf 2.69 for unrealircd 3.4-alpha0.
|
||||||
#
|
#
|
||||||
# Report bugs to <http://bugs.unrealircd.org/>.
|
# Report bugs to <http://bugs.unrealircd.org/>.
|
||||||
#
|
#
|
||||||
@@ -580,8 +580,8 @@ MAKEFLAGS=
|
|||||||
# Identity of this package.
|
# Identity of this package.
|
||||||
PACKAGE_NAME='unrealircd'
|
PACKAGE_NAME='unrealircd'
|
||||||
PACKAGE_TARNAME='unrealircd'
|
PACKAGE_TARNAME='unrealircd'
|
||||||
PACKAGE_VERSION='3.4-dev'
|
PACKAGE_VERSION='3.4-alpha0'
|
||||||
PACKAGE_STRING='unrealircd 3.4-dev'
|
PACKAGE_STRING='unrealircd 3.4-alpha0'
|
||||||
PACKAGE_BUGREPORT='http://bugs.unrealircd.org/'
|
PACKAGE_BUGREPORT='http://bugs.unrealircd.org/'
|
||||||
PACKAGE_URL='http://unrealircd.org/'
|
PACKAGE_URL='http://unrealircd.org/'
|
||||||
|
|
||||||
@@ -624,6 +624,7 @@ ac_includes_default="\
|
|||||||
|
|
||||||
ac_subst_vars='LTLIBOBJS
|
ac_subst_vars='LTLIBOBJS
|
||||||
LIBOBJS
|
LIBOBJS
|
||||||
|
UNRLINCDIR
|
||||||
URL
|
URL
|
||||||
CARES_LIBS
|
CARES_LIBS
|
||||||
CARES_CFLAGS
|
CARES_CFLAGS
|
||||||
@@ -1278,7 +1279,7 @@ if test "$ac_init_help" = "long"; then
|
|||||||
# Omit some internal or obsolete options to make the list less imposing.
|
# Omit some internal or obsolete options to make the list less imposing.
|
||||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||||
cat <<_ACEOF
|
cat <<_ACEOF
|
||||||
\`configure' configures unrealircd 3.4-dev to adapt to many kinds of systems.
|
\`configure' configures unrealircd 3.4-alpha0 to adapt to many kinds of systems.
|
||||||
|
|
||||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||||
|
|
||||||
@@ -1339,7 +1340,7 @@ fi
|
|||||||
|
|
||||||
if test -n "$ac_init_help"; then
|
if test -n "$ac_init_help"; then
|
||||||
case $ac_init_help in
|
case $ac_init_help in
|
||||||
short | recursive ) echo "Configuration of unrealircd 3.4-dev:";;
|
short | recursive ) echo "Configuration of unrealircd 3.4-alpha0:";;
|
||||||
esac
|
esac
|
||||||
cat <<\_ACEOF
|
cat <<\_ACEOF
|
||||||
|
|
||||||
@@ -1472,7 +1473,7 @@ fi
|
|||||||
test -n "$ac_init_help" && exit $ac_status
|
test -n "$ac_init_help" && exit $ac_status
|
||||||
if $ac_init_version; then
|
if $ac_init_version; then
|
||||||
cat <<\_ACEOF
|
cat <<\_ACEOF
|
||||||
unrealircd configure 3.4-dev
|
unrealircd configure 3.4-alpha0
|
||||||
generated by GNU Autoconf 2.69
|
generated by GNU Autoconf 2.69
|
||||||
|
|
||||||
Copyright (C) 2012 Free Software Foundation, Inc.
|
Copyright (C) 2012 Free Software Foundation, Inc.
|
||||||
@@ -2078,7 +2079,7 @@ cat >config.log <<_ACEOF
|
|||||||
This file contains any messages produced by compilers while
|
This file contains any messages produced by compilers while
|
||||||
running configure, to aid debugging if configure makes a mistake.
|
running configure, to aid debugging if configure makes a mistake.
|
||||||
|
|
||||||
It was created by unrealircd $as_me 3.4-dev, which was
|
It was created by unrealircd $as_me 3.4-alpha0, which was
|
||||||
generated by GNU Autoconf 2.69. Invocation command line was
|
generated by GNU Autoconf 2.69. Invocation command line was
|
||||||
|
|
||||||
$ $0 $@
|
$ $0 $@
|
||||||
@@ -3327,6 +3328,10 @@ fi
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
case "`$CC -v --help 2>&1`" in
|
||||||
|
*-fstrict-aliasing* ) CFLAGS="$CFLAGS -fno-strict-aliasing" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
case "`$CC -v --help 2>&1`" in
|
case "`$CC -v --help 2>&1`" in
|
||||||
*-Wpointer-sign* ) CFLAGS="$CFLAGS -Wno-pointer-sign" ;;
|
*-Wpointer-sign* ) CFLAGS="$CFLAGS -Wno-pointer-sign" ;;
|
||||||
esac
|
esac
|
||||||
@@ -7073,7 +7078,10 @@ rm -f core conftest.err conftest.$ac_objext \
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ac_config_files="$ac_config_files Makefile src/modules/Makefile unreal ircdcron/ircdchk ircdcron/ircd.cron"
|
UNRLINCDIR="`pwd`/include"
|
||||||
|
|
||||||
|
|
||||||
|
ac_config_files="$ac_config_files Makefile src/modules/Makefile src/modules/chanmodes/Makefile src/modules/usermodes/Makefile unreal ircdcron/ircdchk ircdcron/ircd.cron"
|
||||||
|
|
||||||
cat >confcache <<\_ACEOF
|
cat >confcache <<\_ACEOF
|
||||||
# This file is a shell script that caches the results of configure
|
# This file is a shell script that caches the results of configure
|
||||||
@@ -7581,7 +7589,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
|
|||||||
# report actual input values of CONFIG_FILES etc. instead of their
|
# report actual input values of CONFIG_FILES etc. instead of their
|
||||||
# values after options handling.
|
# values after options handling.
|
||||||
ac_log="
|
ac_log="
|
||||||
This file was extended by unrealircd $as_me 3.4-dev, which was
|
This file was extended by unrealircd $as_me 3.4-alpha0, which was
|
||||||
generated by GNU Autoconf 2.69. Invocation command line was
|
generated by GNU Autoconf 2.69. Invocation command line was
|
||||||
|
|
||||||
CONFIG_FILES = $CONFIG_FILES
|
CONFIG_FILES = $CONFIG_FILES
|
||||||
@@ -7644,7 +7652,7 @@ _ACEOF
|
|||||||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||||
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
||||||
ac_cs_version="\\
|
ac_cs_version="\\
|
||||||
unrealircd config.status 3.4-dev
|
unrealircd config.status 3.4-alpha0
|
||||||
configured by $0, generated by GNU Autoconf 2.69,
|
configured by $0, generated by GNU Autoconf 2.69,
|
||||||
with options \\"\$ac_cs_config\\"
|
with options \\"\$ac_cs_config\\"
|
||||||
|
|
||||||
@@ -7768,6 +7776,8 @@ do
|
|||||||
"include/setup.h") CONFIG_HEADERS="$CONFIG_HEADERS include/setup.h" ;;
|
"include/setup.h") CONFIG_HEADERS="$CONFIG_HEADERS include/setup.h" ;;
|
||||||
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
|
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
|
||||||
"src/modules/Makefile") CONFIG_FILES="$CONFIG_FILES src/modules/Makefile" ;;
|
"src/modules/Makefile") CONFIG_FILES="$CONFIG_FILES src/modules/Makefile" ;;
|
||||||
|
"src/modules/chanmodes/Makefile") CONFIG_FILES="$CONFIG_FILES src/modules/chanmodes/Makefile" ;;
|
||||||
|
"src/modules/usermodes/Makefile") CONFIG_FILES="$CONFIG_FILES src/modules/usermodes/Makefile" ;;
|
||||||
"unreal") CONFIG_FILES="$CONFIG_FILES unreal" ;;
|
"unreal") CONFIG_FILES="$CONFIG_FILES unreal" ;;
|
||||||
"ircdcron/ircdchk") CONFIG_FILES="$CONFIG_FILES ircdcron/ircdchk" ;;
|
"ircdcron/ircdchk") CONFIG_FILES="$CONFIG_FILES ircdcron/ircdchk" ;;
|
||||||
"ircdcron/ircd.cron") CONFIG_FILES="$CONFIG_FILES ircdcron/ircd.cron" ;;
|
"ircdcron/ircd.cron") CONFIG_FILES="$CONFIG_FILES ircdcron/ircd.cron" ;;
|
||||||
|
|||||||
+11
-1
@@ -10,7 +10,7 @@ dnl Unreal.nfo
|
|||||||
dnl .CHANGES.NEW
|
dnl .CHANGES.NEW
|
||||||
dnl src/version.c.SH
|
dnl src/version.c.SH
|
||||||
|
|
||||||
AC_INIT([unrealircd], [3.4-dev], [http://bugs.unrealircd.org/], [], [http://unrealircd.org/])
|
AC_INIT([unrealircd], [3.4-alpha0], [http://bugs.unrealircd.org/], [], [http://unrealircd.org/])
|
||||||
AC_CONFIG_SRCDIR([src/ircd.c])
|
AC_CONFIG_SRCDIR([src/ircd.c])
|
||||||
AC_CONFIG_HEADER([include/setup.h])
|
AC_CONFIG_HEADER([include/setup.h])
|
||||||
AC_CONFIG_AUX_DIR([autoconf])
|
AC_CONFIG_AUX_DIR([autoconf])
|
||||||
@@ -56,6 +56,11 @@ fi
|
|||||||
|
|
||||||
dnl (the gcc flag detection trick is taken from xemacs/Vin Shelton)
|
dnl (the gcc flag detection trick is taken from xemacs/Vin Shelton)
|
||||||
|
|
||||||
|
dnl UnrealIRCd might not be strict-aliasing safe at this time
|
||||||
|
case "`$CC -v --help 2>&1`" in
|
||||||
|
*-fstrict-aliasing* ) CFLAGS="$CFLAGS -fno-strict-aliasing" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
dnl Pointer signedness warnings are really a pain and 99.9% of the time
|
dnl Pointer signedness warnings are really a pain and 99.9% of the time
|
||||||
dnl they are of absolutely no use whatsoever. IMO the person who decided
|
dnl they are of absolutely no use whatsoever. IMO the person who decided
|
||||||
dnl to enable this without -Wall should be shot on sight.
|
dnl to enable this without -Wall should be shot on sight.
|
||||||
@@ -673,8 +678,13 @@ PKG_CHECK_MODULES([CARES], libcares >= 1.6.0)
|
|||||||
|
|
||||||
CHECK_LIBCURL
|
CHECK_LIBCURL
|
||||||
|
|
||||||
|
UNRLINCDIR="`pwd`/include"
|
||||||
|
AC_SUBST(UNRLINCDIR)
|
||||||
|
|
||||||
AC_CONFIG_FILES([Makefile
|
AC_CONFIG_FILES([Makefile
|
||||||
src/modules/Makefile
|
src/modules/Makefile
|
||||||
|
src/modules/chanmodes/Makefile
|
||||||
|
src/modules/usermodes/Makefile
|
||||||
unreal
|
unreal
|
||||||
ircdcron/ircdchk
|
ircdcron/ircdchk
|
||||||
ircdcron/ircd.cron])
|
ircdcron/ircd.cron])
|
||||||
|
|||||||
@@ -94,9 +94,9 @@ So, again, it will NOT work properly, if:
|
|||||||
==[ SYMBOL FILES ]==
|
==[ SYMBOL FILES ]==
|
||||||
If you get something like this:
|
If you get something like this:
|
||||||
|
|
||||||
Creating library L_COMMANDS.lib and object L_COMMANDS.exp
|
Creating library ....
|
||||||
M_OPER.obj : error LNK2019: unresolved external symbol _sendto_snomask_global re
|
M_OPER.obj : error LNK2019: unresolved external symbol _sendto_snomask_global
|
||||||
ferenced in function _m_oper
|
referenced in function _m_oper
|
||||||
|
|
||||||
(note: the exact name of the symbol will vary!)
|
(note: the exact name of the symbol will vary!)
|
||||||
|
|
||||||
|
|||||||
+3
-4
@@ -56,15 +56,14 @@ include "spamfilter.conf";
|
|||||||
* info "Server Description";
|
* info "Server Description";
|
||||||
* sid "server id";
|
* sid "server id";
|
||||||
* };
|
* };
|
||||||
* The server ID must begin with a number and have two additional numbers or letters
|
* The server ID (sid) must begin with a number, followed by two additional num-
|
||||||
* afterward.
|
* bers or letters. When linking, the server ID must be unique on the network.
|
||||||
* If linking, the server ID may not be used by any other server on the network.
|
|
||||||
*/
|
*/
|
||||||
me
|
me
|
||||||
{
|
{
|
||||||
name "irc.foonet.com";
|
name "irc.foonet.com";
|
||||||
info "FooNet Server";
|
info "FooNet Server";
|
||||||
sid "0AA";
|
sid "001";
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -141,7 +141,6 @@
|
|||||||
<li>W : Windows IRCd.</li>
|
<li>W : Windows IRCd.</li>
|
||||||
<li>Y : Syslog logging enabled.</li>
|
<li>Y : Syslog logging enabled.</li>
|
||||||
<li>6 : Server has IPv6 support (#define INET6 or answer "yes" to relevant ./Config prompt).</li>
|
<li>6 : Server has IPv6 support (#define INET6 or answer "yes" to relevant ./Config prompt).</li>
|
||||||
<li>X : Server has badword stripping (user and channel modes +G) (#define STRIPBADWORDS).</li>
|
|
||||||
<li>P : Server is using poll().</li>
|
<li>P : Server is using poll().</li>
|
||||||
<li>e : Server has SSL Support (#define USE_SSL or answer "yes" (and have ssl libraries installed) to relevant ./Config prompt).</li>
|
<li>e : Server has SSL Support (#define USE_SSL or answer "yes" (and have ssl libraries installed) to relevant ./Config prompt).</li>
|
||||||
<li>O : Server has OperOverride enabled (#undef NO_OPEROVERRIDE or answer "no" to relevant ./Config prompt).</li>
|
<li>O : Server has OperOverride enabled (#undef NO_OPEROVERRIDE or answer "no" to relevant ./Config prompt).</li>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ VL Information (c) 2002 codemastr (Dominick Meglio) [codemastr@unrealircd.com]
|
|||||||
|
|
||||||
Protocol Version
|
Protocol Version
|
||||||
------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------
|
||||||
2312 3.4-alpha*
|
2350 3.4-alpha*
|
||||||
2311 3.2.10
|
2311 3.2.10
|
||||||
2310 3.2.9
|
2310 3.2.9
|
||||||
2309 3.2.6, 3.2.7, 3.2.8
|
2309 3.2.6, 3.2.7, 3.2.8
|
||||||
@@ -30,7 +30,6 @@ W Windows version
|
|||||||
Y Syslog logging enabled
|
Y Syslog logging enabled
|
||||||
K No ident checking (?)
|
K No ident checking (?)
|
||||||
6 IPv6 supported
|
6 IPv6 supported
|
||||||
X STRIPBADWORDS enabled (chmode/umode +G)
|
|
||||||
P Uses poll()
|
P Uses poll()
|
||||||
e SSL supported
|
e SSL supported
|
||||||
O OperOverride enabled
|
O OperOverride enabled
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>UnrealIRCd - 3.2 - Offical Documentation</title>
|
<title>UnrealIRCd - 3.4 - Offical Documentation</title>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
.block_section { font-size: 24; font-weight: bold; }
|
.block_section { font-size: 24; font-weight: bold; }
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
<div align="center"><b><font size="7">UnrealIRCd</font></b><br>
|
<div align="center"><b><font size="7">UnrealIRCd</font></b><br>
|
||||||
<font size="4"><a href="http://www.unrealircd.com">http://www.unrealircd.com</a></font><br>
|
<font size="4"><a href="http://www.unrealircd.com">http://www.unrealircd.com</a></font><br>
|
||||||
<font size="4">Version: 3.2.10-rc1</font><br>
|
<font size="4">Version: 3.4-alpha0</font><br>
|
||||||
<b>Letztes Update dieses Handbuchs:</b> 2009-12-24</div>
|
<b>Letztes Update dieses Handbuchs:</b> 2009-12-24</div>
|
||||||
<b>Head Coders:</b> Stskeeps / codemastr / Syzop / Luke<font face="Helvetica,Arial" size="-1">/
|
<b>Head Coders:</b> Stskeeps / codemastr / Syzop / Luke<font face="Helvetica,Arial" size="-1">/
|
||||||
aquanight / WolfSage</font><br>
|
aquanight / WolfSage</font><br>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>UnrealIRCd - 3.2 - Documentacion Oficial</title>
|
<title>UnrealIRCd - 3.4 - Documentacion Oficial</title>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
.block_section { font-size: 24; font-weight: bold; }
|
.block_section { font-size: 24; font-weight: bold; }
|
||||||
@@ -30,7 +30,7 @@ Spanish
|
|||||||
<br><br>
|
<br><br>
|
||||||
<div align="center"><b><font size="7">UnrealIRCd</font></b><br>
|
<div align="center"><b><font size="7">UnrealIRCd</font></b><br>
|
||||||
<font size="4"><a href="http://www.unrealircd.com">http://www.unrealircd.com</a></font><br>
|
<font size="4"><a href="http://www.unrealircd.com">http://www.unrealircd.com</a></font><br>
|
||||||
<font size="4">Version: 3.2.10</font><br>
|
<font size="4">Version: 3.4-alpha0</font><br>
|
||||||
<b>Ultima actualizacion del doc:</b> 2012-11-11</div>
|
<b>Ultima actualizacion del doc:</b> 2012-11-11</div>
|
||||||
<br>
|
<br>
|
||||||
<b>Programador jefe/mantenimiento:</b> Syzop<br>
|
<b>Programador jefe/mantenimiento:</b> Syzop<br>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>UnrealIRCd - 3.2 - Documentation officielle</title>
|
<title>UnrealIRCd - 3.4 - Documentation officielle</title>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
.block_section { font-size: 24; font-weight: bold; }
|
.block_section { font-size: 24; font-weight: bold; }
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
<div style="text-align:center;">
|
<div style="text-align:center;">
|
||||||
<b><font size="7">UnrealIRCd</font></b><br>
|
<b><font size="7">UnrealIRCd</font></b><br>
|
||||||
<font size="4"><a href="http://www.unrealircd.com/">http://www.unrealircd.com</a></font><br>
|
<font size="4"><a href="http://www.unrealircd.com/">http://www.unrealircd.com</a></font><br>
|
||||||
<font size="4">Version: 3.2.10</font><br>
|
<font size="4">Version: 3.4-alpha0</font><br>
|
||||||
<b>Dernière mise à jour de la documentation:</b> 2012-10-16
|
<b>Dernière mise à jour de la documentation:</b> 2012-10-16
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>UnrealIRCd - 3.2 - Official Documentation</title>
|
<title>UnrealIRCd - 3.4 - Official Documentation</title>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
.block_section { font-size: 24; font-weight: bold; }
|
.block_section { font-size: 24; font-weight: bold; }
|
||||||
@@ -30,7 +30,7 @@ English |
|
|||||||
<br><br>
|
<br><br>
|
||||||
<div align="center"><b><font size="7">UnrealIRCd</font></b><br>
|
<div align="center"><b><font size="7">UnrealIRCd</font></b><br>
|
||||||
<font size="4"><a href="http://www.unrealircd.com">http://www.unrealircd.com</a></font><br>
|
<font size="4"><a href="http://www.unrealircd.com">http://www.unrealircd.com</a></font><br>
|
||||||
<font size="4">Version: 3.2.10</font><br>
|
<font size="4">Version: 3.4-alpha0</font><br>
|
||||||
<b>Last doc update:</b> 2012-10-16</div>
|
<b>Last doc update:</b> 2012-10-16</div>
|
||||||
<br>
|
<br>
|
||||||
<b>Head coder/maintainer:</b> Syzop<br>
|
<b>Head coder/maintainer:</b> Syzop<br>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>UnrealIRCd - 3.2 - Hivatalos dokumentáció</title>
|
<title>UnrealIRCd - 3.4 - Hivatalos dokumentáció</title>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
.block_section { font-size: 24; font-weight: bold; }
|
.block_section { font-size: 24; font-weight: bold; }
|
||||||
@@ -29,7 +29,7 @@ Hungarian |
|
|||||||
<br><br>
|
<br><br>
|
||||||
<div align="center"><b><font size="7">UnrealIRCd</font></b><br>
|
<div align="center"><b><font size="7">UnrealIRCd</font></b><br>
|
||||||
<font size="4"><a href="http://www.unrealircd.com/">http://www.unrealircd.com</a></font><br>
|
<font size="4"><a href="http://www.unrealircd.com/">http://www.unrealircd.com</a></font><br>
|
||||||
<font size="4">Verzió: 3.2.10-rc1</font><br>
|
<font size="4">Verzió: 3.4-alpha0</font><br>
|
||||||
<b>Utolsó dokumentáció frissítés:</b> 2010-11-15</div>
|
<b>Utolsó dokumentáció frissítés:</b> 2010-11-15</div>
|
||||||
<br>
|
<br>
|
||||||
<b>Fő fejlesztő/karbantartó:</b> Syzop<br>
|
<b>Fő fejlesztő/karbantartó:</b> Syzop<br>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>UnrealIRCd - 3.2 - Îôèöèàëüíàÿ äîêóìåíòàöèÿ</title>
|
<title>UnrealIRCd - 3.4 - Îôèöèàëüíàÿ äîêóìåíòàöèÿ</title>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
|
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
|
||||||
<style type="text/css"> .block_section { font-size: 24; font-weight: bold; }
|
<style type="text/css"> .block_section { font-size: 24; font-weight: bold; }
|
||||||
.block_name { font-size: 24; font-weight: bold; }
|
.block_name { font-size: 24; font-weight: bold; }
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
<br>
|
<br>
|
||||||
<div align="center"><b><font size="7">UnrealIRCd</font></b><br>
|
<div align="center"><b><font size="7">UnrealIRCd</font></b><br>
|
||||||
<font size="4"><a href="http://www.unrealircd.com">http://www.unrealircd.com</a></font><br>
|
<font size="4"><a href="http://www.unrealircd.com">http://www.unrealircd.com</a></font><br>
|
||||||
<font size="4">Âåðñèÿ: 3.2.10</font><br>
|
<font size="4">Âåðñèÿ: 3.4-alpha0</font><br>
|
||||||
<b>Ïîñëåäíåå îáíîâëåíèå:</b> 2012-10-18</div>
|
<b>Ïîñëåäíåå îáíîâëåíèå:</b> 2012-10-18</div>
|
||||||
<br>
|
<br>
|
||||||
<b>Ãëàâíûå ïðîãðàììèñòû</b> Syzop<br>
|
<b>Ãëàâíûå ïðîãðàììèñòû</b> Syzop<br>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<div class="moz-text-flowed" style="font-family: -moz-fixed"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
<div class="moz-text-flowed" style="font-family: -moz-fixed"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||||
<HTML><HEAD><TITLE>UnrealIRCd - 3.2 - Resmi Döküman</TITLE>
|
<HTML><HEAD><TITLE>UnrealIRCd - 3.4 - Resmi Döküman</TITLE>
|
||||||
<META http-equiv=Content-Type content="text/html; charset=iso-8859-9">
|
<META http-equiv=Content-Type content="text/html; charset=iso-8859-9">
|
||||||
<STYLE type=text/css>.block_section {
|
<STYLE type=text/css>.block_section {
|
||||||
FONT-WEIGHT: bold; FONT-SIZE: 24px
|
FONT-WEIGHT: bold; FONT-SIZE: 24px
|
||||||
@@ -46,7 +46,7 @@ Turkish |
|
|||||||
<BR><BR>
|
<BR><BR>
|
||||||
<DIV align=center><B><FONT size=7>UnrealIRCd</FONT></B><BR><FONT size=4><A
|
<DIV align=center><B><FONT size=7>UnrealIRCd</FONT></B><BR><FONT size=4><A
|
||||||
href="http://www.unrealircd.com/">http://www.unrealircd.com/</A></FONT><BR><FONT
|
href="http://www.unrealircd.com/">http://www.unrealircd.com/</A></FONT><BR><FONT
|
||||||
size=4>Version: 3.2.10</FONT><BR><B>En Son Güncelleme:</B>
|
size=4>Version: 3.4-alpha0</FONT><BR><B>En Son Güncelleme:</B>
|
||||||
2012-10-16</DIV><BR>
|
2012-10-16</DIV><BR>
|
||||||
<B>Baþ Kodlayýcý/Devam Ettiren:</b> Syzop<br>
|
<B>Baþ Kodlayýcý/Devam Ettiren:</b> Syzop<br>
|
||||||
<b>Kodlayýcýlar:</b> binki<br>
|
<b>Kodlayýcýlar:</b> binki<br>
|
||||||
|
|||||||
@@ -13,4 +13,24 @@
|
|||||||
#define PATTERN "\\w*%s\\w*"
|
#define PATTERN "\\w*%s\\w*"
|
||||||
#define REPLACEWORD "<censored>"
|
#define REPLACEWORD "<censored>"
|
||||||
|
|
||||||
|
#define BADW_TYPE_INVALID 0x0
|
||||||
|
#define BADW_TYPE_FAST 0x1
|
||||||
|
#define BADW_TYPE_FAST_L 0x2
|
||||||
|
#define BADW_TYPE_FAST_R 0x4
|
||||||
|
#define BADW_TYPE_REGEX 0x8
|
||||||
|
|
||||||
|
#define BADWORD_REPLACE 1
|
||||||
|
#define BADWORD_BLOCK 2
|
||||||
|
|
||||||
|
typedef struct _configitem_badword ConfigItem_badword;
|
||||||
|
|
||||||
|
struct _configitem_badword {
|
||||||
|
ConfigItem_badword *prev, *next;
|
||||||
|
ConfigFlag flag;
|
||||||
|
char *word, *replace;
|
||||||
|
unsigned short type;
|
||||||
|
char action;
|
||||||
|
regex_t expr;
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+10
-1
@@ -41,7 +41,13 @@
|
|||||||
#ifdef PARAMH
|
#ifdef PARAMH
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef _WIN32
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#else
|
||||||
|
typedef int bool;
|
||||||
|
#define false 0
|
||||||
|
#define true 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !defined(IN_ADDR)
|
#if !defined(IN_ADDR)
|
||||||
#include "sys.h"
|
#include "sys.h"
|
||||||
@@ -231,6 +237,9 @@ static char *StsMalloc(size_t size, char *file, long line)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define ircstrdup(x,y) do { if (x) MyFree(x); if (!y) x = NULL; else x = strdup(y); } while(0)
|
||||||
|
#define ircfree(x) do { if (x) MyFree(x); x = NULL; } while(0)
|
||||||
|
|
||||||
extern struct SLink *find_user_link( /* struct SLink *, struct Client * */ );
|
extern struct SLink *find_user_link( /* struct SLink *, struct Client * */ );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -253,7 +262,7 @@ extern struct SLink *find_user_link( /* struct SLink *, struct Client * */ );
|
|||||||
#define CHPAR1 "beIqa"
|
#define CHPAR1 "beIqa"
|
||||||
#endif /* PREFIX_AQ */
|
#endif /* PREFIX_AQ */
|
||||||
|
|
||||||
#define CHPAR2 "kfL"
|
#define CHPAR2 "k"
|
||||||
#define CHPAR3 "l"
|
#define CHPAR3 "l"
|
||||||
#define CHPAR4 "psmntirRcOAQKVCuzNSM"
|
#define CHPAR4 "psmntirRcOAQKVCuzNSM"
|
||||||
|
|
||||||
|
|||||||
+10
-24
@@ -149,16 +149,6 @@
|
|||||||
*/
|
*/
|
||||||
#define REMOTEINC_SPECIALCACHE
|
#define REMOTEINC_SPECIALCACHE
|
||||||
|
|
||||||
/*
|
|
||||||
Stripbadwords patch
|
|
||||||
*/
|
|
||||||
#define STRIPBADWORDS
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Always strip badwords in channels? (channel does not have to be +G)
|
|
||||||
*/
|
|
||||||
#undef STRIPBADWORDS_CHAN_ALWAYS
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* No spoof code
|
* No spoof code
|
||||||
*
|
*
|
||||||
@@ -264,18 +254,17 @@
|
|||||||
|
|
||||||
/* CHROOTDIR
|
/* CHROOTDIR
|
||||||
*
|
*
|
||||||
* This enables running the IRCd chrooted (requires initial root privileges,
|
* This enables running the IRCd chrooted. Privileges will be dropped later
|
||||||
* but will be dropped to IRC_USER/IRC_GROUP privileges if those are defined).
|
* to IRC_USER/IRC_GROUP when those are defined.
|
||||||
*
|
*
|
||||||
* The directory to chroot to is simply DPATH (which is set via ./Config).
|
* The directory to chroot to is simply DPATH (which is set via ./Config).
|
||||||
* (This may effect the PATH locations above, though you can symlink it)
|
* (This may effect the PATH locations above, though you can symlink it)
|
||||||
*
|
*
|
||||||
* Usually you only simply need to enable this, and set IRC_USER and
|
* If you want this, simple change this to '#define CHROOTDIR' and also
|
||||||
* IRC_GROUP, you don't need to create a special chroot environment..
|
* look at IRC_USER/IRC_GROUP a few lines below.
|
||||||
|
* There's no need for you to create a special chroot environment;
|
||||||
* UnrealIRCd will do that by itself (Unreal will create /dev/random,
|
* UnrealIRCd will do that by itself (Unreal will create /dev/random,
|
||||||
* etc. etc.).
|
* etc. etc.).
|
||||||
*
|
|
||||||
* Change to '#define CHROOTDIR' to enable...
|
|
||||||
*/
|
*/
|
||||||
/* #define CHROOTDIR */
|
/* #define CHROOTDIR */
|
||||||
|
|
||||||
@@ -283,8 +272,7 @@
|
|||||||
* IRC_USER
|
* IRC_USER
|
||||||
*
|
*
|
||||||
* If you start the server as root but wish to have it run as another user,
|
* If you start the server as root but wish to have it run as another user,
|
||||||
* define IRC_USER to that user name. This should only be defined if you
|
* define IRC_USER to that user name.
|
||||||
* are running as root and even then perhaps not.
|
|
||||||
*/
|
*/
|
||||||
/* #define IRC_USER "<user name>" */
|
/* #define IRC_USER "<user name>" */
|
||||||
/* #define IRC_GROUP "<group name>" */
|
/* #define IRC_GROUP "<group name>" */
|
||||||
@@ -464,13 +452,11 @@
|
|||||||
*/
|
*/
|
||||||
#define KILLCHASETIMELIMIT 90 /* Recommended value: 90 */
|
#define KILLCHASETIMELIMIT 90 /* Recommended value: 90 */
|
||||||
|
|
||||||
/* JoinThrottle (chanmode +j): +j x:y throttles users to X joins per Y seconds (per-user).
|
/*
|
||||||
* In peak situations (eg: just after a server restart with thousand clients joining
|
* Forces Unreal to use compressed IPv6 addresses rather than expanding them
|
||||||
* hundreds of channels) it can use like ~200k, but in normal circumstances you should
|
|
||||||
* count on just ~10-50k.
|
|
||||||
*/
|
*/
|
||||||
#define JOINTHROTTLE
|
#undef IPV6_COMPRESSED
|
||||||
|
|
||||||
/* Detect slow spamfilters? This requires a little more cpu time when processing
|
/* Detect slow spamfilters? This requires a little more cpu time when processing
|
||||||
* any spamfilter (like on text/connect/..) but will save you from slowing down
|
* any spamfilter (like on text/connect/..) but will save you from slowing down
|
||||||
* your IRCd to a near-halt (well, in most cases.. there are still cases like when
|
* your IRCd to a near-halt (well, in most cases.. there are still cases like when
|
||||||
|
|||||||
+3
-4
@@ -51,7 +51,6 @@ struct ChMode {
|
|||||||
long mode;
|
long mode;
|
||||||
long extmodes;
|
long extmodes;
|
||||||
char *extparams[EXTCMODETABLESZ];
|
char *extparams[EXTCMODETABLESZ];
|
||||||
ChanFloodProt floodprot;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct _OperStat {
|
typedef struct _OperStat {
|
||||||
@@ -110,9 +109,9 @@ struct zConfiguration {
|
|||||||
int ssl_renegotiate_timeout;
|
int ssl_renegotiate_timeout;
|
||||||
|
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32)
|
||||||
void *bogus1, *bogus2, *bogus3, *bogus5, *bogus8;
|
void *bogus1, *bogus2, *bogus3, *bogus4, *bogus5;
|
||||||
long bogus4;
|
long bogus6;
|
||||||
int bogus6, bogus7;
|
int bogus7, bogus8;
|
||||||
#endif
|
#endif
|
||||||
enum UHAllowed userhost_allowed;
|
enum UHAllowed userhost_allowed;
|
||||||
char *restrict_usermodes;
|
char *restrict_usermodes;
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ extern MODVAR FDEntry fd_table[MAXCONNECTIONS + 1];
|
|||||||
|
|
||||||
extern int fd_open(int fd, const char *desc);
|
extern int fd_open(int fd, const char *desc);
|
||||||
extern void fd_close(int fd);
|
extern void fd_close(int fd);
|
||||||
|
extern void fd_unnotify(int fd);
|
||||||
extern int fd_socket(int family, int type, int protocol, const char *desc);
|
extern int fd_socket(int family, int type, int protocol, const char *desc);
|
||||||
extern int fd_accept(int sockfd);
|
extern int fd_accept(int sockfd);
|
||||||
extern void fd_desc(int fd, const char *desc);
|
extern void fd_desc(int fd, const char *desc);
|
||||||
@@ -32,6 +33,7 @@ extern int fd_fileopen(const char *path, unsigned int flags);
|
|||||||
#define FD_SELECT_READ 0x1
|
#define FD_SELECT_READ 0x1
|
||||||
#define FD_SELECT_WRITE 0x2
|
#define FD_SELECT_WRITE 0x2
|
||||||
#define FD_SELECT_ONESHOT 0x4
|
#define FD_SELECT_ONESHOT 0x4
|
||||||
|
#define FD_SELECT_NOWRITE 0x8
|
||||||
|
|
||||||
extern void fd_setselect(int fd, int flags, IOCallbackFunc iocb, void *data);
|
extern void fd_setselect(int fd, int flags, IOCallbackFunc iocb, void *data);
|
||||||
extern void fd_select(time_t delay); /* backend-specific */
|
extern void fd_select(time_t delay); /* backend-specific */
|
||||||
|
|||||||
+24
-40
@@ -69,9 +69,6 @@ extern MODVAR ConfigItem_except *conf_except;
|
|||||||
extern MODVAR ConfigItem_vhost *conf_vhost;
|
extern MODVAR ConfigItem_vhost *conf_vhost;
|
||||||
extern MODVAR ConfigItem_link *conf_link;
|
extern MODVAR ConfigItem_link *conf_link;
|
||||||
extern MODVAR ConfigItem_ban *conf_ban;
|
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_quit;
|
|
||||||
extern MODVAR ConfigItem_deny_dcc *conf_deny_dcc;
|
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_deny_link *conf_deny_link;
|
||||||
@@ -93,7 +90,15 @@ extern long set_usermode(char *umode);
|
|||||||
extern char *get_modestr(long umodes);
|
extern char *get_modestr(long umodes);
|
||||||
extern void config_error(char *format, ...) __attribute__((format(printf,1,2)));
|
extern void config_error(char *format, ...) __attribute__((format(printf,1,2)));
|
||||||
extern void config_warn(char *format, ...) __attribute__((format(printf,1,2)));
|
extern void config_warn(char *format, ...) __attribute__((format(printf,1,2)));
|
||||||
|
extern void config_error_missing(const char *filename, int line, const char *entry);
|
||||||
|
extern void config_error_unknown(const char *filename, int line, const char *block, const char *entry);
|
||||||
|
extern void config_error_unknownflag(const char *filename, int line, const char *block, const char *entry);
|
||||||
|
extern void config_error_unknownopt(const char *filename, int line, const char *block, const char *entry);
|
||||||
|
extern void config_error_noname(const char *filename, int line, const char *block);
|
||||||
|
extern void config_error_blank(const char *filename, int line, const char *block);
|
||||||
|
extern void config_error_empty(const char *filename, int line, const char *block, const char *entry);
|
||||||
|
extern void config_warn_duplicate(const char *filename, int line, const char *entry);
|
||||||
|
extern int config_is_blankorempty(ConfigEntry *cep, const char *block);
|
||||||
extern MODVAR int config_verbose;
|
extern MODVAR int config_verbose;
|
||||||
extern void config_progress(char *format, ...) __attribute__((format(printf,1,2)));
|
extern void config_progress(char *format, ...) __attribute__((format(printf,1,2)));
|
||||||
extern void ipport_seperate(char *string, char **ip, char **port);
|
extern void ipport_seperate(char *string, char **ip, char **port);
|
||||||
@@ -298,7 +303,6 @@ extern void sendto_server(aClient *one, unsigned long caps, unsigned long nocaps
|
|||||||
|
|
||||||
extern MODVAR int writecalls, writeb[];
|
extern MODVAR int writecalls, writeb[];
|
||||||
extern int deliver_it(aClient *, char *, int);
|
extern int deliver_it(aClient *, char *, int);
|
||||||
extern int check_for_chan_flood(aClient *cptr, aClient *sptr, aChannel *chptr);
|
|
||||||
extern int check_for_target_limit(aClient *sptr, void *target, const char *name);
|
extern int check_for_target_limit(aClient *sptr, void *target, const char *name);
|
||||||
extern char *canonize(char *buffer);
|
extern char *canonize(char *buffer);
|
||||||
extern ConfigItem_deny_dcc *dcc_isforbidden(aClient *sptr, char *filename);
|
extern ConfigItem_deny_dcc *dcc_isforbidden(aClient *sptr, char *filename);
|
||||||
@@ -412,9 +416,7 @@ extern MODVAR long UMODE_VICTIM; /* 0x8000000 Intentional Victim */
|
|||||||
extern MODVAR long UMODE_DEAF; /* 0x10000000 Deaf */
|
extern MODVAR long UMODE_DEAF; /* 0x10000000 Deaf */
|
||||||
extern MODVAR long UMODE_HIDEOPER; /* 0x20000000 Hide oper mode */
|
extern MODVAR long UMODE_HIDEOPER; /* 0x20000000 Hide oper mode */
|
||||||
extern MODVAR long UMODE_SETHOST; /* 0x40000000 used sethost */
|
extern MODVAR long UMODE_SETHOST; /* 0x40000000 used sethost */
|
||||||
extern MODVAR long UMODE_STRIPBADWORDS; /* 0x80000000 */
|
|
||||||
extern MODVAR long UMODE_HIDEWHOIS; /* hides channels in /whois */
|
extern MODVAR long UMODE_HIDEWHOIS; /* hides channels in /whois */
|
||||||
extern MODVAR long UMODE_NOCTCP; /* blocks all ctcp (except dcc and action) */
|
|
||||||
extern MODVAR long UMODE_HIDLE; /* hides oper idle times */
|
extern MODVAR long UMODE_HIDLE; /* hides oper idle times */
|
||||||
extern MODVAR long AllUmodes, SendUmodes;
|
extern MODVAR long AllUmodes, SendUmodes;
|
||||||
|
|
||||||
@@ -435,10 +437,6 @@ extern MODVAR long SNO_OPER;
|
|||||||
|
|
||||||
/* Extended chanmodes... */
|
/* Extended chanmodes... */
|
||||||
extern MODVAR Cmode_t EXTMODE_NONOTICE;
|
extern MODVAR Cmode_t EXTMODE_NONOTICE;
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
extern MODVAR Cmode_t EXTMODE_STRIPBADWORDS;
|
|
||||||
#endif
|
|
||||||
extern MODVAR Cmode_t EXTMODE_JOINTHROTTLE;
|
|
||||||
|
|
||||||
#ifndef HAVE_STRLCPY
|
#ifndef HAVE_STRLCPY
|
||||||
size_t strlcpy(char *dst, const char *src, size_t size);
|
size_t strlcpy(char *dst, const char *src, size_t size);
|
||||||
@@ -538,7 +536,6 @@ extern void validate_configuration(void);
|
|||||||
extern void run_configuration(void);
|
extern void run_configuration(void);
|
||||||
extern void rehash_motdrules();
|
extern void rehash_motdrules();
|
||||||
extern void read_motd(const char *filename, aMotdFile *motd); /* s_serv.c */
|
extern void read_motd(const char *filename, aMotdFile *motd); /* s_serv.c */
|
||||||
extern CMD_FUNC(m_server_remote);
|
|
||||||
extern void send_proto(aClient *, ConfigItem_link *);
|
extern void send_proto(aClient *, ConfigItem_link *);
|
||||||
extern void unload_all_modules(void);
|
extern void unload_all_modules(void);
|
||||||
extern int set_blocking(int fd);
|
extern int set_blocking(int fd);
|
||||||
@@ -557,25 +554,21 @@ extern u_char getrandom8();
|
|||||||
extern u_int16_t getrandom16();
|
extern u_int16_t getrandom16();
|
||||||
extern u_int32_t getrandom32();
|
extern u_int32_t getrandom32();
|
||||||
#define EVENT_DRUGS BASE_VERSION
|
#define EVENT_DRUGS BASE_VERSION
|
||||||
extern void rejoin_doquits(aClient *sptr);
|
extern void rejoin_leave(aClient *sptr);
|
||||||
extern void rejoin_dojoinandmode(aClient *sptr);
|
extern void rejoin_joinandmode(aClient *sptr);
|
||||||
extern void ident_failed(aClient *cptr);
|
extern void ident_failed(aClient *cptr);
|
||||||
|
|
||||||
extern MODVAR char extchmstr[4][64];
|
extern MODVAR char extchmstr[4][64];
|
||||||
extern MODVAR char extbanstr[EXTBANTABLESZ+1];
|
extern MODVAR char extbanstr[EXTBANTABLESZ+1];
|
||||||
|
|
||||||
extern int extcmode_default_requirechop(aClient *, aChannel *, char *, int, int);
|
extern int extcmode_default_requirechop(aClient *, aChannel *, char, char *, int, int);
|
||||||
extern int extcmode_default_requirehalfop(aClient *, aChannel *, char *, int, int);
|
extern int extcmode_default_requirehalfop(aClient *, aChannel *, char, char *, int, int);
|
||||||
extern Cmode_t extcmode_get(Cmode *);
|
extern Cmode_t extcmode_get(Cmode *);
|
||||||
extern void extcmode_init(void);
|
extern void extcmode_init(void);
|
||||||
extern CmodeParam *extcmode_get_struct(CmodeParam *, char);
|
|
||||||
extern void make_extcmodestr();
|
extern void make_extcmodestr();
|
||||||
extern CmodeParam *extcmode_duplicate_paramlist(CmodeParam *);
|
extern void extcmode_duplicate_paramlist(void **xi, void **xo);
|
||||||
extern void extcmode_free_paramlist(CmodeParam *);
|
extern void extcmode_free_paramlist(void **ar);
|
||||||
|
|
||||||
extern int do_chanflood(ChanFloodProt *, int);
|
|
||||||
extern void do_chanflood_action(aChannel *, int, char *);
|
|
||||||
extern char *channel_modef_string(ChanFloodProt *);
|
|
||||||
extern void chmode_str(struct ChMode, char *, char *, size_t, size_t);
|
extern void chmode_str(struct ChMode, char *, char *, size_t, size_t);
|
||||||
extern char *get_cptr_status(aClient *);
|
extern char *get_cptr_status(aClient *);
|
||||||
extern char *get_snostr(long);
|
extern char *get_snostr(long);
|
||||||
@@ -584,11 +577,6 @@ extern void InitDebug(void);
|
|||||||
extern int InitwIRCD(int argc, char **);
|
extern int InitwIRCD(int argc, char **);
|
||||||
extern void SocketLoop(void *);
|
extern void SocketLoop(void *);
|
||||||
#endif
|
#endif
|
||||||
#ifdef STATIC_LINKING
|
|
||||||
extern int l_commands_Init(ModuleInfo *);
|
|
||||||
extern int l_commands_Test(ModuleInfo *);
|
|
||||||
extern int l_commands_Load(int);
|
|
||||||
#endif
|
|
||||||
extern void sendto_chmodemucrap(aClient *, aChannel *, char *);
|
extern void sendto_chmodemucrap(aClient *, aChannel *, char *);
|
||||||
extern void verify_opercount(aClient *, char *);
|
extern void verify_opercount(aClient *, char *);
|
||||||
extern int valid_host(char *host);
|
extern int valid_host(char *host);
|
||||||
@@ -667,7 +655,7 @@ extern MODVAR int dontspread;
|
|||||||
/* Efuncs */
|
/* Efuncs */
|
||||||
extern MODVAR int (*do_join)(aClient *, aClient *, int, char **);
|
extern MODVAR int (*do_join)(aClient *, aClient *, int, char **);
|
||||||
extern MODVAR void (*join_channel)(aChannel *chptr, aClient *cptr, aClient *sptr, int flags);
|
extern MODVAR void (*join_channel)(aChannel *chptr, aClient *cptr, aClient *sptr, int flags);
|
||||||
extern MODVAR int (*can_join)(aClient *cptr, aClient *sptr, aChannel *chptr, char *key, char *link, char *parv[]);
|
extern MODVAR int (*can_join)(aClient *cptr, aClient *sptr, aChannel *chptr, char *key, char *parv[]);
|
||||||
extern MODVAR void (*do_mode)(aChannel *chptr, aClient *cptr, aClient *sptr, int parc, char *parv[], time_t sendts, int samode);
|
extern MODVAR void (*do_mode)(aChannel *chptr, aClient *cptr, aClient *sptr, int parc, char *parv[], time_t sendts, int samode);
|
||||||
extern MODVAR void (*set_mode)(aChannel *chptr, aClient *cptr, int parc, char *parv[], u_int *pcount,
|
extern MODVAR void (*set_mode)(aChannel *chptr, aClient *cptr, int parc, char *parv[], u_int *pcount,
|
||||||
char pvar[MAXMODEPARAMS][MODEBUFLEN + 3], int bounce);
|
char pvar[MAXMODEPARAMS][MODEBUFLEN + 3], int bounce);
|
||||||
@@ -694,9 +682,6 @@ extern MODVAR int (*place_host_ban)(aClient *sptr, int action, char *reason, lon
|
|||||||
extern MODVAR int (*dospamfilter)(aClient *sptr, char *str_in, int type, char *target, int flags, aTKline **rettk);
|
extern MODVAR int (*dospamfilter)(aClient *sptr, char *str_in, int type, char *target, int flags, aTKline **rettk);
|
||||||
extern MODVAR int (*dospamfilter_viruschan)(aClient *sptr, aTKline *tk, int type);
|
extern MODVAR int (*dospamfilter_viruschan)(aClient *sptr, aTKline *tk, int type);
|
||||||
extern MODVAR void (*send_list)(aClient *cptr, int numsend);
|
extern MODVAR void (*send_list)(aClient *cptr, int numsend);
|
||||||
extern MODVAR char *(*stripbadwords_channel)(char *str, int *blocked);
|
|
||||||
extern MODVAR char *(*stripbadwords_message)(char *str, int *blocked);
|
|
||||||
extern MODVAR char *(*stripbadwords_quit)(char *str, int *blocked);
|
|
||||||
extern MODVAR unsigned char *(*StripColors)(unsigned char *text);
|
extern MODVAR unsigned char *(*StripColors)(unsigned char *text);
|
||||||
extern MODVAR const char *(*StripControlCodes)(unsigned char *text);
|
extern MODVAR const char *(*StripControlCodes)(unsigned char *text);
|
||||||
extern MODVAR void (*spamfilter_build_user_string)(char *buf, char *nick, aClient *acptr);
|
extern MODVAR void (*spamfilter_build_user_string)(char *buf, char *nick, aClient *acptr);
|
||||||
@@ -710,19 +695,10 @@ extern MODVAR int max_connection_count;
|
|||||||
extern int add_listmode(Ban **list, aClient *cptr, aChannel *chptr, char *banid);
|
extern int add_listmode(Ban **list, aClient *cptr, aChannel *chptr, char *banid);
|
||||||
extern int del_listmode(Ban **list, aChannel *chptr, char *banid);
|
extern int del_listmode(Ban **list, aChannel *chptr, char *banid);
|
||||||
extern int Halfop_mode(long mode);
|
extern int Halfop_mode(long mode);
|
||||||
extern void chanfloodtimer_add(aChannel *chptr, char mflag, long mbit, time_t when);
|
|
||||||
extern void chanfloodtimer_del(aChannel *chptr, char mflag, long mbit);
|
|
||||||
extern char *clean_ban_mask(char *, int, aClient *);
|
extern char *clean_ban_mask(char *, int, aClient *);
|
||||||
extern void chanfloodtimer_stopchantimers(aChannel *chptr);
|
|
||||||
extern int find_invex(aChannel *chptr, aClient *sptr);
|
extern int find_invex(aChannel *chptr, aClient *sptr);
|
||||||
extern void DoMD5(unsigned char *mdout, const unsigned char *src, unsigned long n);
|
extern void DoMD5(unsigned char *mdout, const unsigned char *src, unsigned long n);
|
||||||
extern char *md5hash(unsigned char *dst, const unsigned char *src, unsigned long n);
|
extern char *md5hash(unsigned char *dst, const unsigned char *src, unsigned long n);
|
||||||
#ifdef JOINTHROTTLE
|
|
||||||
aJFlood *cmodej_addentry(aClient *cptr, aChannel *chptr);
|
|
||||||
void cmodej_delentry(aJFlood *e);
|
|
||||||
void cmodej_deluserentries(aClient *cptr);
|
|
||||||
void cmodej_delchannelentries(aChannel *chptr);
|
|
||||||
#endif
|
|
||||||
extern void charsys_reset(void);
|
extern void charsys_reset(void);
|
||||||
extern void charsys_addmultibyterange(char s1, char e1, char s2, char e2);
|
extern void charsys_addmultibyterange(char s1, char e1, char s2, char e2);
|
||||||
extern void charsys_addallowed(char *s);
|
extern void charsys_addallowed(char *s);
|
||||||
@@ -747,6 +723,13 @@ extern char *unreal_time_synch_error(void);
|
|||||||
extern int unreal_time_synch(int timeout);
|
extern int unreal_time_synch(int timeout);
|
||||||
extern int extban_is_banned_helper(char *buf);
|
extern int extban_is_banned_helper(char *buf);
|
||||||
extern char *getcloak(aClient *sptr);
|
extern char *getcloak(aClient *sptr);
|
||||||
|
extern unsigned char param_to_slot_mapping[256];
|
||||||
|
extern char *cm_getparameter(aChannel *chptr, char mode);
|
||||||
|
extern void cm_putparameter(aChannel *chptr, char mode, char *str);
|
||||||
|
extern void cm_freeparameter(aChannel *chptr, char mode);
|
||||||
|
extern char *cm_getparameter_ex(void **p, char mode);
|
||||||
|
extern void cm_putparameter_ex(void **p, char mode, char *str);
|
||||||
|
extern void cm_freeparameter_ex(void **p, char mode, char *str);
|
||||||
extern void kick_insecure_users(aChannel *);
|
extern void kick_insecure_users(aChannel *);
|
||||||
extern int file_exists(char* file);
|
extern int file_exists(char* file);
|
||||||
extern void free_motd(aMotdFile *motd); /* s_serv.c */
|
extern void free_motd(aMotdFile *motd); /* s_serv.c */
|
||||||
@@ -762,3 +745,4 @@ extern MODVAR char serveropts[];
|
|||||||
extern MODVAR char *IsupportStrings[];
|
extern MODVAR char *IsupportStrings[];
|
||||||
extern void finish_auth(aClient *acptr);
|
extern void finish_auth(aClient *acptr);
|
||||||
extern void read_packet(int fd, int revents, void *data);
|
extern void read_packet(int fd, int revents, void *data);
|
||||||
|
extern void sendto_realops_and_log(char *fmt, ...);
|
||||||
|
|||||||
+51
-24
@@ -9,6 +9,22 @@
|
|||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
|
#define SINLINE static inline
|
||||||
|
#else
|
||||||
|
#define SINLINE static
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#define typeof(x) aClient
|
||||||
|
/* ^ FIXME if/when Microsoft supports this.
|
||||||
|
* All functions use aClient at the moment, with the exception of CAP, which has
|
||||||
|
* to use list_for_each_entry2 because of it
|
||||||
|
* Yeah this looks ugly and hacky.. thanks nenolod for making all code use this
|
||||||
|
* non-portable gcc-specific stuff and violating all our code rules. Once again.
|
||||||
|
*/
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* container_of - cast a member of a structure out to the containing structure
|
* container_of - cast a member of a structure out to the containing structure
|
||||||
* @ptr: the pointer to the member.
|
* @ptr: the pointer to the member.
|
||||||
@@ -38,7 +54,7 @@ struct list_head {
|
|||||||
#define LIST_HEAD(name) \
|
#define LIST_HEAD(name) \
|
||||||
struct list_head name = LIST_HEAD_INIT(name)
|
struct list_head name = LIST_HEAD_INIT(name)
|
||||||
|
|
||||||
static inline void INIT_LIST_HEAD(struct list_head *list)
|
SINLINE void INIT_LIST_HEAD(struct list_head *list)
|
||||||
{
|
{
|
||||||
list->next = list;
|
list->next = list;
|
||||||
list->prev = list;
|
list->prev = list;
|
||||||
@@ -50,7 +66,7 @@ static inline void INIT_LIST_HEAD(struct list_head *list)
|
|||||||
* This is only for internal list manipulation where we know
|
* This is only for internal list manipulation where we know
|
||||||
* the prev/next entries already!
|
* the prev/next entries already!
|
||||||
*/
|
*/
|
||||||
static inline void __list_add(struct list_head *new,
|
SINLINE void __list_add(struct list_head *new,
|
||||||
struct list_head *prev,
|
struct list_head *prev,
|
||||||
struct list_head *next)
|
struct list_head *next)
|
||||||
{
|
{
|
||||||
@@ -68,7 +84,7 @@ static inline void __list_add(struct list_head *new,
|
|||||||
* Insert a new entry after the specified head.
|
* Insert a new entry after the specified head.
|
||||||
* This is good for implementing stacks.
|
* This is good for implementing stacks.
|
||||||
*/
|
*/
|
||||||
static inline void list_add(struct list_head *new, struct list_head *head)
|
SINLINE void list_add(struct list_head *new, struct list_head *head)
|
||||||
{
|
{
|
||||||
__list_add(new, head, head->next);
|
__list_add(new, head, head->next);
|
||||||
}
|
}
|
||||||
@@ -82,7 +98,7 @@ static inline void list_add(struct list_head *new, struct list_head *head)
|
|||||||
* Insert a new entry before the specified head.
|
* Insert a new entry before the specified head.
|
||||||
* This is useful for implementing queues.
|
* This is useful for implementing queues.
|
||||||
*/
|
*/
|
||||||
static inline void list_add_tail(struct list_head *new, struct list_head *head)
|
SINLINE void list_add_tail(struct list_head *new, struct list_head *head)
|
||||||
{
|
{
|
||||||
__list_add(new, head->prev, head);
|
__list_add(new, head->prev, head);
|
||||||
}
|
}
|
||||||
@@ -94,7 +110,7 @@ static inline void list_add_tail(struct list_head *new, struct list_head *head)
|
|||||||
* This is only for internal list manipulation where we know
|
* This is only for internal list manipulation where we know
|
||||||
* the prev/next entries already!
|
* the prev/next entries already!
|
||||||
*/
|
*/
|
||||||
static inline void __list_del(struct list_head * prev, struct list_head * next)
|
SINLINE void __list_del(struct list_head * prev, struct list_head * next)
|
||||||
{
|
{
|
||||||
next->prev = prev;
|
next->prev = prev;
|
||||||
prev->next = next;
|
prev->next = next;
|
||||||
@@ -106,12 +122,12 @@ static inline void __list_del(struct list_head * prev, struct list_head * next)
|
|||||||
* Note: list_empty() on entry does not return true after this, the entry is
|
* Note: list_empty() on entry does not return true after this, the entry is
|
||||||
* in an undefined state.
|
* in an undefined state.
|
||||||
*/
|
*/
|
||||||
static inline void __list_del_entry(struct list_head *entry)
|
SINLINE void __list_del_entry(struct list_head *entry)
|
||||||
{
|
{
|
||||||
__list_del(entry->prev, entry->next);
|
__list_del(entry->prev, entry->next);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void list_del(struct list_head *entry)
|
SINLINE void list_del(struct list_head *entry)
|
||||||
{
|
{
|
||||||
__list_del_entry(entry);
|
__list_del_entry(entry);
|
||||||
INIT_LIST_HEAD(entry);
|
INIT_LIST_HEAD(entry);
|
||||||
@@ -124,7 +140,7 @@ static inline void list_del(struct list_head *entry)
|
|||||||
*
|
*
|
||||||
* If @old was empty, it will be overwritten.
|
* If @old was empty, it will be overwritten.
|
||||||
*/
|
*/
|
||||||
static inline void list_replace(struct list_head *old,
|
SINLINE void list_replace(struct list_head *old,
|
||||||
struct list_head *new)
|
struct list_head *new)
|
||||||
{
|
{
|
||||||
new->next = old->next;
|
new->next = old->next;
|
||||||
@@ -133,7 +149,7 @@ static inline void list_replace(struct list_head *old,
|
|||||||
new->prev->next = new;
|
new->prev->next = new;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void list_replace_init(struct list_head *old,
|
SINLINE void list_replace_init(struct list_head *old,
|
||||||
struct list_head *new)
|
struct list_head *new)
|
||||||
{
|
{
|
||||||
list_replace(old, new);
|
list_replace(old, new);
|
||||||
@@ -144,7 +160,7 @@ static inline void list_replace_init(struct list_head *old,
|
|||||||
* list_del_init - deletes entry from list and reinitialize it.
|
* list_del_init - deletes entry from list and reinitialize it.
|
||||||
* @entry: the element to delete from the list.
|
* @entry: the element to delete from the list.
|
||||||
*/
|
*/
|
||||||
static inline void list_del_init(struct list_head *entry)
|
SINLINE void list_del_init(struct list_head *entry)
|
||||||
{
|
{
|
||||||
__list_del_entry(entry);
|
__list_del_entry(entry);
|
||||||
INIT_LIST_HEAD(entry);
|
INIT_LIST_HEAD(entry);
|
||||||
@@ -155,7 +171,7 @@ static inline void list_del_init(struct list_head *entry)
|
|||||||
* @list: the entry to move
|
* @list: the entry to move
|
||||||
* @head: the head that will precede our entry
|
* @head: the head that will precede our entry
|
||||||
*/
|
*/
|
||||||
static inline void list_move(struct list_head *list, struct list_head *head)
|
SINLINE void list_move(struct list_head *list, struct list_head *head)
|
||||||
{
|
{
|
||||||
__list_del_entry(list);
|
__list_del_entry(list);
|
||||||
list_add(list, head);
|
list_add(list, head);
|
||||||
@@ -166,7 +182,7 @@ static inline void list_move(struct list_head *list, struct list_head *head)
|
|||||||
* @list: the entry to move
|
* @list: the entry to move
|
||||||
* @head: the head that will follow our entry
|
* @head: the head that will follow our entry
|
||||||
*/
|
*/
|
||||||
static inline void list_move_tail(struct list_head *list,
|
SINLINE void list_move_tail(struct list_head *list,
|
||||||
struct list_head *head)
|
struct list_head *head)
|
||||||
{
|
{
|
||||||
__list_del_entry(list);
|
__list_del_entry(list);
|
||||||
@@ -178,7 +194,7 @@ static inline void list_move_tail(struct list_head *list,
|
|||||||
* @list: the entry to test
|
* @list: the entry to test
|
||||||
* @head: the head of the list
|
* @head: the head of the list
|
||||||
*/
|
*/
|
||||||
static inline int list_is_last(const struct list_head *list,
|
SINLINE int list_is_last(const struct list_head *list,
|
||||||
const struct list_head *head)
|
const struct list_head *head)
|
||||||
{
|
{
|
||||||
return list->next == head;
|
return list->next == head;
|
||||||
@@ -188,7 +204,7 @@ static inline int list_is_last(const struct list_head *list,
|
|||||||
* list_empty - tests whether a list is empty
|
* list_empty - tests whether a list is empty
|
||||||
* @head: the list to test.
|
* @head: the list to test.
|
||||||
*/
|
*/
|
||||||
static inline int list_empty(const struct list_head *head)
|
SINLINE int list_empty(const struct list_head *head)
|
||||||
{
|
{
|
||||||
return head->next == head;
|
return head->next == head;
|
||||||
}
|
}
|
||||||
@@ -206,7 +222,7 @@ static inline int list_empty(const struct list_head *head)
|
|||||||
* to the list entry is list_del_init(). Eg. it cannot be used
|
* to the list entry is list_del_init(). Eg. it cannot be used
|
||||||
* if another CPU could re-list_add() it.
|
* if another CPU could re-list_add() it.
|
||||||
*/
|
*/
|
||||||
static inline int list_empty_careful(const struct list_head *head)
|
SINLINE int list_empty_careful(const struct list_head *head)
|
||||||
{
|
{
|
||||||
struct list_head *next = head->next;
|
struct list_head *next = head->next;
|
||||||
return (next == head) && (next == head->prev);
|
return (next == head) && (next == head->prev);
|
||||||
@@ -216,7 +232,7 @@ static inline int list_empty_careful(const struct list_head *head)
|
|||||||
* list_rotate_left - rotate the list to the left
|
* list_rotate_left - rotate the list to the left
|
||||||
* @head: the head of the list
|
* @head: the head of the list
|
||||||
*/
|
*/
|
||||||
static inline void list_rotate_left(struct list_head *head)
|
SINLINE void list_rotate_left(struct list_head *head)
|
||||||
{
|
{
|
||||||
struct list_head *first;
|
struct list_head *first;
|
||||||
|
|
||||||
@@ -230,12 +246,12 @@ static inline void list_rotate_left(struct list_head *head)
|
|||||||
* list_is_singular - tests whether a list has just one entry.
|
* list_is_singular - tests whether a list has just one entry.
|
||||||
* @head: the list to test.
|
* @head: the list to test.
|
||||||
*/
|
*/
|
||||||
static inline int list_is_singular(const struct list_head *head)
|
SINLINE int list_is_singular(const struct list_head *head)
|
||||||
{
|
{
|
||||||
return !list_empty(head) && (head->next == head->prev);
|
return !list_empty(head) && (head->next == head->prev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void __list_cut_position(struct list_head *list,
|
SINLINE void __list_cut_position(struct list_head *list,
|
||||||
struct list_head *head, struct list_head *entry)
|
struct list_head *head, struct list_head *entry)
|
||||||
{
|
{
|
||||||
struct list_head *new_first = entry->next;
|
struct list_head *new_first = entry->next;
|
||||||
@@ -261,7 +277,7 @@ static inline void __list_cut_position(struct list_head *list,
|
|||||||
* losing its data.
|
* losing its data.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static inline void list_cut_position(struct list_head *list,
|
SINLINE void list_cut_position(struct list_head *list,
|
||||||
struct list_head *head, struct list_head *entry)
|
struct list_head *head, struct list_head *entry)
|
||||||
{
|
{
|
||||||
if (list_empty(head))
|
if (list_empty(head))
|
||||||
@@ -275,7 +291,7 @@ static inline void list_cut_position(struct list_head *list,
|
|||||||
__list_cut_position(list, head, entry);
|
__list_cut_position(list, head, entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void __list_splice(const struct list_head *list,
|
SINLINE void __list_splice(const struct list_head *list,
|
||||||
struct list_head *prev,
|
struct list_head *prev,
|
||||||
struct list_head *next)
|
struct list_head *next)
|
||||||
{
|
{
|
||||||
@@ -294,7 +310,7 @@ static inline void __list_splice(const struct list_head *list,
|
|||||||
* @list: the new list to add.
|
* @list: the new list to add.
|
||||||
* @head: the place to add it in the first list.
|
* @head: the place to add it in the first list.
|
||||||
*/
|
*/
|
||||||
static inline void list_splice(const struct list_head *list,
|
SINLINE void list_splice(const struct list_head *list,
|
||||||
struct list_head *head)
|
struct list_head *head)
|
||||||
{
|
{
|
||||||
if (!list_empty(list))
|
if (!list_empty(list))
|
||||||
@@ -306,7 +322,7 @@ static inline void list_splice(const struct list_head *list,
|
|||||||
* @list: the new list to add.
|
* @list: the new list to add.
|
||||||
* @head: the place to add it in the first list.
|
* @head: the place to add it in the first list.
|
||||||
*/
|
*/
|
||||||
static inline void list_splice_tail(struct list_head *list,
|
SINLINE void list_splice_tail(struct list_head *list,
|
||||||
struct list_head *head)
|
struct list_head *head)
|
||||||
{
|
{
|
||||||
if (!list_empty(list))
|
if (!list_empty(list))
|
||||||
@@ -320,7 +336,7 @@ static inline void list_splice_tail(struct list_head *list,
|
|||||||
*
|
*
|
||||||
* The list at @list is reinitialised
|
* The list at @list is reinitialised
|
||||||
*/
|
*/
|
||||||
static inline void list_splice_init(struct list_head *list,
|
SINLINE void list_splice_init(struct list_head *list,
|
||||||
struct list_head *head)
|
struct list_head *head)
|
||||||
{
|
{
|
||||||
if (!list_empty(list)) {
|
if (!list_empty(list)) {
|
||||||
@@ -337,7 +353,7 @@ static inline void list_splice_init(struct list_head *list,
|
|||||||
* Each of the lists is a queue.
|
* Each of the lists is a queue.
|
||||||
* The list at @list is reinitialised
|
* The list at @list is reinitialised
|
||||||
*/
|
*/
|
||||||
static inline void list_splice_tail_init(struct list_head *list,
|
SINLINE void list_splice_tail_init(struct list_head *list,
|
||||||
struct list_head *head)
|
struct list_head *head)
|
||||||
{
|
{
|
||||||
if (!list_empty(list)) {
|
if (!list_empty(list)) {
|
||||||
@@ -425,6 +441,17 @@ static inline void list_splice_tail_init(struct list_head *list,
|
|||||||
&pos->member != (head); \
|
&pos->member != (head); \
|
||||||
pos = list_entry(pos->member.next, typeof(*pos), member))
|
pos = list_entry(pos->member.next, typeof(*pos), member))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* list_for_each_entry - iterate over list of given type
|
||||||
|
* @pos: the type * to use as a loop cursor.
|
||||||
|
* @head: the head for your list.
|
||||||
|
* @member: the name of the list_struct within the struct.
|
||||||
|
*/
|
||||||
|
#define list_for_each_entry2(pos, tpe, head, member) \
|
||||||
|
for (pos = list_entry((head)->next, tpe, member); \
|
||||||
|
&pos->member != (head); \
|
||||||
|
pos = list_entry(pos->member.next, tpe, member))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* list_for_each_entry_reverse - iterate backwards over list of given type.
|
* list_for_each_entry_reverse - iterate backwards over list of given type.
|
||||||
* @pos: the type * to use as a loop cursor.
|
* @pos: the type * to use as a loop cursor.
|
||||||
|
|||||||
@@ -39,6 +39,10 @@
|
|||||||
#ifndef TOR_MEMPOOL_H
|
#ifndef TOR_MEMPOOL_H
|
||||||
#define TOR_MEMPOOL_H
|
#define TOR_MEMPOOL_H
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#define uint64_t unsigned __int64
|
||||||
|
#endif
|
||||||
|
|
||||||
/** A memory pool is a context in which a large number of fixed-sized
|
/** A memory pool is a context in which a large number of fixed-sized
|
||||||
* objects can be allocated efficiently. See mempool.c for implementation
|
* objects can be allocated efficiently. See mempool.c for implementation
|
||||||
* details. */
|
* details. */
|
||||||
|
|||||||
+59
-35
@@ -135,6 +135,7 @@ typedef struct {
|
|||||||
#define EXSJ_SAME 0 /* Parameters are the same */
|
#define EXSJ_SAME 0 /* Parameters are the same */
|
||||||
#define EXSJ_WEWON 1 /* We won! w00t */
|
#define EXSJ_WEWON 1 /* We won! w00t */
|
||||||
#define EXSJ_THEYWON 2 /* They won :( */
|
#define EXSJ_THEYWON 2 /* They won :( */
|
||||||
|
#define EXSJ_MERGE 3 /* Merging of modes.. neither won nor lost (merged params are in 'our' on return) */
|
||||||
|
|
||||||
/* return values for EXCHK_ACCESS*: */
|
/* return values for EXCHK_ACCESS*: */
|
||||||
#define EX_DENY 0 /* Disallowed, except in case of operoverride */
|
#define EX_DENY 0 /* Disallowed, except in case of operoverride */
|
||||||
@@ -149,13 +150,6 @@ typedef struct {
|
|||||||
*/
|
*/
|
||||||
typedef unsigned long Cmode_t;
|
typedef unsigned long Cmode_t;
|
||||||
|
|
||||||
#define EXTCM_PAR_HEADER struct _CmodeParam *prev, *next; char flag;
|
|
||||||
|
|
||||||
typedef struct _CmodeParam {
|
|
||||||
EXTCM_PAR_HEADER
|
|
||||||
/** other fields are placed after this header in your own paramstruct */
|
|
||||||
} CmodeParam;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/** mode character (like 'Z') */
|
/** mode character (like 'Z') */
|
||||||
char flag;
|
char flag;
|
||||||
@@ -174,7 +168,7 @@ typedef struct {
|
|||||||
* int: what (MODE_ADD or MODE_DEL)
|
* int: what (MODE_ADD or MODE_DEL)
|
||||||
* return value: 1=ok, 0=bad
|
* return value: 1=ok, 0=bad
|
||||||
*/
|
*/
|
||||||
int (*is_ok)(aClient *,aChannel *, char *para, int, int);
|
int (*is_ok)(aClient *,aChannel *, char mode, char *para, int, int);
|
||||||
|
|
||||||
/** NOTE: The routines below are NULL for paramless modes */
|
/** NOTE: The routines below are NULL for paramless modes */
|
||||||
|
|
||||||
@@ -185,32 +179,36 @@ typedef struct {
|
|||||||
* design notes: only alloc a new paramstruct if you need to, search for
|
* design notes: only alloc a new paramstruct if you need to, search for
|
||||||
* any current one first (like in case of mode +y 5 and then +y 6 later without -y).
|
* any current one first (like in case of mode +y 5 and then +y 6 later without -y).
|
||||||
*/
|
*/
|
||||||
CmodeParam * (*put_param)(CmodeParam *, char *);
|
void * (*put_param)(void *, char *);
|
||||||
|
|
||||||
/** Get readable string version" of the stored parameter.
|
/** Get readable string version" of the stored parameter.
|
||||||
* aExtCMtableParam *: the list (usually chptr->mode.extmodeparams).
|
* aExtCMtableParam *: the list (usually chptr->mode.extmodeparams).
|
||||||
* return value: a pointer to the string (temp. storage)
|
* return value: a pointer to the string (temp. storage)
|
||||||
*/
|
*/
|
||||||
char * (*get_param)(CmodeParam *);
|
char * (*get_param)(void *);
|
||||||
|
|
||||||
/** Convert input parameter to output.
|
/** Convert input parameter to output.
|
||||||
* Like +l "1aaa" becomes "1".
|
* Like +l "1aaa" becomes "1".
|
||||||
* char *: the input parameter.
|
* char *: the input parameter.
|
||||||
|
* aClient *: the client that the mode request came from:
|
||||||
|
* 1. Can be NULL (eg: if called for set::modes-on-join
|
||||||
|
* 2. Probably only used in rare cases, see also next remark
|
||||||
|
* 3. ERRORS SHOULD NOT BE SENT BY conv_param BUT BY is_ok!
|
||||||
* return value: pointer to output string (temp. storage)
|
* return value: pointer to output string (temp. storage)
|
||||||
*/
|
*/
|
||||||
char * (*conv_param)(char *);
|
char * (*conv_param)(char *, aClient *);
|
||||||
|
|
||||||
/** free and remove parameter from list.
|
/** free and remove parameter from list.
|
||||||
* aExtCMtableParam *: the list (usually chptr->mode.extmodeparams).
|
* aExtCMtableParam *: the list (usually chptr->mode.extmodeparams).
|
||||||
*/
|
*/
|
||||||
void (*free_param)(CmodeParam *);
|
void (*free_param)(void *);
|
||||||
|
|
||||||
/** duplicate a struct and return a pointer to duplicate.
|
/** duplicate a struct and return a pointer to duplicate.
|
||||||
* This is usually just a malloc + memcpy.
|
* This is usually just a malloc + memcpy.
|
||||||
* aExtCMtableParam *: source struct itself (no list).
|
* aExtCMtableParam *: source struct itself (no list).
|
||||||
* return value: pointer to newly allocated struct.
|
* return value: pointer to newly allocated struct.
|
||||||
*/
|
*/
|
||||||
CmodeParam * (*dup_struct)(CmodeParam *);
|
void * (*dup_struct)(void *);
|
||||||
|
|
||||||
/** Compares 2 parameters and decides who wins the sjoin fight.
|
/** Compares 2 parameters and decides who wins the sjoin fight.
|
||||||
* When syncing channel modes (m_sjoin) a parameter conflict may occur, things like
|
* When syncing channel modes (m_sjoin) a parameter conflict may occur, things like
|
||||||
@@ -221,10 +219,13 @@ typedef struct {
|
|||||||
* aExtCMtableParam *: our parameter
|
* aExtCMtableParam *: our parameter
|
||||||
* aExtCMtableParam *: their parameter
|
* aExtCMtableParam *: their parameter
|
||||||
*/
|
*/
|
||||||
int (*sjoin_check)(aChannel *, CmodeParam *, CmodeParam *);
|
int (*sjoin_check)(aChannel *, void *, void *);
|
||||||
|
|
||||||
/** Local channel mode? Prevents remote servers from setting/unsetting this */
|
/** Local channel mode? Prevents remote servers from setting/unsetting this */
|
||||||
char local;
|
char local;
|
||||||
|
|
||||||
|
/** Unsetting also eats/requires a parameter. Unusual, but possible. */
|
||||||
|
char unset_with_param;
|
||||||
|
|
||||||
/** Is this mode being unloaded?
|
/** Is this mode being unloaded?
|
||||||
* This is set to 1 if the chanmode module providing this mode is unloaded
|
* This is set to 1 if the chanmode module providing this mode is unloaded
|
||||||
@@ -234,6 +235,9 @@ typedef struct {
|
|||||||
*/
|
*/
|
||||||
char unloaded;
|
char unloaded;
|
||||||
|
|
||||||
|
/* Slot#.. Can be used instead of GETPARAMSLOT() */
|
||||||
|
int slot;
|
||||||
|
|
||||||
/** Module owner */
|
/** Module owner */
|
||||||
Module *owner;
|
Module *owner;
|
||||||
} Cmode;
|
} Cmode;
|
||||||
@@ -241,16 +245,36 @@ typedef struct {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
char flag;
|
char flag;
|
||||||
int paracount;
|
int paracount;
|
||||||
int (*is_ok)(aClient *,aChannel *, char *para, int, int);
|
int (*is_ok)(aClient *,aChannel *, char mode, char *para, int, int);
|
||||||
CmodeParam * (*put_param)(CmodeParam *, char *);
|
void * (*put_param)(void *, char *);
|
||||||
char * (*get_param)(CmodeParam *);
|
char * (*get_param)(void *);
|
||||||
char * (*conv_param)(char *);
|
char * (*conv_param)(char *, aClient *);
|
||||||
void (*free_param)(CmodeParam *);
|
void (*free_param)(void *);
|
||||||
CmodeParam * (*dup_struct)(CmodeParam *);
|
void * (*dup_struct)(void *);
|
||||||
int (*sjoin_check)(aChannel *, CmodeParam *, CmodeParam *);
|
int (*sjoin_check)(aChannel *, void *, void *);
|
||||||
char local;
|
char local;
|
||||||
|
char unset_with_param;
|
||||||
} CmodeInfo;
|
} CmodeInfo;
|
||||||
|
|
||||||
|
/* Get a slot# for a param.. eg... GETPARAMSLOT('k') ;p */
|
||||||
|
#define GETPARAMSLOT(x) param_to_slot_mapping[x]
|
||||||
|
|
||||||
|
/* Get a cmode handler by slot.. for example for [dont use this]: GETPARAMHANDLERBYSLOT(5)->get_param(chptr) */
|
||||||
|
#define GETPARAMHANDLERBYSLOT(slotid) ParamTable[slotid]
|
||||||
|
|
||||||
|
/* Same as GETPARAMHANDLERBYSLOT but then by letter.. like [dont use this]: GETPARAMHANDLERBYSLOT('k')->get_param(chptr) */
|
||||||
|
#define GETPARAMHANDLERBYLETTER(x) ParamTable[GETPARAMSLOT(x)]
|
||||||
|
|
||||||
|
/* Get paramter data struct.. for like: ((aModejEntry *)GETPARASTRUCT(chptr, 'j'))->t */
|
||||||
|
#define GETPARASTRUCT(mychptr, mychar) chptr->mode.extmodeparams[GETPARAMSLOT(mychar)]
|
||||||
|
|
||||||
|
#define GETPARASTRUCTEX(v, mychar) v[GETPARAMSLOT(mychar)]
|
||||||
|
|
||||||
|
#define CMP_GETSLOT(x) GETPARAMSLOT(x)
|
||||||
|
#define CMP_GETHANDLERBYSLOT(x) GETPARAMHANDLERBYSLOT(x)
|
||||||
|
#define CMP_GETHANDLERBYLETTER(x) GETPARAMHANDLERBYLETTER(x)
|
||||||
|
#define CMP_GETSTRUCT(x,y) GETPARASTRUCT(x,y)
|
||||||
|
|
||||||
/*** Extended bans ***/
|
/*** Extended bans ***/
|
||||||
|
|
||||||
#define EXBCHK_ACCESS 0 /* Check access */
|
#define EXBCHK_ACCESS 0 /* Check access */
|
||||||
@@ -415,7 +439,7 @@ struct _hooktype {
|
|||||||
unsigned int ModuleGetError(Module *module);
|
unsigned int ModuleGetError(Module *module);
|
||||||
const char *ModuleGetErrorStr(Module *module);
|
const char *ModuleGetErrorStr(Module *module);
|
||||||
unsigned int ModuleGetOptions(Module *module);
|
unsigned int ModuleGetOptions(Module *module);
|
||||||
unsigned int ModuleSetOptions(Module *module, unsigned int options);
|
unsigned int ModuleSetOptions(Module *module, unsigned int options, int action);
|
||||||
|
|
||||||
struct _Module
|
struct _Module
|
||||||
{
|
{
|
||||||
@@ -447,22 +471,13 @@ struct _Module
|
|||||||
|
|
||||||
struct _mod_symboltable
|
struct _mod_symboltable
|
||||||
{
|
{
|
||||||
#ifndef STATIC_LINKING
|
|
||||||
char *symbol;
|
char *symbol;
|
||||||
#else
|
|
||||||
void *realfunc;
|
|
||||||
#endif
|
|
||||||
vFP *pointer;
|
vFP *pointer;
|
||||||
#ifndef STATIC_LINKING
|
|
||||||
char *module;
|
char *module;
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef STATIC_LINKING
|
|
||||||
#define MOD_Dep(name, container,module) {#name, (vFP *) &container, module}
|
#define MOD_Dep(name, container,module) {#name, (vFP *) &container, module}
|
||||||
#else
|
|
||||||
#define MOD_Dep(name, container,module) {(void *)&name, (vFP *) &container}
|
|
||||||
#endif
|
|
||||||
/* Event structs */
|
/* Event structs */
|
||||||
struct _event {
|
struct _event {
|
||||||
Event *prev, *next;
|
Event *prev, *next;
|
||||||
@@ -661,6 +676,18 @@ int CallCmdoverride(Cmdoverride *ovr, aClient *cptr, aClient *sptr, int parc, ch
|
|||||||
#define HOOKTYPE_AWAY 53
|
#define HOOKTYPE_AWAY 53
|
||||||
#define HOOKTYPE_CAPLIST 54
|
#define HOOKTYPE_CAPLIST 54
|
||||||
#define HOOKTYPE_INVITE 55
|
#define HOOKTYPE_INVITE 55
|
||||||
|
#define HOOKTYPE_CAN_JOIN 56
|
||||||
|
#define HOOKTYPE_CAN_SEND 57
|
||||||
|
#define HOOKTYPE_CAN_KICK 58
|
||||||
|
#define HOOKTYPE_FREE_CLIENT 59
|
||||||
|
#define HOOKTYPE_FREE_USER 60
|
||||||
|
#define HOOKTYPE_PRE_CHANMSG 61
|
||||||
|
#define HOOKTYPE_PRE_USERMSG 62
|
||||||
|
#define HOOKTYPE_KNOCK 63
|
||||||
|
#define HOOKTYPE_MODECHAR_ADD 64
|
||||||
|
#define HOOKTYPE_MODECHAR_DEL 65
|
||||||
|
#define HOOKTYPE_EXIT_ONE_CLIENT 66
|
||||||
|
#define HOOKTYPE_CAN_JOIN_LIMITEXCEEDED 67
|
||||||
|
|
||||||
/* Hook return values */
|
/* Hook return values */
|
||||||
#define HOOK_CONTINUE 0
|
#define HOOK_CONTINUE 0
|
||||||
@@ -700,9 +727,6 @@ int CallCmdoverride(Cmdoverride *ovr, aClient *cptr, aClient *sptr, int parc, ch
|
|||||||
#define EFUNC_DOSPAMFILTER_VIRUSCHAN 25
|
#define EFUNC_DOSPAMFILTER_VIRUSCHAN 25
|
||||||
#define EFUNC_FIND_TKLINE_MATCH_ZAP_EX 26
|
#define EFUNC_FIND_TKLINE_MATCH_ZAP_EX 26
|
||||||
#define EFUNC_SEND_LIST 27
|
#define EFUNC_SEND_LIST 27
|
||||||
#define EFUNC_STRIPBADWORDS_CHANNEL 28
|
|
||||||
#define EFUNC_STRIPBADWORDS_MESSAGE 29
|
|
||||||
#define EFUNC_STRIPBADWORDS_QUIT 30
|
|
||||||
#define EFUNC_STRIPCOLORS 31
|
#define EFUNC_STRIPCOLORS 31
|
||||||
#define EFUNC_STRIPCONTROLCODES 32
|
#define EFUNC_STRIPCONTROLCODES 32
|
||||||
#define EFUNC_SPAMFILTER_BUILD_USER_STRING 33
|
#define EFUNC_SPAMFILTER_BUILD_USER_STRING 33
|
||||||
|
|||||||
@@ -44,11 +44,6 @@
|
|||||||
#else
|
#else
|
||||||
#define MYTOKEN_SSL ""
|
#define MYTOKEN_SSL ""
|
||||||
#endif
|
#endif
|
||||||
#if !defined(JOINTHROTTLE)
|
|
||||||
#define MYTOKEN_JOINTHROTTLE "/NOJTHR"
|
|
||||||
#else
|
|
||||||
#define MYTOKEN_JOINTHROTTLE ""
|
|
||||||
#endif
|
|
||||||
#if !defined(NO_FLOOD_AWAY)
|
#if !defined(NO_FLOOD_AWAY)
|
||||||
#define MYTOKEN_NOFLDAWAY "/NONFA"
|
#define MYTOKEN_NOFLDAWAY "/NONFA"
|
||||||
#else
|
#else
|
||||||
@@ -74,12 +69,12 @@
|
|||||||
|
|
||||||
#ifdef UNREALCORE
|
#ifdef UNREALCORE
|
||||||
char our_mod_version[] = BASE_VERSION PATCH1 PATCH2 PATCH3 PATCH4 PATCH6 PATCH7 PATCH8 PATCH9 \
|
char our_mod_version[] = BASE_VERSION PATCH1 PATCH2 PATCH3 PATCH4 PATCH6 PATCH7 PATCH8 PATCH9 \
|
||||||
MYTOKEN_SSL MYTOKEN_JOINTHROTTLE \
|
MYTOKEN_SSL \
|
||||||
MYTOKEN_NOFLDAWAY MYTOKEN_NEWCHF MYTOKEN_INET6;
|
MYTOKEN_NOFLDAWAY MYTOKEN_NEWCHF MYTOKEN_INET6;
|
||||||
unsigned int our_compiler_version = GCCVER;
|
unsigned int our_compiler_version = GCCVER;
|
||||||
#else
|
#else
|
||||||
DLLFUNC char Mod_Version[] = BASE_VERSION PATCH1 PATCH2 PATCH3 PATCH4 PATCH6 PATCH7 PATCH8 PATCH9 \
|
DLLFUNC char Mod_Version[] = BASE_VERSION PATCH1 PATCH2 PATCH3 PATCH4 PATCH6 PATCH7 PATCH8 PATCH9 \
|
||||||
MYTOKEN_SSL MYTOKEN_JOINTHROTTLE \
|
MYTOKEN_SSL \
|
||||||
MYTOKEN_NOFLDAWAY MYTOKEN_NEWCHF MYTOKEN_INET6;
|
MYTOKEN_NOFLDAWAY MYTOKEN_NEWCHF MYTOKEN_INET6;
|
||||||
DLLFUNC unsigned int compiler_version = GCCVER;
|
DLLFUNC unsigned int compiler_version = GCCVER;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+28
-27
@@ -23,56 +23,57 @@
|
|||||||
#ifndef proto_h
|
#ifndef proto_h
|
||||||
#define proto_h
|
#define proto_h
|
||||||
/* channel.c */
|
/* channel.c */
|
||||||
int sendmodeto_one(aClient *cptr, char *from, char *name, char *mode, char *param, TS creationtime);
|
extern int sendmodeto_one(aClient *cptr, char *from, char *name, char *mode, char *param, TS creationtime);
|
||||||
void make_cmodestr(void);
|
extern void make_cmodestr(void);
|
||||||
|
|
||||||
/* lusers.c */
|
/* lusers.c */
|
||||||
void init_ircstats(void);
|
extern void init_ircstats(void);
|
||||||
|
|
||||||
/* match.c */
|
/* match.c */
|
||||||
char *collapse(char *pattern);
|
extern char *collapse(char *pattern);
|
||||||
|
|
||||||
/* scache.c */
|
/* scache.c */
|
||||||
void clear_scache_hash_table(void);
|
extern void clear_scache_hash_table(void);
|
||||||
|
|
||||||
/* send.c */
|
/* send.c */
|
||||||
void sendto_one(aClient *, char *, ...) __attribute__((format(printf,2,3)));
|
extern void sendto_one(aClient *, char *, ...) __attribute__((format(printf,2,3)));
|
||||||
void sendto_chanops_butone(aClient *one, aChannel *chptr, char *pattern, ...) __attribute__((format(printf,3,4)));
|
extern void sendto_chanops_butone(aClient *one, aChannel *chptr, char *pattern, ...) __attribute__((format(printf,3,4)));
|
||||||
void sendto_realops(char *pattern, ...) __attribute__((format(printf,1,2)));
|
extern void sendto_realops(char *pattern, ...) __attribute__((format(printf,1,2)));
|
||||||
void sendto_channel_ntadmins(aClient *from, aChannel *chptr, char *pattern, ...) __attribute__((format(printf,3,4)));
|
extern void sendto_channel_ntadmins(aClient *from, aChannel *chptr, char *pattern, ...) __attribute__((format(printf,3,4)));
|
||||||
|
|
||||||
/* fdlist.c */
|
/* fdlist.c */
|
||||||
EVENT(lcf_check);
|
extern EVENT(lcf_check);
|
||||||
EVENT(htm_calc);
|
extern EVENT(htm_calc);
|
||||||
/* ircd.c */
|
/* ircd.c */
|
||||||
EVENT(garbage_collect);
|
extern EVENT(garbage_collect);
|
||||||
EVENT(loop_event);
|
extern EVENT(loop_event);
|
||||||
EVENT(check_pings);
|
extern EVENT(check_pings);
|
||||||
EVENT(check_unknowns);
|
extern EVENT(check_unknowns);
|
||||||
EVENT(try_connections);
|
extern EVENT(check_deadsockets);
|
||||||
|
extern EVENT(try_connections);
|
||||||
/* support.c */
|
/* support.c */
|
||||||
char *my_itoa(int i);
|
extern char *my_itoa(int i);
|
||||||
|
|
||||||
/* s_serv.c */
|
/* s_serv.c */
|
||||||
void load_tunefile(void);
|
extern void load_tunefile(void);
|
||||||
extern EVENT(save_tunefile);
|
extern EVENT(save_tunefile);
|
||||||
extern void read_motd(const char *filename, aMotdFile *motd);
|
extern void read_motd(const char *filename, aMotdFile *motd);
|
||||||
|
|
||||||
/* s_user.c */
|
/* s_user.c */
|
||||||
int check_for_target_limit(aClient *sptr, void *target, const char *name);
|
extern int check_for_target_limit(aClient *sptr, void *target, const char *name);
|
||||||
void make_umodestr(void);
|
extern void make_umodestr(void);
|
||||||
|
|
||||||
/* webtv.c */
|
/* webtv.c */
|
||||||
int is_halfop(aClient *cptr, aChannel *chptr);
|
extern int is_halfop(aClient *cptr, aChannel *chptr);
|
||||||
int is_chanprot(aClient *cptr, aChannel *chptr);
|
extern int is_chanprot(aClient *cptr, aChannel *chptr);
|
||||||
char *convert_time(time_t ltime);
|
extern char *convert_time(time_t ltime);
|
||||||
char *get_mode_str(aClient *acptr);
|
extern char *get_mode_str(aClient *acptr);
|
||||||
|
|
||||||
/* whowas.c */
|
/* whowas.c */
|
||||||
void initwhowas(void);
|
extern void initwhowas(void);
|
||||||
|
|
||||||
/* uid.c */
|
/* uid.c */
|
||||||
void uid_init(void);
|
extern void uid_init(void);
|
||||||
const char *uid_get(void);
|
extern const char *uid_get(void);
|
||||||
|
|
||||||
#endif /* proto_h */
|
#endif /* proto_h */
|
||||||
|
|||||||
+15
-75
@@ -106,7 +106,6 @@ typedef struct _configitem_except ConfigItem_except;
|
|||||||
typedef struct _configitem_link ConfigItem_link;
|
typedef struct _configitem_link ConfigItem_link;
|
||||||
typedef struct _configitem_cgiirc ConfigItem_cgiirc;
|
typedef struct _configitem_cgiirc ConfigItem_cgiirc;
|
||||||
typedef struct _configitem_ban ConfigItem_ban;
|
typedef struct _configitem_ban ConfigItem_ban;
|
||||||
typedef struct _configitem_badword ConfigItem_badword;
|
|
||||||
typedef struct _configitem_deny_dcc ConfigItem_deny_dcc;
|
typedef struct _configitem_deny_dcc ConfigItem_deny_dcc;
|
||||||
typedef struct _configitem_deny_link ConfigItem_deny_link;
|
typedef struct _configitem_deny_link ConfigItem_deny_link;
|
||||||
typedef struct _configitem_deny_channel ConfigItem_deny_channel;
|
typedef struct _configitem_deny_channel ConfigItem_deny_channel;
|
||||||
@@ -133,8 +132,6 @@ typedef struct Server aServer;
|
|||||||
typedef struct SLink Link;
|
typedef struct SLink Link;
|
||||||
typedef struct SBan Ban;
|
typedef struct SBan Ban;
|
||||||
typedef struct SMode Mode;
|
typedef struct SMode Mode;
|
||||||
typedef struct SChanFloodProt ChanFloodProt;
|
|
||||||
typedef struct SRemoveFld RemoveFld;
|
|
||||||
typedef struct ListOptions LOpts;
|
typedef struct ListOptions LOpts;
|
||||||
typedef struct FloodOpt aFloodOpt;
|
typedef struct FloodOpt aFloodOpt;
|
||||||
typedef struct Motd aMotdFile; /* represents a whole MOTD, including remote MOTD support info */
|
typedef struct Motd aMotdFile; /* represents a whole MOTD, including remote MOTD support info */
|
||||||
@@ -201,7 +198,7 @@ typedef unsigned int u_int32_t; /* XXX Hope this works! */
|
|||||||
#define LOG_CHGCMDS 0x0100
|
#define LOG_CHGCMDS 0x0100
|
||||||
#define LOG_OVERRIDE 0x0200
|
#define LOG_OVERRIDE 0x0200
|
||||||
#define LOG_SPAMFILTER 0x0400
|
#define LOG_SPAMFILTER 0x0400
|
||||||
|
#define LOG_DBG 0x0800 /* fixme */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** 'offsetof' is defined in ANSI-C. The following definition
|
** 'offsetof' is defined in ANSI-C. The following definition
|
||||||
@@ -358,9 +355,6 @@ typedef unsigned int u_int32_t; /* XXX Hope this works! */
|
|||||||
#define IsHelpOp(x) ((x)->umodes & UMODE_HELPOP)
|
#define IsHelpOp(x) ((x)->umodes & UMODE_HELPOP)
|
||||||
#define IsAdmin(x) ((x)->umodes & UMODE_ADMIN)
|
#define IsAdmin(x) ((x)->umodes & UMODE_ADMIN)
|
||||||
|
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
#define IsFilteringWords(x) ((x)->umodes & UMODE_STRIPBADWORDS)
|
|
||||||
#endif
|
|
||||||
#define IsNetAdmin(x) ((x)->umodes & UMODE_NETADMIN)
|
#define IsNetAdmin(x) ((x)->umodes & UMODE_NETADMIN)
|
||||||
#define IsCoAdmin(x) ((x)->umodes & UMODE_COADMIN)
|
#define IsCoAdmin(x) ((x)->umodes & UMODE_COADMIN)
|
||||||
#define IsSAdmin(x) ((x)->umodes & UMODE_SADMIN)
|
#define IsSAdmin(x) ((x)->umodes & UMODE_SADMIN)
|
||||||
@@ -373,7 +367,6 @@ typedef unsigned int u_int32_t; /* XXX Hope this works! */
|
|||||||
#define IsARegNick(x) ((x)->umodes & (UMODE_REGNICK))
|
#define IsARegNick(x) ((x)->umodes & (UMODE_REGNICK))
|
||||||
#define IsRegNick(x) ((x)->umodes & UMODE_REGNICK)
|
#define IsRegNick(x) ((x)->umodes & UMODE_REGNICK)
|
||||||
#define IsRegNickMsg(x) ((x)->umodes & UMODE_RGSTRONLY)
|
#define IsRegNickMsg(x) ((x)->umodes & UMODE_RGSTRONLY)
|
||||||
#define IsNoCTCP(x) ((x)->umodes & UMODE_NOCTCP)
|
|
||||||
#define IsPerson(x) ((x)->user && IsClient(x))
|
#define IsPerson(x) ((x)->user && IsClient(x))
|
||||||
#define IsPrivileged(x) (IsAnOper(x) || IsServer(x))
|
#define IsPrivileged(x) (IsAnOper(x) || IsServer(x))
|
||||||
#define SendWallops(x) (!IsMe(x) && IsPerson(x) && ((x)->umodes & UMODE_WALLOP))
|
#define SendWallops(x) (!IsMe(x) && IsPerson(x) && ((x)->umodes & UMODE_WALLOP))
|
||||||
@@ -789,9 +782,7 @@ struct User {
|
|||||||
unsigned char away_c; /* number of times away has been set */
|
unsigned char away_c; /* number of times away has been set */
|
||||||
#endif
|
#endif
|
||||||
} flood;
|
} flood;
|
||||||
#ifdef JOINTHROTTLE
|
aJFlood *jflood; /* TODO: move to dynamic modular storage */
|
||||||
aJFlood *jflood;
|
|
||||||
#endif
|
|
||||||
TS lastaway;
|
TS lastaway;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -912,16 +903,9 @@ extern void SnomaskDel(Snomask *sno);
|
|||||||
extern Cmode *CmodeAdd(Module *reserved, CmodeInfo req, Cmode_t *mode);
|
extern Cmode *CmodeAdd(Module *reserved, CmodeInfo req, Cmode_t *mode);
|
||||||
extern void CmodeDel(Cmode *cmode);
|
extern void CmodeDel(Cmode *cmode);
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
EXTCM_PAR_HEADER
|
|
||||||
unsigned short num;
|
|
||||||
unsigned short t;
|
|
||||||
} aModejEntry;
|
|
||||||
|
|
||||||
#define LISTENER_NORMAL 0x000001
|
#define LISTENER_NORMAL 0x000001
|
||||||
#define LISTENER_CLIENTSONLY 0x000002
|
#define LISTENER_CLIENTSONLY 0x000002
|
||||||
#define LISTENER_SERVERSONLY 0x000004
|
#define LISTENER_SERVERSONLY 0x000004
|
||||||
#define LISTENER_JAVACLIENT 0x000008
|
|
||||||
#define LISTENER_SSL 0x000010
|
#define LISTENER_SSL 0x000010
|
||||||
#define LISTENER_BOUND 0x000020
|
#define LISTENER_BOUND 0x000020
|
||||||
#define LISTENER_DEFER_ACCEPT 0x000040
|
#define LISTENER_DEFER_ACCEPT 0x000040
|
||||||
@@ -1283,24 +1267,6 @@ struct _iplist {
|
|||||||
/* struct irc_netmask *netmask; */
|
/* struct irc_netmask *netmask; */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define BADW_TYPE_INVALID 0x0
|
|
||||||
#define BADW_TYPE_FAST 0x1
|
|
||||||
#define BADW_TYPE_FAST_L 0x2
|
|
||||||
#define BADW_TYPE_FAST_R 0x4
|
|
||||||
#define BADW_TYPE_REGEX 0x8
|
|
||||||
|
|
||||||
#define BADWORD_REPLACE 1
|
|
||||||
#define BADWORD_BLOCK 2
|
|
||||||
|
|
||||||
struct _configitem_badword {
|
|
||||||
ConfigItem *prev, *next;
|
|
||||||
ConfigFlag flag;
|
|
||||||
char *word, *replace;
|
|
||||||
unsigned short type;
|
|
||||||
char action;
|
|
||||||
regex_t expr;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _configitem_deny_dcc {
|
struct _configitem_deny_dcc {
|
||||||
ConfigItem *prev, *next;
|
ConfigItem *prev, *next;
|
||||||
ConfigFlag_ban flag;
|
ConfigFlag_ban flag;
|
||||||
@@ -1484,42 +1450,18 @@ struct ListOptions {
|
|||||||
|
|
||||||
#define EXTCMODETABLESZ 32
|
#define EXTCMODETABLESZ 32
|
||||||
|
|
||||||
/* this can be like ~60-90 bytes, therefore it's in a seperate struct */
|
/* Number of maximum paramter modes to allow.
|
||||||
#define FLD_CTCP 0 /* c */
|
* Don't set it unnecessarily high.. we only use k, l, L, j and f at the moment. (FIXME)
|
||||||
#define FLD_JOIN 1 /* j */
|
*/
|
||||||
#define FLD_KNOCK 2 /* k */
|
#define MAXPARAMMODES 16
|
||||||
#define FLD_MSG 3 /* m */
|
|
||||||
#define FLD_NICK 4 /* n */
|
|
||||||
#define FLD_TEXT 5 /* t */
|
|
||||||
|
|
||||||
#define NUMFLD 6 /* 6 flood types */
|
|
||||||
|
|
||||||
struct SRemoveFld {
|
|
||||||
struct SRemoveFld *prev, *next;
|
|
||||||
aChannel *chptr;
|
|
||||||
char m; /* mode to be removed */
|
|
||||||
time_t when; /* scheduled at */
|
|
||||||
};
|
|
||||||
|
|
||||||
struct SChanFloodProt {
|
|
||||||
unsigned short per; /* setting: per <XX> seconds */
|
|
||||||
time_t t[NUMFLD]; /* runtime: timers */
|
|
||||||
unsigned short c[NUMFLD]; /* runtime: counters */
|
|
||||||
unsigned short l[NUMFLD]; /* setting: limit */
|
|
||||||
unsigned char a[NUMFLD]; /* setting: action */
|
|
||||||
unsigned char r[NUMFLD]; /* setting: remove-after <this> minutes */
|
|
||||||
unsigned long timer_flags; /* if a "-m timer" is running this is & MODE_MODERATED etc.. */
|
|
||||||
};
|
|
||||||
|
|
||||||
/* mode structure for channels */
|
/* mode structure for channels */
|
||||||
struct SMode {
|
struct SMode {
|
||||||
long mode;
|
long mode;
|
||||||
Cmode_t extmode;
|
Cmode_t extmode;
|
||||||
CmodeParam *extmodeparam;
|
void *extmodeparams[MAXPARAMMODES+1];
|
||||||
int limit;
|
int limit;
|
||||||
char key[KEYLEN + 1];
|
char key[KEYLEN + 1];
|
||||||
char link[LINKLEN + 1];
|
|
||||||
ChanFloodProt *floodprot;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Used for notify-hash buckets... -Donwulff */
|
/* Used for notify-hash buckets... -Donwulff */
|
||||||
@@ -1565,15 +1507,13 @@ struct Channel {
|
|||||||
char *topic;
|
char *topic;
|
||||||
char *topic_nick;
|
char *topic_nick;
|
||||||
TS topic_time;
|
TS topic_time;
|
||||||
unsigned short users;
|
int users;
|
||||||
Member *members;
|
Member *members;
|
||||||
Link *invites;
|
Link *invites;
|
||||||
Ban *banlist;
|
Ban *banlist;
|
||||||
Ban *exlist; /* exceptions */
|
Ban *exlist; /* exceptions */
|
||||||
Ban *invexlist; /* invite list */
|
Ban *invexlist; /* invite list */
|
||||||
#ifdef JOINTHROTTLE
|
aJFlood *jflood; /* TODO: move to dynamic modular storage */
|
||||||
aJFlood *jflood;
|
|
||||||
#endif
|
|
||||||
char *mode_lock;
|
char *mode_lock;
|
||||||
char chname[1];
|
char chname[1];
|
||||||
};
|
};
|
||||||
@@ -1643,6 +1583,8 @@ struct liststruct {
|
|||||||
#define CHFL_EXCEPT 0x0200 /* phase this out ? +e */
|
#define CHFL_EXCEPT 0x0200 /* phase this out ? +e */
|
||||||
#define CHFL_INVEX 0x0400 /* invite exception */
|
#define CHFL_INVEX 0x0400 /* invite exception */
|
||||||
|
|
||||||
|
#define CHFL_REJOINING 0x8000 /* used internally by rejoin_* */
|
||||||
|
|
||||||
#define CHFL_OVERLAP (CHFL_CHANOWNER|CHFL_CHANPROT|CHFL_CHANOP|CHFL_VOICE|CHFL_HALFOP)
|
#define CHFL_OVERLAP (CHFL_CHANOWNER|CHFL_CHANPROT|CHFL_CHANOP|CHFL_VOICE|CHFL_HALFOP)
|
||||||
|
|
||||||
/* Channel macros */
|
/* Channel macros */
|
||||||
@@ -1664,7 +1606,6 @@ struct liststruct {
|
|||||||
#define MODE_LIMIT 0x4000
|
#define MODE_LIMIT 0x4000
|
||||||
#define MODE_RGSTR 0x8000
|
#define MODE_RGSTR 0x8000
|
||||||
#define MODE_RGSTRONLY 0x10000
|
#define MODE_RGSTRONLY 0x10000
|
||||||
#define MODE_LINK 0x20000
|
|
||||||
#define MODE_NOCOLOR 0x40000
|
#define MODE_NOCOLOR 0x40000
|
||||||
#define MODE_OPERONLY 0x80000
|
#define MODE_OPERONLY 0x80000
|
||||||
#define MODE_ADMONLY 0x100000
|
#define MODE_ADMONLY 0x100000
|
||||||
@@ -1672,10 +1613,8 @@ struct liststruct {
|
|||||||
#define MODE_STRIP 0x400000
|
#define MODE_STRIP 0x400000
|
||||||
#define MODE_NOKNOCK 0x800000
|
#define MODE_NOKNOCK 0x800000
|
||||||
#define MODE_NOINVITE 0x1000000
|
#define MODE_NOINVITE 0x1000000
|
||||||
#define MODE_FLOODLIMIT 0x2000000
|
|
||||||
#define MODE_MODREG 0x4000000
|
#define MODE_MODREG 0x4000000
|
||||||
#define MODE_INVEX 0x8000000
|
#define MODE_INVEX 0x8000000
|
||||||
#define MODE_NOCTCP 0x10000000
|
|
||||||
#define MODE_AUDITORIUM 0x20000000
|
#define MODE_AUDITORIUM 0x20000000
|
||||||
#define MODE_ONLYSECURE 0x40000000
|
#define MODE_ONLYSECURE 0x40000000
|
||||||
#define MODE_NONICKCHANGE 0x80000000
|
#define MODE_NONICKCHANGE 0x80000000
|
||||||
@@ -1684,7 +1623,7 @@ struct liststruct {
|
|||||||
/*
|
/*
|
||||||
* mode flags which take another parameter (With PARAmeterS)
|
* mode flags which take another parameter (With PARAmeterS)
|
||||||
*/
|
*/
|
||||||
#define MODE_WPARAS (MODE_HALFOP|MODE_CHANOP|MODE_VOICE|MODE_CHANOWNER|MODE_CHANPROT|MODE_BAN|MODE_KEY|MODE_LINK|MODE_LIMIT|MODE_EXCEPT|MODE_INVEX)
|
#define MODE_WPARAS (MODE_HALFOP|MODE_CHANOP|MODE_VOICE|MODE_CHANOWNER|MODE_CHANPROT|MODE_BAN|MODE_KEY|MODE_LIMIT|MODE_EXCEPT|MODE_INVEX)
|
||||||
/*
|
/*
|
||||||
* Undefined here, these are used in conjunction with the above modes in
|
* Undefined here, these are used in conjunction with the above modes in
|
||||||
* the source.
|
* the source.
|
||||||
@@ -1818,7 +1757,8 @@ typedef struct {
|
|||||||
unsigned parameters : 1;
|
unsigned parameters : 1;
|
||||||
} aCtab;
|
} aCtab;
|
||||||
|
|
||||||
#ifdef JOINTHROTTLE
|
#if 1
|
||||||
|
/* TODO: move to module / dynamic storage */
|
||||||
/** A jointhrottle item, this is a double linked list.
|
/** A jointhrottle item, this is a double linked list.
|
||||||
* prev_u Previous entry of user
|
* prev_u Previous entry of user
|
||||||
* next_u Next entry of user
|
* next_u Next entry of user
|
||||||
@@ -1870,7 +1810,7 @@ int throttle_can_connect(aClient *, struct IN_ADDR *in);
|
|||||||
|
|
||||||
#define VERIFY_OPERCOUNT(clnt,tag) { if (IRCstats.operators < 0) verify_opercount(clnt,tag); } while(0)
|
#define VERIFY_OPERCOUNT(clnt,tag) { if (IRCstats.operators < 0) verify_opercount(clnt,tag); } while(0)
|
||||||
|
|
||||||
#define MARK_AS_OFFICIAL_MODULE(modinf) do { if (modinf && modinf->handle) ModuleSetOptions(modinfo->handle, MOD_OPT_OFFICIAL); } while(0)
|
#define MARK_AS_OFFICIAL_MODULE(modinf) do { if (modinf && modinf->handle) ModuleSetOptions(modinfo->handle, MOD_OPT_OFFICIAL, 1); } while(0)
|
||||||
|
|
||||||
/* old.. please don't use anymore */
|
/* old.. please don't use anymore */
|
||||||
#define CHANOPPFX "@"
|
#define CHANOPPFX "@"
|
||||||
|
|||||||
@@ -171,6 +171,8 @@ extern char OSName[256];
|
|||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
typedef unsigned short u_int16_t;
|
typedef unsigned short u_int16_t;
|
||||||
|
typedef unsigned __int64 uint64_t;
|
||||||
|
typedef unsigned __int32 uint32_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
+2
-2
@@ -54,9 +54,9 @@
|
|||||||
* Can be useful if the above 3 versionids are insufficient for you (eg: you want to support CVS).
|
* Can be useful if the above 3 versionids are insufficient for you (eg: you want to support CVS).
|
||||||
* This is updated automatically on the CVS server every Monday. so don't touch it.
|
* This is updated automatically on the CVS server every Monday. so don't touch it.
|
||||||
*/
|
*/
|
||||||
#define UNREAL_VERSION_TIME 201144
|
#define UNREAL_VERSION_TIME 201411
|
||||||
|
|
||||||
#define UnrealProtocol 2312
|
#define UnrealProtocol 2350
|
||||||
#define PATCH1 macro_to_str(UNREAL_VERSION_GENERATION)
|
#define PATCH1 macro_to_str(UNREAL_VERSION_GENERATION)
|
||||||
#define PATCH2 "." macro_to_str(UNREAL_VERSION_MAJOR)
|
#define PATCH2 "." macro_to_str(UNREAL_VERSION_MAJOR)
|
||||||
#define PATCH3 ""
|
#define PATCH3 ""
|
||||||
|
|||||||
@@ -78,6 +78,6 @@
|
|||||||
|
|
||||||
/* Version suffix such as a beta marker or release candidate marker. (e.g.:
|
/* Version suffix such as a beta marker or release candidate marker. (e.g.:
|
||||||
-rc2 for unrealircd-3.2.9-rc2) */
|
-rc2 for unrealircd-3.2.9-rc2) */
|
||||||
#define UNREAL_VERSION_SUFFIX "-dev"
|
#define UNREAL_VERSION_SUFFIX "-alpha0"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -37,9 +37,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
#include "badwords.h"
|
|
||||||
#endif
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+49
-67
@@ -150,60 +150,25 @@ EXP_OBJ_FILES=SRC/CHANNEL.OBJ SRC/SEND.OBJ SRC/SOCKET.OBJ \
|
|||||||
SRC/S_DEBUG.OBJ SRC/SUPPORT.OBJ SRC/LIST.OBJ \
|
SRC/S_DEBUG.OBJ SRC/SUPPORT.OBJ SRC/LIST.OBJ \
|
||||||
SRC/S_ERR.OBJ SRC/PACKET.OBJ SRC/S_BSD.OBJ \
|
SRC/S_ERR.OBJ SRC/PACKET.OBJ SRC/S_BSD.OBJ \
|
||||||
SRC/S_SERV.OBJ SRC/S_USER.OBJ SRC/CHARSYS.OBJ \
|
SRC/S_SERV.OBJ SRC/S_USER.OBJ SRC/CHARSYS.OBJ \
|
||||||
SRC/VERSION.OBJ SRC/S_KLINE.OBJ SRC/S_EXTRA.OBJ SRC/IRCSPRINTF.OBJ SRC/LUSERS.OBJ \
|
SRC/VERSION.OBJ SRC/S_KLINE.OBJ SRC/S_EXTRA.OBJ SRC/IRCSPRINTF.OBJ \
|
||||||
SRC/SCACHE.OBJ SRC/ALN.OBJ SRC/RES.OBJ SRC/MODULES.OBJ \
|
SRC/SCACHE.OBJ SRC/ALN.OBJ SRC/RES.OBJ SRC/MODULES.OBJ \
|
||||||
SRC/S_SVS.OBJ SRC/EVENTS.OBJ SRC/UMODES.OBJ SRC/AUTH.OBJ SRC/CIDR.OBJ SRC/SSL.OBJ \
|
SRC/S_SVS.OBJ SRC/EVENTS.OBJ SRC/UMODES.OBJ SRC/AUTH.OBJ SRC/CIDR.OBJ SRC/SSL.OBJ \
|
||||||
SRC/RANDOM.OBJ SRC/EXTCMODES.OBJ SRC/MD5.OBJ SRC/API-ISUPPORT.OBJ SRC/API-COMMAND.OBJ \
|
SRC/RANDOM.OBJ SRC/EXTCMODES.OBJ SRC/UID.OBJ SRC/MEMPOOL.OBJ SRC/S_DISPATCH.OBJ SRC/MD5.OBJ SRC/API-ISUPPORT.OBJ SRC/API-COMMAND.OBJ \
|
||||||
SRC/EXTBANS.OBJ SRC/TIMESYNCH.OBJ $(CURLOBJ)
|
SRC/EXTBANS.OBJ SRC/TIMESYNCH.OBJ $(CURLOBJ)
|
||||||
|
|
||||||
OBJ_FILES=$(EXP_OBJ_FILES) SRC/GUI.OBJ SRC/SERVICE.OBJ SRC/DEBUG.OBJ SRC/RTF.OBJ \
|
OBJ_FILES=$(EXP_OBJ_FILES) SRC/GUI.OBJ SRC/SERVICE.OBJ SRC/DEBUG.OBJ SRC/RTF.OBJ \
|
||||||
SRC/EDITOR.OBJ SRC/WIN32.OBJ
|
SRC/EDITOR.OBJ SRC/WIN32.OBJ
|
||||||
|
|
||||||
MOD_FILES=SRC/MODULES/L_COMMANDS.C SRC/MODULES/M_CHGHOST.C SRC/MODULES/M_SDESC.C \
|
|
||||||
SRC/MODULES/M_SETIDENT.C SRC/MODULES/M_SETNAME.C SRC/MODULES/M_SETHOST.C \
|
|
||||||
SRC/MODULES/M_CHGIDENT.C SRC/MODULES/M_SVSMOTD.C SRC/MODULES/M_SVSNLINE.C \
|
|
||||||
SRC/MODULES/M_WHO.C SRC/MODULES/M_SWHOIS.C SRC/MODULES/M_SVSMODE.C SRC/MODULES/M_AWAY.C \
|
|
||||||
SRC/MODULES/M_SVSNOOP.C SRC/MODULES/M_MKPASSWD.C SRC/MODULES/M_SVSO.C \
|
|
||||||
SRC/MODULES/M_SVSNICK.C SRC/MODULES/M_ADMINCHAT.C SRC/MODULES/M_AKILL.C \
|
|
||||||
SRC/MODULES/M_CHGNAME.C SRC/MODULES/M_GUEST.C SRC/MODULES/M_HTM.C SRC/MODULES/M_LAG.C \
|
|
||||||
SRC/MODULES/M_MESSAGE.C SRC/MODULES/WEBTV.C SRC/MODULES/M_NACHAT.C SRC/MODULES/M_OPER.C \
|
|
||||||
SRC/MODULES/M_PINGPONG.C SRC/MODULES/M_QUIT.C SRC/MODULES/M_RAKILL.C SRC/MODULES/M_RPING.C \
|
|
||||||
SRC/MODULES/M_SENDUMODE.C SRC/MODULES/M_SQLINE.C SRC/MODULES/M_KILL.C \
|
|
||||||
SRC/MODULES/M_TSCTL.C SRC/MODULES/M_UNKLINE.C SRC/MODULES/M_UNSQLINE.C \
|
|
||||||
SRC/MODULES/M_UNZLINE.C SRC/MODULES/M_WHOIS.C SRC/MODULES/M_TKL.C SRC/MODULES/M_VHOST.C \
|
|
||||||
SRC/MODULES/M_CYCLE.C SRC/MODULES/M_SVSJOIN.C SRC/MODULES/M_SVSPART.C \
|
|
||||||
SRC/MODULES/M_SVSLUSERS.C SRC/MODULES/M_SVSWATCH.C SRC/MODULES/M_SVSSILENCE.C \
|
|
||||||
SRC/MODULES/M_SENDSNO.C SRC/MODULES/M_SVSSNO.C SRC/MODULES/M_SAJOIN.C \
|
|
||||||
SRC/MODULES/M_SAPART.C SRC/MODULES/M_SAMODE.C SRC/MODULES/M_KICK.C SRC/MODULES/M_TOPIC.C \
|
|
||||||
SRC/MODULES/M_INVITE.C SRC/MODULES/M_LIST.C SRC/MODULES/M_TIME.C SRC/MODULES/M_SVSKILL.C \
|
|
||||||
SRC/MODULES/M_KNOCK.C SRC/MODULES/M_UMODE2.C SRC/MODULES/M_SQUIT.C \
|
|
||||||
SRC/MODULES/M_PROTOCTL.C SRC/MODULES/M_SJOIN.C SRC/MODULES/M_PASS.C \
|
|
||||||
SRC/MODULES/M_USERHOST.C SRC/MODULES/M_ISON.C SRC/MODULES/M_SILENCE.C \
|
|
||||||
SRC/MODULES/M_ADDLINE.C SRC/MODULES/M_ADDMOTD.C SRC/MODULES/M_ADDOMOTD.C \
|
|
||||||
SRC/MODULES/M_WALLOPS.C SRC/MODULES/M_GLOBOPS.C SRC/MODULES/M_LOCOPS.C \
|
|
||||||
SRC/MODULES/M_CHATOPS.C SRC/MODULES/M_ADMIN.C SRC/MODULES/M_TRACE.C \
|
|
||||||
SRC/MODULES/M_NETINFO.C SRC/MODULES/M_LINKS.C SRC/MODULES/M_HELP.C \
|
|
||||||
SRC/MODULES/M_RULES.C SRC/MODULES/M_CLOSE.C SRC/MODULES/M_MAP.C SRC/MODULES/M_EOS.C \
|
|
||||||
SRC/MODULES/M_SERVER.C SRC/MODULES/M_STATS.C SRC/MODULES/M_SVSFLINE.C \
|
|
||||||
SRC/MODULES/M_DCCDENY.C SRC/MODULES/M_UNDCCDENY.C SRC/MODULES/M_WHOWAS.C \
|
|
||||||
SRC/MODULES/M_CONNECT.C SRC/MODULES/M_DCCALLOW.C SRC/MODULES/M_USERIP.C \
|
|
||||||
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_STARTTLS.C SRC/MODULES/M_NOPOST.C SRC/MODULES/M_ISSECURE.C SRC/MODULES/M_CAP.C \
|
|
||||||
SRC/MODULES/M_SASL.C
|
|
||||||
|
|
||||||
DLL_FILES=SRC/MODULES/M_CHGHOST.DLL SRC/MODULES/M_SDESC.DLL SRC/MODULES/M_SETIDENT.DLL \
|
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 \
|
SRC/MODULES/M_SETNAME.DLL SRC/MODULES/M_SETHOST.DLL SRC/MODULES/M_CHGIDENT.DLL \
|
||||||
SRC/MODULES/M_SVSMOTD.DLL SRC/MODULES/M_SVSNLINE.DLL SRC/MODULES/M_WHO.DLL \
|
SRC/MODULES/M_SVSMOTD.DLL SRC/MODULES/M_SVSNLINE.DLL SRC/MODULES/M_WHO.DLL \
|
||||||
SRC/MODULES/M_SWHOIS.DLL SRC/MODULES/M_SVSMODE.DLL SRC/MODULES/M_AWAY.DLL \
|
SRC/MODULES/M_SWHOIS.DLL SRC/MODULES/M_SVSMODE.DLL SRC/MODULES/M_AWAY.DLL \
|
||||||
SRC/MODULES/M_SVSNOOP.DLL SRC/MODULES/M_MKPASSWD.DLL SRC/MODULES/M_SVSO.DLL \
|
SRC/MODULES/M_SVSNOOP.DLL SRC/MODULES/M_MKPASSWD.DLL SRC/MODULES/M_SVSO.DLL \
|
||||||
SRC/MODULES/M_SVSNICK.DLL SRC/MODULES/M_ADMINCHAT.DLL SRC/MODULES/M_AKILL.DLL \
|
SRC/MODULES/M_SVSNICK.DLL SRC/MODULES/M_ADMINCHAT.DLL \
|
||||||
SRC/MODULES/M_CHGNAME.DLL SRC/MODULES/M_GUEST.DLL SRC/MODULES/M_HTM.DLL \
|
SRC/MODULES/M_CHGNAME.DLL SRC/MODULES/M_GUEST.DLL \
|
||||||
SRC/MODULES/M_LAG.DLL SRC/MODULES/M_MESSAGE.DLL SRC/MODULES/M_NACHAT.DLL \
|
SRC/MODULES/M_LAG.DLL SRC/MODULES/M_MESSAGE.DLL SRC/MODULES/M_NACHAT.DLL \
|
||||||
SRC/MODULES/M_OPER.DLL SRC/MODULES/M_PINGPONG.DLL SRC/MODULES/M_QUIT.DLL \
|
SRC/MODULES/M_OPER.DLL SRC/MODULES/M_PINGPONG.DLL SRC/MODULES/M_QUIT.DLL \
|
||||||
SRC/MODULES/M_RAKILL.DLL SRC/MODULES/M_RPING.DLL SRC/MODULES/M_SENDUMODE.DLL \
|
SRC/MODULES/M_RPING.DLL SRC/MODULES/M_SENDUMODE.DLL \
|
||||||
SRC/MODULES/M_SQLINE.DLL SRC/MODULES/M_KILL.DLL SRC/MODULES/M_TSCTL.DLL \
|
SRC/MODULES/M_SQLINE.DLL SRC/MODULES/M_KILL.DLL SRC/MODULES/M_TSCTL.DLL \
|
||||||
SRC/MODULES/M_UNKLINE.DLL SRC/MODULES/M_UNSQLINE.DLL SRC/MODULES/M_UNZLINE.DLL \
|
SRC/MODULES/M_UNKLINE.DLL SRC/MODULES/M_UNSQLINE.DLL SRC/MODULES/M_UNZLINE.DLL \
|
||||||
SRC/MODULES/M_WHOIS.DLL SRC/MODULES/M_TKL.DLL SRC/MODULES/M_VHOST.DLL \
|
SRC/MODULES/M_WHOIS.DLL SRC/MODULES/M_TKL.DLL SRC/MODULES/M_VHOST.DLL \
|
||||||
@@ -229,12 +194,18 @@ DLL_FILES=SRC/MODULES/M_CHGHOST.DLL SRC/MODULES/M_SDESC.DLL SRC/MODULES/M_SETIDE
|
|||||||
SRC/MODULES/M_MOTD.DLL SRC/MODULES/M_OPERMOTD.DLL SRC/MODULES/M_BOTMOTD.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/M_LUSERS.DLL SRC/MODULES/M_NAMES.DLL SRC/MODULES/M_SVSNOLAG.DLL \
|
||||||
SRC/MODULES/M_STARTTLS.DLL \
|
SRC/MODULES/M_STARTTLS.DLL \
|
||||||
SRC/MODULES/M_NOPOST.DLL SRC/MODULES/M_ISSECURE.DLL SRC/MODULES/M_CAP.DLL \
|
SRC/MODULES/M_NOPOST.DLL SRC/MODULES/M_CAP.DLL \
|
||||||
SRC/MODULES/M_SASL.DLL \
|
SRC/MODULES/M_SASL.DLL SRC/MODULES/CAP_INVITENOTIFY.DLL \
|
||||||
SRC/MODULES/CLOAK.DLL
|
SRC/MODULES/CLOAK.DLL \
|
||||||
|
SRC/MODULES/CHANMODES/FLOODPROT.DLL \
|
||||||
|
SRC/MODULES/CHANMODES/ISSECURE.DLL \
|
||||||
|
SRC/MODULES/CHANMODES/JOINTHROTTLE.DLL \
|
||||||
|
SRC/MODULES/CHANMODES/NOCOLOR.DLL \
|
||||||
|
SRC/MODULES/CHANMODES/STRIPCOLOR.DLL \
|
||||||
|
SRC/MODULES/CHANMODES/PERMANENT.DLL
|
||||||
|
|
||||||
|
|
||||||
ALL: CONF UNREAL.EXE WIRCD.EXE src/modules/commands.dll MODULES
|
ALL: CONF UNREAL.EXE WIRCD.EXE MODULES
|
||||||
|
|
||||||
CLEAN:
|
CLEAN:
|
||||||
-@erase src\*.obj >NUL
|
-@erase src\*.obj >NUL
|
||||||
@@ -243,6 +214,8 @@ CLEAN:
|
|||||||
-@erase src\win32\*.obj >NUL
|
-@erase src\win32\*.obj >NUL
|
||||||
-@erase src\modules\*.obj >NUL
|
-@erase src\modules\*.obj >NUL
|
||||||
-@erase src\modules\*.dll >NUL
|
-@erase src\modules\*.dll >NUL
|
||||||
|
-@erase src\modules\chanmodes\*.dll >NUL
|
||||||
|
-@erase src\modules\usermodes\*.dll >NUL
|
||||||
-@erase .\*.exe >NUL
|
-@erase .\*.exe >NUL
|
||||||
-@erase wircd.lib >NUL
|
-@erase wircd.lib >NUL
|
||||||
-@erase src\modules\*.exp >NUL
|
-@erase src\modules\*.exp >NUL
|
||||||
@@ -312,9 +285,6 @@ src/channel.obj: src/channel.c $(INCLUDES) ./include/channel.h
|
|||||||
src/class.obj: src/class.c $(INCLUDES) ./include/class.h
|
src/class.obj: src/class.c $(INCLUDES) ./include/class.h
|
||||||
$(CC) $(CFLAGS) src/class.c
|
$(CC) $(CFLAGS) src/class.c
|
||||||
|
|
||||||
src/lusers.obj: src/lusers.c $(INCLUDES)
|
|
||||||
$(CC) $(CFLAGS) src/lusers.c
|
|
||||||
|
|
||||||
src/aln.obj: src/aln.c $(INCLUDES)
|
src/aln.obj: src/aln.c $(INCLUDES)
|
||||||
$(CC) $(CFLAGS) src/aln.c
|
$(CC) $(CFLAGS) src/aln.c
|
||||||
|
|
||||||
@@ -432,6 +402,15 @@ src/random.obj: src/random.c $(INCLUDES)
|
|||||||
src/extcmodes.obj: src/extcmodes.c $(INCLUDES)
|
src/extcmodes.obj: src/extcmodes.c $(INCLUDES)
|
||||||
$(CC) $(CFLAGS) src/extcmodes.c
|
$(CC) $(CFLAGS) src/extcmodes.c
|
||||||
|
|
||||||
|
src/uid.obj: src/uid.c $(INCLUDES)
|
||||||
|
$(CC) $(CFLAGS) src/uid.c
|
||||||
|
|
||||||
|
src/mempool.obj: src/mempool.c $(INCLUDES)
|
||||||
|
$(CC) $(CFLAGS) src/mempool.c
|
||||||
|
|
||||||
|
src/s_dispatch.obj: src/s_dispatch.c $(INCLUDES)
|
||||||
|
$(CC) $(CFLAGS) src/s_dispatch.c
|
||||||
|
|
||||||
src/md5.obj: src/md5.c $(INCLUDES)
|
src/md5.obj: src/md5.c $(INCLUDES)
|
||||||
$(CC) $(CFLAGS) src/md5.c
|
$(CC) $(CFLAGS) src/md5.c
|
||||||
|
|
||||||
@@ -471,13 +450,6 @@ SYMBOLFILE:
|
|||||||
|
|
||||||
MODULES: $(DLL_FILES)
|
MODULES: $(DLL_FILES)
|
||||||
|
|
||||||
src/modules/commands.dll: $(MOD_FILES) $(INCLUDES)
|
|
||||||
$(CC) $(MODDBGCFLAG) $(LIBCURL_INC) $(OPENSSL_INC) /nologo \
|
|
||||||
$(SSLCFLAGS) $(CURLCFLAGS) $(TRE_INC) /Fosrc/modules/ \
|
|
||||||
/I ./INCLUDE /D NOSPOOF /D MODULE_COMPILE /D _CRT_SECURE_NO_DEPRECATE \
|
|
||||||
/D _USE_32BIT_TIME_T $(MOD_FILES) \
|
|
||||||
$(MODLFLAGS) /OUT:src/modules/commands.dll
|
|
||||||
|
|
||||||
src/modules/m_chghost.dll: src/modules/m_chghost.c $(INCLUDES)
|
src/modules/m_chghost.dll: src/modules/m_chghost.c $(INCLUDES)
|
||||||
$(CC) $(MODCFLAGS) src/modules/m_chghost.c $(MODLFLAGS)
|
$(CC) $(MODCFLAGS) src/modules/m_chghost.c $(MODLFLAGS)
|
||||||
|
|
||||||
@@ -532,18 +504,12 @@ src/modules/m_svsnick.dll: src/modules/m_svsnick.c $(INCLUDES)
|
|||||||
src/modules/m_adminchat.dll: src/modules/m_adminchat.c $(INCLUDES)
|
src/modules/m_adminchat.dll: src/modules/m_adminchat.c $(INCLUDES)
|
||||||
$(CC) $(MODCFLAGS) src/modules/m_adminchat.c $(MODLFLAGS)
|
$(CC) $(MODCFLAGS) src/modules/m_adminchat.c $(MODLFLAGS)
|
||||||
|
|
||||||
src/modules/m_akill.dll: src/modules/m_akill.c $(INCLUDES)
|
|
||||||
$(CC) $(MODCFLAGS) src/modules/m_akill.c $(MODLFLAGS)
|
|
||||||
|
|
||||||
src/modules/m_chgname.dll: src/modules/m_chgname.c $(INCLUDES)
|
src/modules/m_chgname.dll: src/modules/m_chgname.c $(INCLUDES)
|
||||||
$(CC) $(MODCFLAGS) src/modules/m_chgname.c $(MODLFLAGS)
|
$(CC) $(MODCFLAGS) src/modules/m_chgname.c $(MODLFLAGS)
|
||||||
|
|
||||||
src/modules/m_guest.dll: src/modules/m_guest.c $(INCLUDES)
|
src/modules/m_guest.dll: src/modules/m_guest.c $(INCLUDES)
|
||||||
$(CC) $(MODCFLAGS) src/modules/m_guest.c $(MODLFLAGS)
|
$(CC) $(MODCFLAGS) src/modules/m_guest.c $(MODLFLAGS)
|
||||||
|
|
||||||
src/modules/m_htm.dll: src/modules/m_htm.c $(INCLUDES)
|
|
||||||
$(CC) $(MODCFLAGS) src/modules/m_htm.c $(MODLFLAGS)
|
|
||||||
|
|
||||||
src/modules/m_kill.dll: src/modules/m_kill.c $(INCLUDES)
|
src/modules/m_kill.dll: src/modules/m_kill.c $(INCLUDES)
|
||||||
$(CC) $(MODCFLAGS) src/modules/m_kill.c $(MODLFLAGS)
|
$(CC) $(MODCFLAGS) src/modules/m_kill.c $(MODLFLAGS)
|
||||||
|
|
||||||
@@ -551,7 +517,7 @@ src/modules/m_lag.dll: src/modules/m_lag.c $(INCLUDES)
|
|||||||
$(CC) $(MODCFLAGS) src/modules/m_lag.c $(MODLFLAGS)
|
$(CC) $(MODCFLAGS) src/modules/m_lag.c $(MODLFLAGS)
|
||||||
|
|
||||||
src/modules/m_message.dll: src/modules/m_message.c $(INCLUDES)
|
src/modules/m_message.dll: src/modules/m_message.c $(INCLUDES)
|
||||||
$(CC) $(MODCFLAGS) src/modules/m_message.c src/modules/webtv.c $(MODLFLAGS)
|
$(CC) $(MODCFLAGS) src/modules/m_message.c $(MODLFLAGS)
|
||||||
|
|
||||||
src/modules/m_nachat.dll: src/modules/m_nachat.c $(INCLUDES)
|
src/modules/m_nachat.dll: src/modules/m_nachat.c $(INCLUDES)
|
||||||
$(CC) $(MODCFLAGS) src/modules/m_nachat.c $(MODLFLAGS)
|
$(CC) $(MODCFLAGS) src/modules/m_nachat.c $(MODLFLAGS)
|
||||||
@@ -565,9 +531,6 @@ src/modules/m_pingpong.dll: src/modules/m_pingpong.c $(INCLUDES)
|
|||||||
src/modules/m_quit.dll: src/modules/m_quit.c $(INCLUDES)
|
src/modules/m_quit.dll: src/modules/m_quit.c $(INCLUDES)
|
||||||
$(CC) $(MODCFLAGS) src/modules/m_quit.c $(MODLFLAGS)
|
$(CC) $(MODCFLAGS) src/modules/m_quit.c $(MODLFLAGS)
|
||||||
|
|
||||||
src/modules/m_rakill.dll: src/modules/m_rakill.c $(INCLUDES)
|
|
||||||
$(CC) $(MODCFLAGS) src/modules/m_rakill.c $(MODLFLAGS)
|
|
||||||
|
|
||||||
src/modules/m_rping.dll: src/modules/m_rping.c $(INCLUDES)
|
src/modules/m_rping.dll: src/modules/m_rping.c $(INCLUDES)
|
||||||
$(CC) $(MODCFLAGS) src/modules/m_rping.c $(MODLFLAGS)
|
$(CC) $(MODCFLAGS) src/modules/m_rping.c $(MODLFLAGS)
|
||||||
|
|
||||||
@@ -793,15 +756,34 @@ src/modules/m_starttls.dll: src/modules/m_starttls.c $(INCLUDES)
|
|||||||
src/modules/m_nopost.dll: src/modules/m_nopost.c $(INCLUDES)
|
src/modules/m_nopost.dll: src/modules/m_nopost.c $(INCLUDES)
|
||||||
$(CC) $(MODCFLAGS) src/modules/m_nopost.c $(MODLFLAGS)
|
$(CC) $(MODCFLAGS) src/modules/m_nopost.c $(MODLFLAGS)
|
||||||
|
|
||||||
src/modules/m_issecure.dll: src/modules/m_issecure.c $(INCLUDES)
|
|
||||||
$(CC) $(MODCFLAGS) src/modules/m_issecure.c $(MODLFLAGS)
|
|
||||||
|
|
||||||
src/modules/m_cap.dll: src/modules/m_cap.c $(INCLUDES)
|
src/modules/m_cap.dll: src/modules/m_cap.c $(INCLUDES)
|
||||||
$(CC) $(MODCFLAGS) src/modules/m_cap.c $(MODLFLAGS)
|
$(CC) $(MODCFLAGS) src/modules/m_cap.c $(MODLFLAGS)
|
||||||
|
|
||||||
src/modules/m_sasl.dll: src/modules/m_sasl.c $(INCLUDES)
|
src/modules/m_sasl.dll: src/modules/m_sasl.c $(INCLUDES)
|
||||||
$(CC) $(MODCFLAGS) src/modules/m_sasl.c $(MODLFLAGS)
|
$(CC) $(MODCFLAGS) src/modules/m_sasl.c $(MODLFLAGS)
|
||||||
|
|
||||||
|
src/modules/cap_invitenotify.dll: src/modules/cap_invitenotify.c $(INCLUDES)
|
||||||
|
$(CC) $(MODCFLAGS) src/modules/cap_invitenotify.c $(MODLFLAGS)
|
||||||
|
|
||||||
|
src/modules/chanmodes/issecure.dll: src/modules/chanmodes/issecure.c $(INCLUDES)
|
||||||
|
$(CC) $(MODCFLAGS) /Fosrc/modules/chanmodes/ /Fesrc/modules/chanmodes/ src/modules/chanmodes/issecure.c $(MODLFLAGS)
|
||||||
|
|
||||||
|
src/modules/chanmodes/jointhrottle.dll: src/modules/chanmodes/jointhrottle.c $(INCLUDES)
|
||||||
|
$(CC) $(MODCFLAGS) /Fosrc/modules/chanmodes/ /Fesrc/modules/chanmodes/ src/modules/chanmodes/jointhrottle.c $(MODLFLAGS)
|
||||||
|
|
||||||
|
src/modules/chanmodes/nocolor.dll: src/modules/chanmodes/nocolor.c $(INCLUDES)
|
||||||
|
$(CC) $(MODCFLAGS) /Fosrc/modules/chanmodes/ /Fesrc/modules/chanmodes/ src/modules/chanmodes/nocolor.c $(MODLFLAGS)
|
||||||
|
|
||||||
|
src/modules/chanmodes/stripcolor.dll: src/modules/chanmodes/stripcolor.c $(INCLUDES)
|
||||||
|
$(CC) $(MODCFLAGS) /Fosrc/modules/chanmodes/ /Fesrc/modules/chanmodes/ src/modules/chanmodes/stripcolor.c $(MODLFLAGS)
|
||||||
|
|
||||||
|
src/modules/chanmodes/permanent.dll: src/modules/chanmodes/permanent.c $(INCLUDES)
|
||||||
|
$(CC) $(MODCFLAGS) /Fosrc/modules/chanmodes/ /Fesrc/modules/chanmodes/ src/modules/chanmodes/permanent.c $(MODLFLAGS)
|
||||||
|
|
||||||
|
src/modules/chanmodes/floodprot.dll: src/modules/chanmodes/floodprot.c $(INCLUDES)
|
||||||
|
$(CC) $(MODCFLAGS) /Fosrc/modules/chanmodes/ /Fesrc/modules/chanmodes/ src/modules/chanmodes/floodprot.c $(MODLFLAGS)
|
||||||
|
|
||||||
|
|
||||||
dummy:
|
dummy:
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+14
-12
@@ -104,19 +104,21 @@ loadmodule "modules/m_addmotd";
|
|||||||
loadmodule "modules/m_svslusers";
|
loadmodule "modules/m_svslusers";
|
||||||
loadmodule "modules/m_starttls";
|
loadmodule "modules/m_starttls";
|
||||||
loadmodule "modules/m_nopost";
|
loadmodule "modules/m_nopost";
|
||||||
loadmodule "modules/m_issecure";
|
|
||||||
loadmodule "modules/m_cap";
|
loadmodule "modules/m_cap";
|
||||||
loadmodule "modules/m_sasl";
|
loadmodule "modules/m_sasl";
|
||||||
|
|
||||||
/*
|
|
||||||
* invite-notify capability (draft).
|
|
||||||
*
|
|
||||||
* This module implements support for clients which support the invite-notify
|
|
||||||
* capability draft.
|
|
||||||
*/
|
|
||||||
loadmodule "modules/cap_invitenotify";
|
loadmodule "modules/cap_invitenotify";
|
||||||
|
|
||||||
/*
|
/*** Channel modes ***/
|
||||||
* Permanent channel mode (+P).
|
loadmodule "modules/chanmodes/jointhrottle"; /* +j */
|
||||||
*/
|
loadmodule "modules/chanmodes/floodprot"; /* +f */
|
||||||
loadmodule "modules/chm_permanent";
|
loadmodule "modules/chanmodes/nocolor"; /* +c */
|
||||||
|
loadmodule "modules/chanmodes/noctcp"; /* +C */
|
||||||
|
loadmodule "modules/chanmodes/stripcolor"; /* +S */
|
||||||
|
loadmodule "modules/chanmodes/issecure"; /* +Z */
|
||||||
|
loadmodule "modules/chanmodes/permanent"; /* +P */
|
||||||
|
loadmodule "modules/chanmodes/link"; /* +L */
|
||||||
|
loadmodule "modules/chanmodes/censor"; /* +G */
|
||||||
|
|
||||||
|
/*** Channel modes ***/
|
||||||
|
loadmodule "modules/usermodes/noctcp"; /* +T */
|
||||||
|
loadmodule "modules/usermodes/censor"; /* +G */
|
||||||
|
|||||||
+2
-13
@@ -19,7 +19,7 @@
|
|||||||
#* $Id$
|
#* $Id$
|
||||||
#*/
|
#*/
|
||||||
|
|
||||||
CC = danger will robinson
|
CC = do not run make from this directory
|
||||||
|
|
||||||
OBJS=timesynch.o res.o s_bsd.o auth.o aln.o channel.o cloak.o crule.o dbuf.o \
|
OBJS=timesynch.o res.o s_bsd.o auth.o aln.o channel.o cloak.o crule.o dbuf.o \
|
||||||
events.o fdlist.o hash.o help.o ircd.o ircsprintf.o list.o \
|
events.o fdlist.o hash.o help.o ircd.o ircsprintf.o list.o \
|
||||||
@@ -43,7 +43,7 @@ MAKEARGS = 'CFLAGS=${CFLAGS}' 'CC=${CC}' 'IRCDLIBS=${IRCDLIBS}' \
|
|||||||
|
|
||||||
MY_MAKE = $(MAKE) $(MAKEARGS)
|
MY_MAKE = $(MAKE) $(MAKEARGS)
|
||||||
|
|
||||||
INCLUDES = ../include/auth.h ../include/badwords.h ../include/channel.h \
|
INCLUDES = ../include/auth.h ../include/channel.h \
|
||||||
../include/class.h ../include/common.h ../include/config.h ../include/dbuf.h \
|
../include/class.h ../include/common.h ../include/config.h ../include/dbuf.h \
|
||||||
../include/dynconf.h ../include/events.h ../include/fdlist.h ../include/h.h \
|
../include/dynconf.h ../include/events.h ../include/fdlist.h ../include/h.h \
|
||||||
../include/hash.h ../include/inet.h ../include/ircsprintf.h \
|
../include/hash.h ../include/inet.h ../include/ircsprintf.h \
|
||||||
@@ -65,17 +65,6 @@ custommodule:
|
|||||||
ircd: $(OBJS)
|
ircd: $(OBJS)
|
||||||
$(CC) $(CFLAGS) $(CRYPTOLIB) -o ircd $(OBJS) $(LDFLAGS) $(IRCDLIBS) $(CRYPTOLIB)
|
$(CC) $(CFLAGS) $(CRYPTOLIB) -o ircd $(OBJS) $(LDFLAGS) $(IRCDLIBS) $(CRYPTOLIB)
|
||||||
|
|
||||||
staticircd: $(OBJS)
|
|
||||||
$(CC) $(CFLAGS) $(CRYPTOLIB) -DSTATIC_LINKING -o ircd.static $(OBJS) \
|
|
||||||
modules/l_commands.c \
|
|
||||||
modules/m_sethost.c \
|
|
||||||
modules/m_chghost.c \
|
|
||||||
modules/m_chgident.c \
|
|
||||||
modules/m_setname.c \
|
|
||||||
modules/m_setident.c \
|
|
||||||
modules/m_sdesc.c \
|
|
||||||
$(LDFLAGS) $(IRCDLIBS) $(CRYPTOLIB)
|
|
||||||
|
|
||||||
mods:
|
mods:
|
||||||
@if [ ! -r include ] ; then \
|
@if [ ! -r include ] ; then \
|
||||||
ln -s ../include include; \
|
ln -s ../include include; \
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ extern char *cmdstr;
|
|||||||
* Builds isupport token strings.
|
* Builds isupport token strings.
|
||||||
* Respects both the 13 token limit and the 512 buffer limit.
|
* Respects both the 13 token limit and the 512 buffer limit.
|
||||||
*/
|
*/
|
||||||
|
/* TODO: is all this code really safe? */
|
||||||
void make_isupportstrings(void)
|
void make_isupportstrings(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|||||||
+43
-416
@@ -64,9 +64,6 @@ void sub1_from_channel(aChannel *);
|
|||||||
void clean_channelname(char *);
|
void clean_channelname(char *);
|
||||||
void del_invite(aClient *, aChannel *);
|
void del_invite(aClient *, aChannel *);
|
||||||
|
|
||||||
void chanfloodtimer_del(aChannel *chptr, char mflag, long mbit);
|
|
||||||
void chanfloodtimer_stopchantimers(aChannel *chptr);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* some buffers for rebuilding channel/nick lists with ,'s
|
* some buffers for rebuilding channel/nick lists with ,'s
|
||||||
*/
|
*/
|
||||||
@@ -89,22 +86,17 @@ aCtab cFlagTab[] = {
|
|||||||
{MODE_KEY, 'k', 1, 1},
|
{MODE_KEY, 'k', 1, 1},
|
||||||
{MODE_RGSTR, 'r', 0, 0},
|
{MODE_RGSTR, 'r', 0, 0},
|
||||||
{MODE_RGSTRONLY, 'R', 0, 0},
|
{MODE_RGSTRONLY, 'R', 0, 0},
|
||||||
{MODE_NOCOLOR, 'c', 0, 0},
|
|
||||||
{MODE_CHANPROT, 'a', 0, 1},
|
{MODE_CHANPROT, 'a', 0, 1},
|
||||||
{MODE_CHANOWNER, 'q', 0, 1},
|
{MODE_CHANOWNER, 'q', 0, 1},
|
||||||
{MODE_OPERONLY, 'O', 0, 0},
|
{MODE_OPERONLY, 'O', 0, 0},
|
||||||
{MODE_ADMONLY, 'A', 0, 0},
|
{MODE_ADMONLY, 'A', 0, 0},
|
||||||
{MODE_LINK, 'L', 0, 1},
|
|
||||||
{MODE_NOKICKS, 'Q', 0, 0},
|
{MODE_NOKICKS, 'Q', 0, 0},
|
||||||
{MODE_BAN, 'b', 1, 1},
|
{MODE_BAN, 'b', 1, 1},
|
||||||
{MODE_STRIP, 'S', 0, 0}, /* works? */
|
|
||||||
{MODE_EXCEPT, 'e', 1, 0}, /* exception ban */
|
{MODE_EXCEPT, 'e', 1, 0}, /* exception ban */
|
||||||
{MODE_INVEX, 'I', 1, 0}, /* exception ban */
|
{MODE_INVEX, 'I', 1, 0}, /* exception ban */
|
||||||
{MODE_NOKNOCK, 'K', 0, 0}, /* knock knock (no way!) */
|
{MODE_NOKNOCK, 'K', 0, 0}, /* knock knock (no way!) */
|
||||||
{MODE_NOINVITE, 'V', 0, 0}, /* no invites */
|
{MODE_NOINVITE, 'V', 0, 0}, /* no invites */
|
||||||
{MODE_FLOODLIMIT, 'f', 0, 1}, /* flood limiter */
|
|
||||||
{MODE_MODREG, 'M', 0, 0}, /* Need umode +r to talk */
|
{MODE_MODREG, 'M', 0, 0}, /* Need umode +r to talk */
|
||||||
{MODE_NOCTCP, 'C', 0, 0}, /* no CTCPs */
|
|
||||||
{MODE_AUDITORIUM, 'u', 0, 0},
|
{MODE_AUDITORIUM, 'u', 0, 0},
|
||||||
{MODE_ONLYSECURE, 'z', 0, 0},
|
{MODE_ONLYSECURE, 'z', 0, 0},
|
||||||
{MODE_NONICKCHANGE, 'N', 1, 0},
|
{MODE_NONICKCHANGE, 'N', 1, 0},
|
||||||
@@ -275,15 +267,12 @@ Membership *make_membership(int local)
|
|||||||
}
|
}
|
||||||
lp2 = freemembershipL;
|
lp2 = freemembershipL;
|
||||||
freemembershipL = (MembershipL *) lp2->next;
|
freemembershipL = (MembershipL *) lp2->next;
|
||||||
Debug((DEBUG_ERROR, "floodmode::alloc gotone"));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lp2 = freemembershipL;
|
lp2 = freemembershipL;
|
||||||
freemembershipL = (MembershipL *) freemembershipL->next;
|
freemembershipL = (MembershipL *) freemembershipL->next;
|
||||||
Debug((DEBUG_ERROR, "floodmode::freelist gotone"));
|
|
||||||
}
|
}
|
||||||
Debug((DEBUG_ERROR, "floodmode:: bzeroing"));
|
|
||||||
bzero(lp2, sizeof(MembershipL));
|
bzero(lp2, sizeof(MembershipL));
|
||||||
}
|
}
|
||||||
if (local)
|
if (local)
|
||||||
@@ -391,10 +380,8 @@ int add_listmode(Ban **list, aClient *cptr, aChannel *chptr, char *banid)
|
|||||||
ban = make_ban();
|
ban = make_ban();
|
||||||
bzero((char *)ban, sizeof(Ban));
|
bzero((char *)ban, sizeof(Ban));
|
||||||
ban->next = *list;
|
ban->next = *list;
|
||||||
ban->banstr = (char *)MyMalloc(strlen(banid) + 1);
|
ban->banstr = strdup(banid);
|
||||||
(void)strlcpy(ban->banstr, banid, strlen(banid)+1);
|
ban->who = strdup(cptr->name);
|
||||||
ban->who = (char *)MyMalloc(strlen(cptr->name) + 1);
|
|
||||||
(void)strlcpy(ban->who, cptr->name, strlen(cptr->name)+1);
|
|
||||||
ban->when = TStime();
|
ban->when = TStime();
|
||||||
*list = ban;
|
*list = ban;
|
||||||
return 0;
|
return 0;
|
||||||
@@ -752,9 +739,7 @@ int is_chanprot(aClient *cptr, aChannel *chptr)
|
|||||||
|
|
||||||
#define CANNOT_SEND_MODERATED 1
|
#define CANNOT_SEND_MODERATED 1
|
||||||
#define CANNOT_SEND_NOPRIVMSGS 2
|
#define CANNOT_SEND_NOPRIVMSGS 2
|
||||||
#define CANNOT_SEND_NOCOLOR 3
|
|
||||||
#define CANNOT_SEND_BAN 4
|
#define CANNOT_SEND_BAN 4
|
||||||
#define CANNOT_SEND_NOCTCP 5
|
|
||||||
#define CANNOT_SEND_MODREG 6
|
#define CANNOT_SEND_MODREG 6
|
||||||
#define CANNOT_SEND_SWEAR 7 /* This isn't actually used here */
|
#define CANNOT_SEND_SWEAR 7 /* This isn't actually used here */
|
||||||
#define CANNOT_SEND_NOTICE 8
|
#define CANNOT_SEND_NOTICE 8
|
||||||
@@ -786,16 +771,6 @@ int can_send(aClient *cptr, aChannel *chptr, char *msgtext, int notice)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chptr->mode.mode & MODE_NOCOLOR)
|
|
||||||
{
|
|
||||||
/* A bit faster */
|
|
||||||
char *c;
|
|
||||||
for (c = msgtext; *c; c++)
|
|
||||||
{
|
|
||||||
if (*c == 3 || *c == 27 || *c == 4 || *c == 22) /* mirc color, ansi, rgb, reverse */
|
|
||||||
return (CANNOT_SEND_NOCOLOR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
member = IsMember(cptr, chptr);
|
member = IsMember(cptr, chptr);
|
||||||
if (chptr->mode.mode & MODE_NOPRIVMSGS && !member)
|
if (chptr->mode.mode & MODE_NOPRIVMSGS && !member)
|
||||||
return (CANNOT_SEND_NOPRIVMSGS);
|
return (CANNOT_SEND_NOPRIVMSGS);
|
||||||
@@ -816,12 +791,6 @@ int can_send(aClient *cptr, aChannel *chptr, char *msgtext, int notice)
|
|||||||
return (CANNOT_SEND_MODERATED);
|
return (CANNOT_SEND_MODERATED);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chptr->mode.mode & MODE_NOCTCP &&
|
|
||||||
(!lp
|
|
||||||
|| !(lp->flags & (CHFL_CHANOP | CHFL_CHANOWNER | CHFL_CHANPROT))))
|
|
||||||
if (msgtext[0] == 1 && strncmp(&msgtext[1], "ACTION ", 7))
|
|
||||||
return (CANNOT_SEND_NOCTCP);
|
|
||||||
|
|
||||||
if (notice && (chptr->mode.extmode & EXTMODE_NONOTICE) &&
|
if (notice && (chptr->mode.extmode & EXTMODE_NONOTICE) &&
|
||||||
(!lp || !(lp->flags & (CHFL_CHANOP | CHFL_CHANOWNER | CHFL_CHANPROT))))
|
(!lp || !(lp->flags & (CHFL_CHANOP | CHFL_CHANOWNER | CHFL_CHANPROT))))
|
||||||
return (CANNOT_SEND_NOTICE);
|
return (CANNOT_SEND_NOTICE);
|
||||||
@@ -839,72 +808,11 @@ int can_send(aClient *cptr, aChannel *chptr, char *msgtext, int notice)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* [just a helper for channel_modef_string()] */
|
|
||||||
static inline char *chmodefstrhelper(char *buf, size_t size, char t, char tdef, unsigned short l, unsigned char a, unsigned char r)
|
|
||||||
{
|
|
||||||
char *p;
|
|
||||||
char tmpbuf[16], *p2 = tmpbuf;
|
|
||||||
|
|
||||||
ircsnprintf(buf, size, "%hd", l);
|
|
||||||
p = buf + strlen(buf);
|
|
||||||
size_t p_size = size - strlen(buf);
|
|
||||||
if (!p_size) return 0;
|
|
||||||
*p++ = t;
|
|
||||||
if (!--p_size) return 0;
|
|
||||||
if (a && ((a != tdef) || r))
|
|
||||||
{
|
|
||||||
*p++ = '#';
|
|
||||||
if (!--p_size) return 0;
|
|
||||||
*p++ = a;
|
|
||||||
if (!--p_size) return 0;
|
|
||||||
if (r)
|
|
||||||
{
|
|
||||||
snprintf(tmpbuf, sizeof(tmpbuf), "%hd", (short)r);
|
|
||||||
while (p_size-- && (*p = *p2++))
|
|
||||||
p++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!p_size--) return 0;
|
|
||||||
*p++ = ',';
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** returns the channelmode +f string (ie: '[5k,40j]:10') */
|
|
||||||
char *channel_modef_string(ChanFloodProt *x)
|
|
||||||
{
|
|
||||||
static char retbuf[512]; /* overkill :p */
|
|
||||||
char *p = retbuf;
|
|
||||||
*p++ = '[';
|
|
||||||
|
|
||||||
/* (alphabetized) */
|
|
||||||
if (x->l[FLD_CTCP])
|
|
||||||
p = chmodefstrhelper(p, sizeof(retbuf)-(p-retbuf), 'c', 'C', x->l[FLD_CTCP], x->a[FLD_CTCP], x->r[FLD_CTCP]);
|
|
||||||
if (x->l[FLD_JOIN])
|
|
||||||
p = chmodefstrhelper(p, sizeof(retbuf)-(p-retbuf), 'j', 'i', x->l[FLD_JOIN], x->a[FLD_JOIN], x->r[FLD_JOIN]);
|
|
||||||
if (x->l[FLD_KNOCK])
|
|
||||||
p = chmodefstrhelper(p, sizeof(retbuf)-(p-retbuf), 'k', 'K', x->l[FLD_KNOCK], x->a[FLD_KNOCK], x->r[FLD_KNOCK]);
|
|
||||||
if (x->l[FLD_MSG])
|
|
||||||
p = chmodefstrhelper(p, sizeof(retbuf)-(p-retbuf), 'm', 'm', x->l[FLD_MSG], x->a[FLD_MSG], x->r[FLD_MSG]);
|
|
||||||
if (x->l[FLD_NICK])
|
|
||||||
p = chmodefstrhelper(p, sizeof(retbuf)-(p-retbuf), 'n', 'N', x->l[FLD_NICK], x->a[FLD_NICK], x->r[FLD_NICK]);
|
|
||||||
if (x->l[FLD_TEXT])
|
|
||||||
p = chmodefstrhelper(p, sizeof(retbuf)-(p-retbuf), 't', '\0', x->l[FLD_TEXT], x->a[FLD_TEXT], x->r[FLD_TEXT]);
|
|
||||||
|
|
||||||
if (!p) return 0;
|
|
||||||
|
|
||||||
if (*(p - 1) == ',')
|
|
||||||
p--;
|
|
||||||
|
|
||||||
if (p>=retbuf) p=retbuf-2;
|
|
||||||
*p++ = ']';
|
|
||||||
ircsnprintf(p, sizeof(retbuf)-(p-retbuf), ":%hd", x->per);
|
|
||||||
return retbuf;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* write the "simple" list of channel modes for channel chptr onto buffer mbuf
|
* write the "simple" list of channel modes for channel chptr onto buffer mbuf
|
||||||
* with the parameters in pbuf.
|
* with the parameters in pbuf.
|
||||||
*/
|
*/
|
||||||
|
/* TODO: this function has many security issues and needs an audit, maybe even a recode */
|
||||||
void channel_modes(aClient *cptr, char *mbuf, char *pbuf, size_t mbuf_size, size_t pbuf_size, aChannel *chptr)
|
void channel_modes(aClient *cptr, char *mbuf, char *pbuf, size_t mbuf_size, size_t pbuf_size, aChannel *chptr)
|
||||||
{
|
{
|
||||||
aCtab *tab = &cFlagTab[0];
|
aCtab *tab = &cFlagTab[0];
|
||||||
@@ -963,43 +871,19 @@ void channel_modes(aClient *cptr, char *mbuf, char *pbuf, size_t mbuf_size, size
|
|||||||
pbuf+=strlen(pbuf);
|
pbuf+=strlen(pbuf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (*chptr->mode.link)
|
|
||||||
{
|
|
||||||
if (mbuf_size) {
|
|
||||||
*mbuf++ = 'L';
|
|
||||||
mbuf_size--;
|
|
||||||
}
|
|
||||||
if (ismember && pbuf_size) {
|
|
||||||
ircsnprintf(pbuf, pbuf_size, "%s ", chptr->mode.link);
|
|
||||||
pbuf_size-=strlen(pbuf);
|
|
||||||
pbuf+=strlen(pbuf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* if we add more parameter modes, add a space to the strings here --Stskeeps */
|
|
||||||
if (chptr->mode.floodprot)
|
|
||||||
{
|
|
||||||
if (mbuf_size) {
|
|
||||||
*mbuf++ = 'f';
|
|
||||||
mbuf_size--;
|
|
||||||
}
|
|
||||||
if (ismember && pbuf_size) {
|
|
||||||
ircsnprintf(pbuf, pbuf_size, "%s ", channel_modef_string(chptr->mode.floodprot));
|
|
||||||
pbuf_size-=strlen(pbuf);
|
|
||||||
pbuf+=strlen(pbuf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i=0; i <= Channelmode_highest; i++)
|
for (i=0; i <= Channelmode_highest; i++)
|
||||||
{
|
{
|
||||||
if (Channelmode_Table[i].flag && Channelmode_Table[i].paracount &&
|
if (Channelmode_Table[i].flag && Channelmode_Table[i].paracount &&
|
||||||
(chptr->mode.extmode & Channelmode_Table[i].mode)) {
|
(chptr->mode.extmode & Channelmode_Table[i].mode)) {
|
||||||
|
char flag = Channelmode_Table[i].flag;
|
||||||
if (mbuf_size) {
|
if (mbuf_size) {
|
||||||
*mbuf++ = Channelmode_Table[i].flag;
|
*mbuf++ = flag;
|
||||||
mbuf_size--;
|
mbuf_size--;
|
||||||
}
|
}
|
||||||
if (ismember)
|
if (ismember)
|
||||||
{
|
{
|
||||||
ircsnprintf(pbuf, pbuf_size, "%s ", Channelmode_Table[i].get_param(extcmode_get_struct(chptr->mode.extmodeparam, Channelmode_Table[i].flag)));
|
ircsnprintf(pbuf, pbuf_size, "%s ", cm_getparameter(chptr, flag));
|
||||||
pbuf_size-=strlen(pbuf);
|
pbuf_size-=strlen(pbuf);
|
||||||
pbuf+=strlen(pbuf);
|
pbuf+=strlen(pbuf);
|
||||||
}
|
}
|
||||||
@@ -1387,16 +1271,8 @@ void sub1_from_channel(aChannel *chptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* free extcmode params */
|
/* free extcmode params */
|
||||||
extcmode_free_paramlist(chptr->mode.extmodeparam);
|
extcmode_free_paramlist(chptr->mode.extmodeparams);
|
||||||
chptr->mode.extmodeparam = NULL;
|
|
||||||
|
|
||||||
chanfloodtimer_stopchantimers(chptr);
|
|
||||||
if (chptr->mode.floodprot)
|
|
||||||
MyFree(chptr->mode.floodprot);
|
|
||||||
|
|
||||||
#ifdef JOINTHROTTLE
|
|
||||||
cmodej_delchannelentries(chptr);
|
|
||||||
#endif
|
|
||||||
if (chptr->mode_lock)
|
if (chptr->mode_lock)
|
||||||
MyFree(chptr->mode_lock);
|
MyFree(chptr->mode_lock);
|
||||||
if (chptr->topic)
|
if (chptr->topic)
|
||||||
@@ -1415,73 +1291,6 @@ void sub1_from_channel(aChannel *chptr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int check_for_chan_flood(aClient *cptr, aClient *sptr, aChannel *chptr)
|
|
||||||
{
|
|
||||||
Membership *lp;
|
|
||||||
MembershipL *lp2;
|
|
||||||
int c_limit, t_limit, banthem;
|
|
||||||
|
|
||||||
if (!MyClient(sptr))
|
|
||||||
return 0;
|
|
||||||
if (IsOper(sptr) || IsULine(sptr))
|
|
||||||
return 0;
|
|
||||||
if (is_skochanop(sptr, chptr))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (!(lp = find_membership_link(sptr->user->channel, chptr)))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
lp2 = (MembershipL *) lp;
|
|
||||||
|
|
||||||
if (!chptr->mode.floodprot || !chptr->mode.floodprot->l[FLD_TEXT])
|
|
||||||
return 0;
|
|
||||||
c_limit = chptr->mode.floodprot->l[FLD_TEXT];
|
|
||||||
t_limit = chptr->mode.floodprot->per;
|
|
||||||
banthem = (chptr->mode.floodprot->a[FLD_TEXT] == 'b') ? 1 : 0;
|
|
||||||
|
|
||||||
/* if current - firstmsgtime >= mode.per, then reset,
|
|
||||||
* if nummsg > mode.msgs then kick/ban
|
|
||||||
*/
|
|
||||||
Debug((DEBUG_ERROR, "Checking for flood +f: firstmsg=%d (%ds ago), new nmsgs: %d, limit is: %d:%d",
|
|
||||||
lp2->flood.firstmsg, TStime() - lp2->flood.firstmsg, lp2->flood.nmsg + 1,
|
|
||||||
c_limit, t_limit));
|
|
||||||
if ((TStime() - lp2->flood.firstmsg) >= t_limit)
|
|
||||||
{
|
|
||||||
/* reset */
|
|
||||||
lp2->flood.firstmsg = TStime();
|
|
||||||
lp2->flood.nmsg = 1;
|
|
||||||
return 0; /* forget about it.. */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* increase msgs */
|
|
||||||
lp2->flood.nmsg++;
|
|
||||||
|
|
||||||
if ((lp2->flood.nmsg) > c_limit)
|
|
||||||
{
|
|
||||||
char comment[1024], mask[1024];
|
|
||||||
ircsnprintf(comment, sizeof(comment),
|
|
||||||
"Flooding (Limit is %i lines per %i seconds)",
|
|
||||||
c_limit, t_limit);
|
|
||||||
if (banthem)
|
|
||||||
{ /* ban. */
|
|
||||||
ircsnprintf(mask, sizeof(mask), "*!*@%s", GetHost(sptr));
|
|
||||||
add_listmode(&chptr->banlist, &me, chptr, mask);
|
|
||||||
sendto_server(&me, 0, 0, ":%s MODE %s +b %s 0",
|
|
||||||
me.name, chptr->chname, mask);
|
|
||||||
sendto_channel_butserv(chptr, &me,
|
|
||||||
":%s MODE %s +b %s", me.name, chptr->chname, mask);
|
|
||||||
}
|
|
||||||
sendto_channel_butserv(chptr, &me,
|
|
||||||
":%s KICK %s %s :%s", me.name,
|
|
||||||
chptr->chname, sptr->name, comment);
|
|
||||||
sendto_server(cptr, 0, 0, ":%s KICK %s %s :%s",
|
|
||||||
me.name, chptr->chname, sptr->name, comment);
|
|
||||||
remove_user_from_channel(sptr, chptr);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void send_user_joins(aClient *cptr, aClient *user)
|
void send_user_joins(aClient *cptr, aClient *user)
|
||||||
{
|
{
|
||||||
Membership *lp;
|
Membership *lp;
|
||||||
@@ -1528,24 +1337,46 @@ void send_user_joins(aClient *cptr, aClient *user)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* rejoin_doquits:
|
* rejoin_leave:
|
||||||
* sends a QUIT to all common channels (to local users only)
|
* sends a PART to all channels (to local users only)
|
||||||
|
* TODO: use QUIT instead of PART if configured to do so
|
||||||
*/
|
*/
|
||||||
void rejoin_doquits(aClient *sptr)
|
void rejoin_leave(aClient *sptr)
|
||||||
{
|
{
|
||||||
Membership *tmp;
|
Membership *tmp;
|
||||||
aChannel *chptr;
|
aChannel *chptr;
|
||||||
char *comment = "Changing host";
|
char *comment = "Rejoining because of user@host change";
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
sendto_common_channels(sptr, ":%s!%s@%s QUIT :%s", sptr->name, sptr->user->username, GetHost(sptr), comment);
|
for (tmp = sptr->user->channel; tmp; tmp = tmp->next)
|
||||||
|
{
|
||||||
|
tmp->flags &= ~CHFL_REJOINING;
|
||||||
|
|
||||||
|
chptr = tmp->chptr;
|
||||||
|
if (!chptr)
|
||||||
|
continue; /* Possible? */
|
||||||
|
|
||||||
|
/* If the user is banned, don't do it */
|
||||||
|
if (is_banned(sptr, chptr, BANCHK_JOIN))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* Ok, we will now part/quit/whatever the user, so tag it.. */
|
||||||
|
tmp->flags |= CHFL_REJOINING;
|
||||||
|
|
||||||
|
if ((chptr->mode.mode & MODE_AUDITORIUM) &&
|
||||||
|
!(tmp->flags & (CHFL_CHANOWNER|CHFL_CHANPROT|CHFL_CHANOP)))
|
||||||
|
{
|
||||||
|
sendto_chanops_butone(sptr, chptr, ":%s!%s@%s PART %s :%s", sptr->name, sptr->user->username, GetHost(sptr), chptr->chname, comment);
|
||||||
|
} else
|
||||||
|
sendto_channel_butserv_butone(chptr, sptr, sptr, ":%s PART %s :%s", sptr->name, chptr->chname, comment);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* rejoin_dojoinandmode:
|
* rejoin_joinandmode:
|
||||||
* sends a JOIN and a MODE (if needed) to restore qaohv modes (to local users only)
|
* sends a JOIN and a MODE (if needed) to restore qaohv modes (to local users only)
|
||||||
*/
|
*/
|
||||||
void rejoin_dojoinandmode(aClient *sptr)
|
void rejoin_joinandmode(aClient *sptr)
|
||||||
{
|
{
|
||||||
Membership *tmp;
|
Membership *tmp;
|
||||||
aChannel *chptr;
|
aChannel *chptr;
|
||||||
@@ -1559,6 +1390,10 @@ void rejoin_dojoinandmode(aClient *sptr)
|
|||||||
if (!chptr)
|
if (!chptr)
|
||||||
continue; /* Is it possible? */
|
continue; /* Is it possible? */
|
||||||
|
|
||||||
|
/* If the user is banned, don't do it */
|
||||||
|
if (!(flags & CHFL_REJOINING))
|
||||||
|
continue;
|
||||||
|
|
||||||
if ((chptr->mode.mode & MODE_AUDITORIUM) &&
|
if ((chptr->mode.mode & MODE_AUDITORIUM) &&
|
||||||
!(flags & (CHFL_CHANOWNER|CHFL_CHANPROT|CHFL_CHANOP)))
|
!(flags & (CHFL_CHANOWNER|CHFL_CHANPROT|CHFL_CHANOP)))
|
||||||
{
|
{
|
||||||
@@ -1591,220 +1426,12 @@ void rejoin_dojoinandmode(aClient *sptr)
|
|||||||
if (i < n - 1)
|
if (i < n - 1)
|
||||||
strcat(parabuf, " ");
|
strcat(parabuf, " ");
|
||||||
}
|
}
|
||||||
|
sendto_channel_butserv_butone(chptr, &me, sptr, ":%s MODE %s +%s %s",
|
||||||
|
me.name, chptr->chname, flagbuf, parabuf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MODVAR RemoveFld *removefld_list = NULL;
|
|
||||||
|
|
||||||
RemoveFld *chanfloodtimer_find(aChannel *chptr, char mflag)
|
|
||||||
{
|
|
||||||
RemoveFld *e;
|
|
||||||
|
|
||||||
for (e=removefld_list; e; e=e->next)
|
|
||||||
{
|
|
||||||
if ((e->chptr == chptr) && (e->m == mflag))
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Adds a "remove channelmode set by +f" timer.
|
|
||||||
* chptr Channel
|
|
||||||
* mflag Mode flag, eg 'C'
|
|
||||||
* mbit Mode bitflag, eg MODE_NOCTCP
|
|
||||||
* when when it should be removed
|
|
||||||
* NOTES:
|
|
||||||
* - This function takes care of overwriting of any previous timer
|
|
||||||
* for the same modechar.
|
|
||||||
* - The function takes care of chptr->mode.floodprot->timer_flags,
|
|
||||||
* do not modify it yourself.
|
|
||||||
* - chptr->mode.floodprot is asumed to be non-NULL.
|
|
||||||
*/
|
|
||||||
void chanfloodtimer_add(aChannel *chptr, char mflag, long mbit, time_t when)
|
|
||||||
{
|
|
||||||
RemoveFld *e = NULL;
|
|
||||||
unsigned char add=1;
|
|
||||||
|
|
||||||
if (chptr->mode.floodprot->timer_flags & mbit)
|
|
||||||
{
|
|
||||||
/* Already exists... */
|
|
||||||
e = chanfloodtimer_find(chptr, mflag);
|
|
||||||
if (e)
|
|
||||||
add = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (add)
|
|
||||||
e = MyMallocEx(sizeof(RemoveFld));
|
|
||||||
|
|
||||||
e->chptr = chptr;
|
|
||||||
e->m = mflag;
|
|
||||||
e->when = when;
|
|
||||||
|
|
||||||
if (add)
|
|
||||||
AddListItem(e, removefld_list);
|
|
||||||
|
|
||||||
chptr->mode.floodprot->timer_flags |= mbit;
|
|
||||||
}
|
|
||||||
|
|
||||||
void chanfloodtimer_del(aChannel *chptr, char mflag, long mbit)
|
|
||||||
{
|
|
||||||
RemoveFld *e;
|
|
||||||
|
|
||||||
if (chptr->mode.floodprot && !(chptr->mode.floodprot->timer_flags & mbit))
|
|
||||||
return; /* nothing to remove.. */
|
|
||||||
e = chanfloodtimer_find(chptr, mflag);
|
|
||||||
if (!e)
|
|
||||||
return;
|
|
||||||
|
|
||||||
DelListItem(e, removefld_list);
|
|
||||||
|
|
||||||
if (chptr->mode.floodprot)
|
|
||||||
chptr->mode.floodprot->timer_flags &= ~mbit;
|
|
||||||
}
|
|
||||||
|
|
||||||
long get_chanbitbychar(char m)
|
|
||||||
{
|
|
||||||
aCtab *tab = &cFlagTab[0];
|
|
||||||
while(tab->mode != 0x0)
|
|
||||||
{
|
|
||||||
if (tab->flag == m)
|
|
||||||
return tab->mode;
|
|
||||||
tab++;;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
EVENT(modef_event)
|
|
||||||
{
|
|
||||||
RemoveFld *e = removefld_list;
|
|
||||||
time_t now;
|
|
||||||
long mode;
|
|
||||||
|
|
||||||
now = TStime();
|
|
||||||
|
|
||||||
while(e)
|
|
||||||
{
|
|
||||||
if (e->when <= now)
|
|
||||||
{
|
|
||||||
/* Remove chanmode... */
|
|
||||||
#ifdef NEWFLDDBG
|
|
||||||
sendto_realops("modef_event: chan %s mode -%c EXPIRED", e->chptr->chname, e->m);
|
|
||||||
#endif
|
|
||||||
mode = get_chanbitbychar(e->m);
|
|
||||||
if (e->chptr->mode.mode & mode)
|
|
||||||
{
|
|
||||||
sendto_server(&me, 0, 0, ":%s MODE %s -%c 0", me.name, e->chptr->chname, e->m);
|
|
||||||
sendto_channel_butserv(e->chptr, &me, ":%s MODE %s -%c", me.name, e->chptr->chname, e->m);
|
|
||||||
e->chptr->mode.mode &= ~mode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* And delete... */
|
|
||||||
e = (RemoveFld *)DelListItem(e, removefld_list);
|
|
||||||
} else {
|
|
||||||
#ifdef NEWFLDDBG
|
|
||||||
sendto_realops("modef_event: chan %s mode -%c about %d seconds",
|
|
||||||
e->chptr->chname, e->m, e->when - now);
|
|
||||||
#endif
|
|
||||||
e = e->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void init_modef()
|
|
||||||
{
|
|
||||||
EventAddEx(NULL, "modef_event", 10, 0, modef_event, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
void chanfloodtimer_stopchantimers(aChannel *chptr)
|
|
||||||
{
|
|
||||||
RemoveFld *e = removefld_list;
|
|
||||||
while(e)
|
|
||||||
{
|
|
||||||
if (e->chptr == chptr)
|
|
||||||
e = (RemoveFld *)DelListItem(e, removefld_list);
|
|
||||||
else
|
|
||||||
e = e->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int do_chanflood(ChanFloodProt *chp, int what)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (!chp || !chp->l[what]) /* no +f or not restricted */
|
|
||||||
return 0;
|
|
||||||
if (TStime() - chp->t[what] >= chp->per)
|
|
||||||
{
|
|
||||||
chp->t[what] = TStime();
|
|
||||||
chp->c[what] = 1;
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
chp->c[what]++;
|
|
||||||
if ((chp->c[what] > chp->l[what]) &&
|
|
||||||
(TStime() - chp->t[what] < chp->per))
|
|
||||||
{
|
|
||||||
/* reset it too (makes it easier for chanops to handle the situation) */
|
|
||||||
/*
|
|
||||||
*XXchp->t[what] = TStime();
|
|
||||||
*XXchp->c[what] = 1;
|
|
||||||
*
|
|
||||||
* BAD.. there are some situations where we might 'miss' a flood
|
|
||||||
* because of this. The reset has been moved to -i,-m,-N,-C,etc.
|
|
||||||
*/
|
|
||||||
return 1; /* flood detected! */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void do_chanflood_action(aChannel *chptr, int what, char *text)
|
|
||||||
{
|
|
||||||
long modeflag = 0;
|
|
||||||
aCtab *tab = &cFlagTab[0];
|
|
||||||
char m;
|
|
||||||
|
|
||||||
m = chptr->mode.floodprot->a[what];
|
|
||||||
if (!m)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* [TODO: add extended channel mode support] */
|
|
||||||
|
|
||||||
while(tab->mode != 0x0)
|
|
||||||
{
|
|
||||||
if (tab->flag == m)
|
|
||||||
{
|
|
||||||
modeflag = tab->mode;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
tab++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!modeflag)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!(chptr->mode.mode & modeflag))
|
tmp->flags &= ~CHFL_REJOINING; /* esthetics.. ;) */
|
||||||
{
|
|
||||||
char comment[1024], target[CHANNELLEN + 8];
|
|
||||||
ircsnprintf(comment, sizeof(comment), "*** Channel %sflood detected (limit is %d per %d seconds), setting mode +%c",
|
|
||||||
text, chptr->mode.floodprot->l[what], chptr->mode.floodprot->per, m);
|
|
||||||
ircsnprintf(target, sizeof(target), "%%%s", chptr->chname);
|
|
||||||
sendto_channelprefix_butone(NULL, &me, chptr,
|
|
||||||
PREFIX_HALFOP|PREFIX_OP|PREFIX_ADMIN|PREFIX_OWNER,
|
|
||||||
":%s NOTICE %s :%s", me.name, target, comment);
|
|
||||||
sendto_server(&me, 0, 0, ":%s MODE %s +%c 0", me.name, chptr->chname, m);
|
|
||||||
sendto_channel_butserv(chptr, &me, ":%s MODE %s +%c", me.name, chptr->chname, m);
|
|
||||||
chptr->mode.mode |= modeflag;
|
|
||||||
if (chptr->mode.floodprot->r[what]) /* Add remove-chanmode timer... */
|
|
||||||
{
|
|
||||||
chanfloodtimer_add(chptr, m, modeflag, TStime() + ((long)chptr->mode.floodprot->r[what] * 60) - 5);
|
|
||||||
/* (since the chanflood timer event is called every 10s, we do -5 here so the accurancy will
|
|
||||||
* be -5..+5, without it it would be 0..+10.)
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-4
@@ -39,9 +39,6 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#include "proto.h"
|
#include "proto.h"
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
#include "badwords.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
@@ -91,7 +88,7 @@ struct _langlist
|
|||||||
|
|
||||||
/* MUST be alphabetized (first column) */
|
/* MUST be alphabetized (first column) */
|
||||||
static LangList langlist[] = {
|
static LangList langlist[] = {
|
||||||
{ "arabic", "ara", LANGAV_ASCII|LANGAV_ISO8859_6 },
|
/* { "arabic", "ara", LANGAV_ASCII|LANGAV_ISO8859_6 }, -- TODO: check if this has issues first! */
|
||||||
{ "belarussian-w1251", "blr", LANGAV_ASCII|LANGAV_W1251 },
|
{ "belarussian-w1251", "blr", LANGAV_ASCII|LANGAV_W1251 },
|
||||||
{ "catalan", "cat", LANGAV_ASCII|LANGAV_LATIN1 },
|
{ "catalan", "cat", LANGAV_ASCII|LANGAV_LATIN1 },
|
||||||
{ "chinese", "chi-j,chi-s,chi-t", LANGAV_GBK },
|
{ "chinese", "chi-j,chi-s,chi-t", LANGAV_GBK },
|
||||||
|
|||||||
+1
-1
@@ -156,7 +156,7 @@ int dbuf_getmsg(dbuf *dyn, char *buf)
|
|||||||
*
|
*
|
||||||
* --adx
|
* --adx
|
||||||
*/
|
*/
|
||||||
list_for_each_entry(block, &dyn->dbuf_list, dbuf_node)
|
list_for_each_entry2(block, dbufbuf, &dyn->dbuf_list, dbuf_node)
|
||||||
{
|
{
|
||||||
for (idx = 0; idx < block->size; idx++)
|
for (idx = 0; idx < block->size; idx++)
|
||||||
{
|
{
|
||||||
|
|||||||
+3
-8
@@ -45,9 +45,6 @@ ID_Copyright("(C) Carsten Munk 2001");
|
|||||||
|
|
||||||
MODVAR Event *events = NULL;
|
MODVAR Event *events = NULL;
|
||||||
|
|
||||||
#ifdef JOINTHROTTLE
|
|
||||||
extern EVENT(cmodej_cleanup_structs);
|
|
||||||
#endif
|
|
||||||
extern EVENT(unrealdns_removeoldrecords);
|
extern EVENT(unrealdns_removeoldrecords);
|
||||||
|
|
||||||
void LockEventSystem(void)
|
void LockEventSystem(void)
|
||||||
@@ -215,13 +212,11 @@ void SetupEvents(void)
|
|||||||
EventAddEx(NULL, "tunefile", 300, 0, save_tunefile, NULL);
|
EventAddEx(NULL, "tunefile", 300, 0, save_tunefile, NULL);
|
||||||
EventAddEx(NULL, "garbage", GARBAGE_COLLECT_EVERY, 0, garbage_collect, NULL);
|
EventAddEx(NULL, "garbage", GARBAGE_COLLECT_EVERY, 0, garbage_collect, NULL);
|
||||||
EventAddEx(NULL, "loop", 0, 0, loop_event, NULL);
|
EventAddEx(NULL, "loop", 0, 0, loop_event, NULL);
|
||||||
#ifdef JOINTHROTTLE
|
|
||||||
EventAddEx(NULL, "cmodej_cleanup_structs", 60, 0, cmodej_cleanup_structs, NULL);
|
|
||||||
#endif
|
|
||||||
EventAddEx(NULL, "unrealdns_removeoldrecords", 15, 0, unrealdns_removeoldrecords, NULL);
|
EventAddEx(NULL, "unrealdns_removeoldrecords", 15, 0, unrealdns_removeoldrecords, NULL);
|
||||||
EventAddEx(NULL, "check_pings", 9, 0, check_pings, NULL);
|
EventAddEx(NULL, "check_pings", 1, 0, check_pings, NULL);
|
||||||
|
EventAddEx(NULL, "check_deadsockets", 1, 0, check_deadsockets, NULL);
|
||||||
EventAddEx(NULL, "check_unknowns", 16, 0, check_unknowns, NULL);
|
EventAddEx(NULL, "check_unknowns", 16, 0, check_unknowns, NULL);
|
||||||
EventAddEx(NULL, "try_connections", 15, 0, try_connections, NULL);
|
EventAddEx(NULL, "try_connections", 10, 0, try_connections, NULL);
|
||||||
|
|
||||||
UnlockEventSystem();
|
UnlockEventSystem();
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -370,7 +370,7 @@ char pfix[8];
|
|||||||
if (!ret)
|
if (!ret)
|
||||||
ret = make_nick_user_host(trim_str(cp,NICKLEN), trim_str(user,USERLEN), trim_str(host,HOSTLEN));
|
ret = make_nick_user_host(trim_str(cp,NICKLEN), trim_str(user,USERLEN), trim_str(host,HOSTLEN));
|
||||||
|
|
||||||
ircsnprintf(retbuf, USERLEN + NICKLEN + HOSTLEN + 32, "%s%s", pfix, ret);
|
ircsnprintf(retbuf, sizeof(retbuf), "%s%s", pfix, ret);
|
||||||
return retbuf;
|
return retbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+101
-281
@@ -44,6 +44,9 @@
|
|||||||
|
|
||||||
extern char cmodestring[512];
|
extern char cmodestring[512];
|
||||||
|
|
||||||
|
/* Channel parameter to slot# mapping */
|
||||||
|
unsigned char param_to_slot_mapping[256];
|
||||||
|
|
||||||
extern void make_cmodestr(void);
|
extern void make_cmodestr(void);
|
||||||
|
|
||||||
char extchmstr[4][64];
|
char extchmstr[4][64];
|
||||||
@@ -51,26 +54,9 @@ char extchmstr[4][64];
|
|||||||
Cmode *Channelmode_Table = NULL;
|
Cmode *Channelmode_Table = NULL;
|
||||||
unsigned short Channelmode_highest = 0;
|
unsigned short Channelmode_highest = 0;
|
||||||
|
|
||||||
Cmode_t EXTMODE_NONOTICE = 0L;
|
Cmode *ParamTable[MAXPARAMMODES+1];
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
Cmode_t EXTMODE_STRIPBADWORDS = 0L;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef JOINTHROTTLE
|
Cmode_t EXTMODE_NONOTICE = 0L;
|
||||||
/* cmode j stuff... */
|
|
||||||
Cmode_t EXTMODE_JOINTHROTTLE = 0L;
|
|
||||||
int cmodej_is_ok(aClient *sptr, aChannel *chptr, char *para, int type, int what);
|
|
||||||
CmodeParam *cmodej_put_param(CmodeParam *r_in, char *param);
|
|
||||||
char *cmodej_get_param(CmodeParam *r_in);
|
|
||||||
char *cmodej_conv_param(char *param_in);
|
|
||||||
void cmodej_free_param(CmodeParam *r);
|
|
||||||
CmodeParam *cmodej_dup_struct(CmodeParam *r_in);
|
|
||||||
int cmodej_sjoin_check(aChannel *chptr, CmodeParam *ourx, CmodeParam *theirx);
|
|
||||||
#endif
|
|
||||||
int extcmode_cmodeT_requirechop(aClient *cptr, aChannel *chptr, char *para, int checkt, int what);
|
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
int extcmode_cmodeG_requirechop(aClient *cptr, aChannel *chptr, char *para, int checkt, int what);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void make_extcmodestr()
|
void make_extcmodestr()
|
||||||
{
|
{
|
||||||
@@ -82,13 +68,19 @@ int i;
|
|||||||
/* type 1: lists (like b/e) */
|
/* type 1: lists (like b/e) */
|
||||||
/* [NOT IMPLEMENTED IN EXTCMODES] */
|
/* [NOT IMPLEMENTED IN EXTCMODES] */
|
||||||
|
|
||||||
/* type 2: 1 par to set/unset */
|
/* type 2: 1 par to set/unset (has .unset_with_param) */
|
||||||
/* [NOT IMPLEMENTED] */
|
|
||||||
|
|
||||||
/* type 3: 1 param to set, 0 params to unset */
|
|
||||||
p = extchmstr[2];
|
p = extchmstr[2];
|
||||||
for (i=0; i <= Channelmode_highest; i++)
|
for (i=0; i <= Channelmode_highest; i++)
|
||||||
if (Channelmode_Table[i].paracount && Channelmode_Table[i].flag)
|
if (Channelmode_Table[i].paracount && Channelmode_Table[i].flag &&
|
||||||
|
Channelmode_Table[i].unset_with_param)
|
||||||
|
*p++ = Channelmode_Table[i].flag;
|
||||||
|
*p = '\0';
|
||||||
|
|
||||||
|
/* type 3: 1 param to set, 0 params to unset (does not have .unset_with_param) */
|
||||||
|
p = extchmstr[2];
|
||||||
|
for (i=0; i <= Channelmode_highest; i++)
|
||||||
|
if (Channelmode_Table[i].paracount && Channelmode_Table[i].flag &&
|
||||||
|
!Channelmode_Table[i].unset_with_param)
|
||||||
*p++ = Channelmode_Table[i].flag;
|
*p++ = Channelmode_Table[i].flag;
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
|
|
||||||
@@ -106,29 +98,9 @@ static void load_extendedchanmodes(void)
|
|||||||
memset(&req, 0, sizeof(req));
|
memset(&req, 0, sizeof(req));
|
||||||
|
|
||||||
req.paracount = 0;
|
req.paracount = 0;
|
||||||
req.is_ok = extcmode_cmodeT_requirechop;
|
req.is_ok = extcmode_default_requirechop;
|
||||||
req.flag = 'T';
|
req.flag = 'T';
|
||||||
CmodeAdd(NULL, req, &EXTMODE_NONOTICE);
|
CmodeAdd(NULL, req, &EXTMODE_NONOTICE);
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
req.flag = 'G';
|
|
||||||
req.is_ok = extcmode_cmodeG_requirechop;
|
|
||||||
CmodeAdd(NULL, req, &EXTMODE_STRIPBADWORDS);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef JOINTHROTTLE
|
|
||||||
/* +j */
|
|
||||||
memset(&req, 0, sizeof(req));
|
|
||||||
req.paracount = 1;
|
|
||||||
req.is_ok = cmodej_is_ok;
|
|
||||||
req.flag = 'j';
|
|
||||||
req.put_param = cmodej_put_param;
|
|
||||||
req.get_param = cmodej_get_param;
|
|
||||||
req.conv_param = cmodej_conv_param;
|
|
||||||
req.free_param = cmodej_free_param;
|
|
||||||
req.dup_struct = cmodej_dup_struct;
|
|
||||||
req.sjoin_check = cmodej_sjoin_check;
|
|
||||||
CmodeAdd(NULL, req, &EXTMODE_JOINTHROTTLE);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void extcmode_init(void)
|
void extcmode_init(void)
|
||||||
@@ -144,14 +116,26 @@ void extcmode_init(void)
|
|||||||
}
|
}
|
||||||
Channelmode_highest = 0;
|
Channelmode_highest = 0;
|
||||||
memset(&extchmstr, 0, sizeof(extchmstr));
|
memset(&extchmstr, 0, sizeof(extchmstr));
|
||||||
|
memset(¶m_to_slot_mapping, 0, sizeof(param_to_slot_mapping));
|
||||||
|
|
||||||
/* And load the build-in extended chanmodes... */
|
/* And load the build-in extended chanmodes... */
|
||||||
load_extendedchanmodes();
|
load_extendedchanmodes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Update letter->slot mapping and slot->handler mapping */
|
||||||
|
void extcmode_para_addslot(Cmode *c, int slot)
|
||||||
|
{
|
||||||
|
if ((slot < 0) || (slot > MAXPARAMMODES))
|
||||||
|
abort();
|
||||||
|
c->slot = slot;
|
||||||
|
ParamTable[slot] = c;
|
||||||
|
param_to_slot_mapping[c->flag] = slot;
|
||||||
|
}
|
||||||
|
|
||||||
Cmode *CmodeAdd(Module *module, CmodeInfo req, Cmode_t *mode)
|
Cmode *CmodeAdd(Module *module, CmodeInfo req, Cmode_t *mode)
|
||||||
{
|
{
|
||||||
short i = 0, j = 0;
|
short i = 0, j = 0;
|
||||||
|
int paraslot = -1;
|
||||||
char tmpbuf[512];
|
char tmpbuf[512];
|
||||||
|
|
||||||
while (i < EXTCMODETABLESZ)
|
while (i < EXTCMODETABLESZ)
|
||||||
@@ -179,6 +163,19 @@ Cmode *CmodeAdd(Module *module, CmodeInfo req, Cmode_t *mode)
|
|||||||
module->errorcode = MODERR_NOSPACE;
|
module->errorcode = MODERR_NOSPACE;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (req.paracount == 1)
|
||||||
|
{
|
||||||
|
for (paraslot = 0; ParamTable[paraslot]; paraslot++)
|
||||||
|
if (paraslot == MAXPARAMMODES - 1)
|
||||||
|
{
|
||||||
|
Debug((DEBUG_DEBUG, "CmodeAdd failed, no space for parameter"));
|
||||||
|
if (module)
|
||||||
|
module->errorcode = MODERR_NOSPACE;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
*mode = Channelmode_Table[i].mode;
|
*mode = Channelmode_Table[i].mode;
|
||||||
/* Update extended channel mode table highest */
|
/* Update extended channel mode table highest */
|
||||||
Channelmode_Table[i].flag = req.flag;
|
Channelmode_Table[i].flag = req.flag;
|
||||||
@@ -191,12 +188,17 @@ Cmode *CmodeAdd(Module *module, CmodeInfo req, Cmode_t *mode)
|
|||||||
Channelmode_Table[i].dup_struct = req.dup_struct;
|
Channelmode_Table[i].dup_struct = req.dup_struct;
|
||||||
Channelmode_Table[i].sjoin_check = req.sjoin_check;
|
Channelmode_Table[i].sjoin_check = req.sjoin_check;
|
||||||
Channelmode_Table[i].local = req.local;
|
Channelmode_Table[i].local = req.local;
|
||||||
|
Channelmode_Table[i].unset_with_param = req.unset_with_param;
|
||||||
Channelmode_Table[i].owner = module;
|
Channelmode_Table[i].owner = module;
|
||||||
|
|
||||||
for (j = 0; j < EXTCMODETABLESZ; j++)
|
for (j = 0; j < EXTCMODETABLESZ; j++)
|
||||||
if (Channelmode_Table[j].flag)
|
if (Channelmode_Table[j].flag)
|
||||||
if (j > Channelmode_highest)
|
if (j > Channelmode_highest)
|
||||||
Channelmode_highest = j;
|
Channelmode_highest = j;
|
||||||
|
|
||||||
|
if (Channelmode_Table[i].paracount == 1)
|
||||||
|
extcmode_para_addslot(&Channelmode_Table[i], paraslot);
|
||||||
|
|
||||||
if (module)
|
if (module)
|
||||||
{
|
{
|
||||||
ModuleObject *cmodeobj = MyMallocEx(sizeof(ModuleObject));
|
ModuleObject *cmodeobj = MyMallocEx(sizeof(ModuleObject));
|
||||||
@@ -285,95 +287,81 @@ int i;
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** searches in chptr extmode parameters and returns entry or NULL. */
|
void extcmode_duplicate_paramlist(void **xi, void **xo)
|
||||||
CmodeParam *extcmode_get_struct(CmodeParam *p, char ch)
|
|
||||||
{
|
|
||||||
|
|
||||||
while(p)
|
|
||||||
{
|
|
||||||
if (p->flag == ch)
|
|
||||||
return p;
|
|
||||||
p = p->next;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* bit inefficient :/ */
|
|
||||||
CmodeParam *extcmode_duplicate_paramlist(CmodeParam *lst)
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
Cmode *tbl;
|
Cmode *handler;
|
||||||
CmodeParam *head = NULL, *n;
|
void *inx;
|
||||||
|
|
||||||
while(lst)
|
for (i = 0; i < MAXPARAMMODES; i++)
|
||||||
{
|
{
|
||||||
tbl = NULL;
|
handler = CMP_GETHANDLERBYSLOT(i);
|
||||||
for (i=0; i <= Channelmode_highest; i++)
|
if (!handler)
|
||||||
{
|
continue; /* nothing there.. */
|
||||||
if (Channelmode_Table[i].flag == lst->flag)
|
inx = xi[handler->slot]; /* paramter data of input is here */
|
||||||
{
|
if (!inx)
|
||||||
tbl = &Channelmode_Table[i]; /* & ? */
|
continue; /* not set */
|
||||||
break;
|
xo[handler->slot] = handler->dup_struct(inx); /* call dup_struct with that input and set the output param to that */
|
||||||
}
|
|
||||||
}
|
|
||||||
n = tbl->dup_struct(lst);
|
|
||||||
n->next = n->prev = NULL; /* safety (required!) */
|
|
||||||
if (head)
|
|
||||||
{
|
|
||||||
AddListItem(n, head);
|
|
||||||
} else {
|
|
||||||
head = n;
|
|
||||||
}
|
|
||||||
lst = lst->next;
|
|
||||||
}
|
}
|
||||||
return head;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void extcmode_free_paramlist(CmodeParam *lst)
|
void extcmode_free_paramlist(void **ar)
|
||||||
{
|
{
|
||||||
CmodeParam *n;
|
int i;
|
||||||
int i;
|
Cmode *handler;
|
||||||
Cmode *tbl;
|
|
||||||
|
|
||||||
while(lst)
|
for (i = 0; i < MAXPARAMMODES; i++)
|
||||||
{
|
{
|
||||||
/* first remove it from the list... */
|
handler = GETPARAMHANDLERBYSLOT(i);
|
||||||
n = lst;
|
if (!handler)
|
||||||
DelListItem(n, lst);
|
continue; /* nothing here... */
|
||||||
/* then hunt for the param free function and let it free */
|
handler->free_param(ar[handler->slot]);
|
||||||
tbl = NULL;
|
ar[handler->slot] = NULL;
|
||||||
for (i=0; i <= Channelmode_highest; i++)
|
|
||||||
{
|
|
||||||
if (Channelmode_Table[i].flag == n->flag)
|
|
||||||
{
|
|
||||||
tbl = &Channelmode_Table[i]; /* & ? */
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
tbl->free_param(n);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ok this is my mistake @ EXCHK_ACCESS_ERR error msg:
|
char *cm_getparameter(aChannel *chptr, char mode)
|
||||||
* the is_ok() thing does not know which mode it belongs to,
|
{
|
||||||
* this is normally redundant information of course but in
|
return GETPARAMHANDLERBYLETTER(mode)->get_param(GETPARASTRUCT(chptr, mode));
|
||||||
* case of a default handler like these, it's required to
|
}
|
||||||
* know which setting of mode failed (the mode char).
|
|
||||||
* I just return '?' for now, better than nothing.
|
|
||||||
* TO SUMMARIZE: Do not use extcmode_default_requirechop for new modules :p.
|
|
||||||
* Obviously in Unreal3.3* we should fix this. -- Syzop
|
|
||||||
*/
|
|
||||||
|
|
||||||
int extcmode_default_requirechop(aClient *cptr, aChannel *chptr, char *para, int checkt, int what)
|
void cm_putparameter(aChannel *chptr, char mode, char *str)
|
||||||
|
{
|
||||||
|
GETPARASTRUCT(chptr, mode) = GETPARAMHANDLERBYLETTER(mode)->put_param(GETPARASTRUCT(chptr, mode), str);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cm_freeparameter(aChannel *chptr, char mode)
|
||||||
|
{
|
||||||
|
GETPARAMHANDLERBYLETTER(mode)->free_param(GETPARASTRUCT(chptr, mode));
|
||||||
|
GETPARASTRUCT(chptr, mode) = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *cm_getparameter_ex(void **p, char mode)
|
||||||
|
{
|
||||||
|
return GETPARAMHANDLERBYLETTER(mode)->get_param(GETPARASTRUCTEX(p, mode));
|
||||||
|
}
|
||||||
|
|
||||||
|
void cm_putparameter_ex(void **p, char mode, char *str)
|
||||||
|
{
|
||||||
|
GETPARASTRUCTEX(p, mode) = GETPARAMHANDLERBYLETTER(mode)->put_param(GETPARASTRUCTEX(p, mode), str);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cm_freeparameter_ex(void **p, char mode, char *str)
|
||||||
|
{
|
||||||
|
GETPARAMHANDLERBYLETTER(mode)->free_param(GETPARASTRUCTEX(p, mode));
|
||||||
|
GETPARASTRUCTEX(p, mode) = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
int extcmode_default_requirechop(aClient *cptr, aChannel *chptr, char mode, char *para, int checkt, int what)
|
||||||
{
|
{
|
||||||
if (IsPerson(cptr) && is_chan_op(cptr, chptr))
|
if (IsPerson(cptr) && is_chan_op(cptr, chptr))
|
||||||
return EX_ALLOW;
|
return EX_ALLOW;
|
||||||
if (checkt == EXCHK_ACCESS_ERR) /* can only be due to being halfop */
|
if (checkt == EXCHK_ACCESS_ERR) /* can only be due to being halfop */
|
||||||
sendto_one(cptr, err_str(ERR_NOTFORHALFOPS), me.name, cptr->name, '?');
|
sendto_one(cptr, err_str(ERR_NOTFORHALFOPS), me.name, cptr->name, mode);
|
||||||
return EX_DENY;
|
return EX_DENY;
|
||||||
}
|
}
|
||||||
|
|
||||||
int extcmode_default_requirehalfop(aClient *cptr, aChannel *chptr, char *para, int checkt, int what)
|
int extcmode_default_requirehalfop(aClient *cptr, aChannel *chptr, char mode, char *para, int checkt, int what)
|
||||||
{
|
{
|
||||||
if (IsPerson(cptr) &&
|
if (IsPerson(cptr) &&
|
||||||
(is_chan_op(cptr, chptr) || is_half_op(cptr, chptr)))
|
(is_chan_op(cptr, chptr) || is_half_op(cptr, chptr)))
|
||||||
@@ -381,171 +369,3 @@ int extcmode_default_requirehalfop(aClient *cptr, aChannel *chptr, char *para, i
|
|||||||
return EX_DENY;
|
return EX_DENY;
|
||||||
}
|
}
|
||||||
|
|
||||||
int extcmode_cmodeT_requirechop(aClient *cptr, aChannel *chptr, char *para, int checkt, int what)
|
|
||||||
{
|
|
||||||
if (IsPerson(cptr) && is_chan_op(cptr, chptr))
|
|
||||||
return EX_ALLOW;
|
|
||||||
if (checkt == EXCHK_ACCESS_ERR) /* can only be due to being halfop */
|
|
||||||
sendto_one(cptr, err_str(ERR_NOTFORHALFOPS), me.name, cptr->name, 'T');
|
|
||||||
return EX_DENY;
|
|
||||||
}
|
|
||||||
|
|
||||||
int extcmode_cmodeG_requirechop(aClient *cptr, aChannel *chptr, char *para, int checkt, int what)
|
|
||||||
{
|
|
||||||
if (IsPerson(cptr) && is_chan_op(cptr, chptr))
|
|
||||||
return EX_ALLOW;
|
|
||||||
if (checkt == EXCHK_ACCESS_ERR) /* can only be due to being halfop */
|
|
||||||
sendto_one(cptr, err_str(ERR_NOTFORHALFOPS), me.name, cptr->name, 'G');
|
|
||||||
return EX_DENY;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef JOINTHROTTLE
|
|
||||||
/*** CHANNEL MODE +j STUFF ******/
|
|
||||||
int cmodej_is_ok(aClient *sptr, aChannel *chptr, char *para, int type, int what)
|
|
||||||
{
|
|
||||||
if ((type == EXCHK_ACCESS) || (type == EXCHK_ACCESS_ERR))
|
|
||||||
{
|
|
||||||
if (IsPerson(sptr) && is_chan_op(sptr, chptr))
|
|
||||||
return EX_ALLOW;
|
|
||||||
if (type == EXCHK_ACCESS_ERR) /* can only be due to being halfop */
|
|
||||||
sendto_one(sptr, err_str(ERR_NOTFORHALFOPS), me.name, sptr->name, 'j');
|
|
||||||
return EX_DENY;
|
|
||||||
} else
|
|
||||||
if (type == EXCHK_PARAM)
|
|
||||||
{
|
|
||||||
/* Check parameter.. syntax should be X:Y, X should be 1-255, Y should be 1-999 */
|
|
||||||
char buf[32], *p;
|
|
||||||
int num, t, fail = 0;
|
|
||||||
|
|
||||||
strlcpy(buf, para, sizeof(buf));
|
|
||||||
p = strchr(buf, ':');
|
|
||||||
if (!p)
|
|
||||||
{
|
|
||||||
fail = 1;
|
|
||||||
} else {
|
|
||||||
*p++ = '\0';
|
|
||||||
num = atoi(buf);
|
|
||||||
t = atoi(p);
|
|
||||||
if ((num < 1) || (num > 255) || (t < 1) || (t > 999))
|
|
||||||
fail = 1;
|
|
||||||
}
|
|
||||||
if (fail)
|
|
||||||
{
|
|
||||||
sendnotice(sptr, "Error in setting +j, syntax: +j <num>:<seconds>, where <num> must be 1-255, and <seconds> 1-999");
|
|
||||||
return EX_DENY;
|
|
||||||
}
|
|
||||||
return EX_ALLOW;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* falltrough -- should not be used */
|
|
||||||
return EX_DENY;
|
|
||||||
}
|
|
||||||
|
|
||||||
CmodeParam *cmodej_put_param(CmodeParam *r_in, char *param)
|
|
||||||
{
|
|
||||||
aModejEntry *r = (aModejEntry *)r_in;
|
|
||||||
char buf[32], *p;
|
|
||||||
int num, t;
|
|
||||||
|
|
||||||
if (!r)
|
|
||||||
{
|
|
||||||
/* Need to create one */
|
|
||||||
r = (aModejEntry *)malloc(sizeof(aModejEntry));
|
|
||||||
memset(r, 0, sizeof(aModejEntry));
|
|
||||||
r->flag = 'j';
|
|
||||||
}
|
|
||||||
strlcpy(buf, param, sizeof(buf));
|
|
||||||
p = strchr(buf, ':');
|
|
||||||
if (p)
|
|
||||||
{
|
|
||||||
*p++ = '\0';
|
|
||||||
num = atoi(buf);
|
|
||||||
t = atoi(p);
|
|
||||||
if (num < 1) num = 1;
|
|
||||||
if (num > 255) num = 255;
|
|
||||||
if (t < 1) t = 1;
|
|
||||||
if (t > 999) t = 999;
|
|
||||||
r->num = num;
|
|
||||||
r->t = t;
|
|
||||||
} else {
|
|
||||||
r->num = 0;
|
|
||||||
r->t = 0;
|
|
||||||
}
|
|
||||||
return (CmodeParam *)r;
|
|
||||||
}
|
|
||||||
|
|
||||||
char *cmodej_get_param(CmodeParam *r_in)
|
|
||||||
{
|
|
||||||
aModejEntry *r = (aModejEntry *)r_in;
|
|
||||||
static char retbuf[16];
|
|
||||||
|
|
||||||
if (!r)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
snprintf(retbuf, sizeof(retbuf), "%hu:%hu", r->num, r->t);
|
|
||||||
return retbuf;
|
|
||||||
}
|
|
||||||
|
|
||||||
char *cmodej_conv_param(char *param_in)
|
|
||||||
{
|
|
||||||
static char retbuf[32];
|
|
||||||
char param[32], *p;
|
|
||||||
int num, t, fail = 0;
|
|
||||||
|
|
||||||
strlcpy(param, param_in, sizeof(param));
|
|
||||||
p = strchr(param, ':');
|
|
||||||
if (!p)
|
|
||||||
return NULL;
|
|
||||||
*p++ = '\0';
|
|
||||||
num = atoi(param);
|
|
||||||
t = atoi(p);
|
|
||||||
if (num < 1)
|
|
||||||
num = 1;
|
|
||||||
if (num > 255)
|
|
||||||
num = 255;
|
|
||||||
if (t < 1)
|
|
||||||
t = 1;
|
|
||||||
if (t > 999)
|
|
||||||
t = 999;
|
|
||||||
|
|
||||||
snprintf(retbuf, sizeof(retbuf), "%d:%d", num, t);
|
|
||||||
return retbuf;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cmodej_free_param(CmodeParam *r)
|
|
||||||
{
|
|
||||||
MyFree(r);
|
|
||||||
}
|
|
||||||
|
|
||||||
CmodeParam *cmodej_dup_struct(CmodeParam *r_in)
|
|
||||||
{
|
|
||||||
aModejEntry *r = (aModejEntry *)r_in;
|
|
||||||
aModejEntry *w = (aModejEntry *)MyMalloc(sizeof(aModejEntry));
|
|
||||||
|
|
||||||
memcpy(w, r, sizeof(aModejEntry));
|
|
||||||
w->next = w->prev = NULL;
|
|
||||||
return (CmodeParam *)w;
|
|
||||||
}
|
|
||||||
|
|
||||||
int cmodej_sjoin_check(aChannel *chptr, CmodeParam *ourx, CmodeParam *theirx)
|
|
||||||
{
|
|
||||||
aModejEntry *our = (aModejEntry *)ourx;
|
|
||||||
aModejEntry *their = (aModejEntry *)theirx;
|
|
||||||
|
|
||||||
if (our->t != their->t)
|
|
||||||
{
|
|
||||||
if (our->t > their->t)
|
|
||||||
return EXSJ_WEWON;
|
|
||||||
else
|
|
||||||
return EXSJ_THEYWON;
|
|
||||||
}
|
|
||||||
else if (our->num != their->num)
|
|
||||||
{
|
|
||||||
if (our->num > their->num)
|
|
||||||
return EXSJ_WEWON;
|
|
||||||
else
|
|
||||||
return EXSJ_THEYWON;
|
|
||||||
} else
|
|
||||||
return EXSJ_SAME;
|
|
||||||
}
|
|
||||||
#endif /* JOINTHROTTLE */
|
|
||||||
|
|||||||
+24
-1
@@ -25,7 +25,9 @@
|
|||||||
#include "fdlist.h"
|
#include "fdlist.h"
|
||||||
#include "proto.h"
|
#include "proto.h"
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#ifdef UNISTDH
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
@@ -90,6 +92,7 @@ int fd_fileopen(const char *path, unsigned int flags)
|
|||||||
void fd_close(int fd)
|
void fd_close(int fd)
|
||||||
{
|
{
|
||||||
FDEntry *fde;
|
FDEntry *fde;
|
||||||
|
unsigned int befl;
|
||||||
|
|
||||||
if ((fd < 0) || (fd >= MAXCONNECTIONS))
|
if ((fd < 0) || (fd >= MAXCONNECTIONS))
|
||||||
{
|
{
|
||||||
@@ -110,17 +113,37 @@ void fd_close(int fd)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
befl = fde->backend_flags;
|
||||||
memset(fde, 0, sizeof(FDEntry));
|
memset(fde, 0, sizeof(FDEntry));
|
||||||
|
|
||||||
fde->fd = fd;
|
fde->fd = fd;
|
||||||
|
|
||||||
/* only notify the backend if it is actively tracking the FD */
|
/* only notify the backend if it is actively tracking the FD */
|
||||||
if (fde->backend_flags)
|
if (befl)
|
||||||
fd_refresh(fd);
|
fd_refresh(fd);
|
||||||
|
|
||||||
CLOSE_SOCK(fd);
|
CLOSE_SOCK(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Deregister I/O notification for this file descriptor */
|
||||||
|
void fd_unnotify(int fd)
|
||||||
|
{
|
||||||
|
FDEntry *fde;
|
||||||
|
#ifdef DEBUGMODE
|
||||||
|
ircd_log(LOG_ERROR, "fd_unnotify(): fd=%d", fd);
|
||||||
|
#endif
|
||||||
|
if ((fd < 0) || (fd >= MAXCONNECTIONS))
|
||||||
|
return;
|
||||||
|
|
||||||
|
fde = &fd_table[fd];
|
||||||
|
if (!fde || !fde->is_open)
|
||||||
|
return;
|
||||||
|
|
||||||
|
fde->read_callback = fde->write_callback = NULL;
|
||||||
|
fde->read_oneshot = fde->write_oneshot = 0;
|
||||||
|
fd_refresh(fd);
|
||||||
|
}
|
||||||
|
|
||||||
int fd_socket(int family, int type, int protocol, const char *desc)
|
int fd_socket(int family, int type, int protocol, const char *desc)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
|
|||||||
+104
-112
@@ -62,9 +62,6 @@ Computing Center and Jarkko Oikarinen";
|
|||||||
#endif
|
#endif
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#include "fdlist.h"
|
#include "fdlist.h"
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
#include "badwords.h"
|
|
||||||
#endif
|
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "proto.h"
|
#include "proto.h"
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@@ -142,6 +139,7 @@ void restart(char *);
|
|||||||
static void open_debugfile(), setup_signals();
|
static void open_debugfile(), setup_signals();
|
||||||
extern void init_glines(void);
|
extern void init_glines(void);
|
||||||
extern void tkl_init(void);
|
extern void tkl_init(void);
|
||||||
|
extern void process_clients(void);
|
||||||
|
|
||||||
MODVAR TS last_garbage_collect = 0;
|
MODVAR TS last_garbage_collect = 0;
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
@@ -151,7 +149,7 @@ LPCSTR cmdLine;
|
|||||||
#endif
|
#endif
|
||||||
int portnum = -1; /* Server port number, listening this */
|
int portnum = -1; /* Server port number, listening this */
|
||||||
char *configfile = CONFIGFILE; /* Server configuration file */
|
char *configfile = CONFIGFILE; /* Server configuration file */
|
||||||
int debuglevel = 10; /* Server debug level */
|
int debuglevel = 0; /* Server debug level */
|
||||||
int bootopt = 0; /* Server boot option flags */
|
int bootopt = 0; /* Server boot option flags */
|
||||||
char *debugmode = ""; /* -"- -"- -"- */
|
char *debugmode = ""; /* -"- -"- -"- */
|
||||||
char *sbrk0; /* initial sbrk(0) */
|
char *sbrk0; /* initial sbrk(0) */
|
||||||
@@ -470,38 +468,41 @@ void check_tkls(void)
|
|||||||
{
|
{
|
||||||
aClient *cptr, *cptr2;
|
aClient *cptr, *cptr2;
|
||||||
ConfigItem_ban *bconf = NULL;
|
ConfigItem_ban *bconf = NULL;
|
||||||
char killflag = 0;
|
|
||||||
char banbuf[1024];
|
char banbuf[1024];
|
||||||
|
|
||||||
list_for_each_entry_safe(cptr, cptr2, &lclient_list, lclient_node)
|
list_for_each_entry_safe(cptr, cptr2, &lclient_list, lclient_node)
|
||||||
{
|
{
|
||||||
if (find_tkline_match(cptr, 0) < 0)
|
char killflag = 0;
|
||||||
continue;
|
|
||||||
|
/* Process dynamic *LINES */
|
||||||
|
if (find_tkline_match(cptr, 0) < 0)
|
||||||
|
continue; /* stop processing this user, as (s)he is dead now. */
|
||||||
|
|
||||||
|
find_shun(cptr); /* check for shunned and take action, if so */
|
||||||
|
|
||||||
|
if (IsPerson(cptr))
|
||||||
|
{
|
||||||
|
/* Check ban user { } and ban realname { } */
|
||||||
|
|
||||||
find_shun(cptr);
|
|
||||||
if (!killflag && IsPerson(cptr)) {
|
|
||||||
/*
|
|
||||||
* If it's a user, we check for CONF_BAN_USER
|
|
||||||
*/
|
|
||||||
bconf = Find_ban(cptr, make_user_host(cptr->
|
bconf = Find_ban(cptr, make_user_host(cptr->
|
||||||
user ? cptr->user->username : cptr->
|
user ? cptr->user->username : cptr->
|
||||||
username,
|
username,
|
||||||
cptr->user ? cptr->user->realhost : cptr->
|
cptr->user ? cptr->user->realhost : cptr->
|
||||||
sockhost), CONF_BAN_USER);
|
sockhost), CONF_BAN_USER);
|
||||||
if (bconf != NULL)
|
|
||||||
killflag++;
|
|
||||||
|
|
||||||
if (!killflag && !IsAnOper(cptr) && (bconf = Find_ban(NULL, cptr->info, CONF_BAN_REALNAME)))
|
if (bconf)
|
||||||
|
killflag++;
|
||||||
|
else if (!IsAnOper(cptr) && (bconf = Find_ban(NULL, cptr->info, CONF_BAN_REALNAME)))
|
||||||
killflag++;
|
killflag++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* If still no match, check ban ip { } */
|
||||||
* If no cookie, we search for Z:lines
|
|
||||||
*/
|
|
||||||
if (!killflag && (bconf = Find_ban(cptr, Inet_ia2p(&cptr->ip), CONF_BAN_IP)))
|
if (!killflag && (bconf = Find_ban(cptr, Inet_ia2p(&cptr->ip), CONF_BAN_IP)))
|
||||||
killflag++;
|
killflag++;
|
||||||
|
|
||||||
if (killflag) {
|
/* If user is meant to be killed, take action: */
|
||||||
|
if (killflag)
|
||||||
|
{
|
||||||
if (IsPerson(cptr))
|
if (IsPerson(cptr))
|
||||||
sendto_realops("Ban active for %s (%s)",
|
sendto_realops("Ban active for %s (%s)",
|
||||||
get_client_name(cptr, FALSE),
|
get_client_name(cptr, FALSE),
|
||||||
@@ -524,7 +525,7 @@ void check_tkls(void)
|
|||||||
else
|
else
|
||||||
(void)exit_client(cptr, cptr, &me, "Banned");
|
(void)exit_client(cptr, cptr, &me, "Banned");
|
||||||
}
|
}
|
||||||
continue;
|
continue; /* stop processing this user, as (s)he is dead now. */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsPerson(cptr) && find_spamfilter_user(cptr, SPAMFLAG_NOWARN) == FLUSH_BUFFER)
|
if (IsPerson(cptr) && find_spamfilter_user(cptr, SPAMFLAG_NOWARN) == FLUSH_BUFFER)
|
||||||
@@ -542,8 +543,6 @@ void check_tkls(void)
|
|||||||
* a while back (see above).
|
* a while back (see above).
|
||||||
*
|
*
|
||||||
* Other things that should likely go:
|
* Other things that should likely go:
|
||||||
* - FLAGS_DEADSOCKET handling... just kill them off more towards the event that needs to
|
|
||||||
* kill them off. Or perhaps kill the DEADSOCKET stuff entirely. That also works...
|
|
||||||
* - identd/dns timeout checking (should go to it's own event, idea here is that we just
|
* - identd/dns timeout checking (should go to it's own event, idea here is that we just
|
||||||
* keep you in "unknown" state until you actually get 001, so we can cull the unknown list)
|
* keep you in "unknown" state until you actually get 001, so we can cull the unknown list)
|
||||||
*
|
*
|
||||||
@@ -582,20 +581,9 @@ EVENT(check_pings)
|
|||||||
int ping = 0;
|
int ping = 0;
|
||||||
TS currenttime = TStime();
|
TS currenttime = TStime();
|
||||||
|
|
||||||
|
|
||||||
list_for_each_entry_safe(cptr, cptr2, &lclient_list, lclient_node)
|
list_for_each_entry_safe(cptr, cptr2, &lclient_list, lclient_node)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
* ** Note: No need to notify opers here. It's
|
|
||||||
* ** already done when "FLAGS_DEADSOCKET" is set.
|
|
||||||
*/
|
|
||||||
if (cptr->flags & FLAGS_DEADSOCKET) {
|
|
||||||
(void)exit_client(cptr, cptr, &me, cptr->error_str ? cptr->error_str : "Dead socket");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* We go into ping phase
|
|
||||||
*/
|
|
||||||
ping =
|
ping =
|
||||||
IsRegistered(cptr) ? (cptr->class ? cptr->
|
IsRegistered(cptr) ? (cptr->class ? cptr->
|
||||||
class->pingfreq : CONNECTTIMEOUT) : CONNECTTIMEOUT;
|
class->pingfreq : CONNECTTIMEOUT) : CONNECTTIMEOUT;
|
||||||
@@ -686,6 +674,35 @@ EVENT(check_pings)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EVENT(check_deadsockets)
|
||||||
|
{
|
||||||
|
aClient *cptr, *cptr2;
|
||||||
|
|
||||||
|
list_for_each_entry_safe(cptr, cptr2, &unknown_list, lclient_node)
|
||||||
|
{
|
||||||
|
/* No need to notify opers here. It's already done when "FLAGS_DEADSOCKET" is set. */
|
||||||
|
if (cptr->flags & FLAGS_DEADSOCKET) {
|
||||||
|
#ifdef DEBUGMODE
|
||||||
|
ircd_log(LOG_ERROR, "Closing deadsock: %d/%s", cptr->fd, cptr->name);
|
||||||
|
#endif
|
||||||
|
(void)exit_client(cptr, cptr, &me, cptr->error_str ? cptr->error_str : "Dead socket");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
list_for_each_entry_safe(cptr, cptr2, &lclient_list, lclient_node)
|
||||||
|
{
|
||||||
|
/* No need to notify opers here. It's already done when "FLAGS_DEADSOCKET" is set. */
|
||||||
|
if (cptr->flags & FLAGS_DEADSOCKET) {
|
||||||
|
#ifdef DEBUGMODE
|
||||||
|
ircd_log(LOG_ERROR, "Closing deadsock: %d/%s", cptr->fd, cptr->name);
|
||||||
|
#endif
|
||||||
|
(void)exit_client(cptr, cptr, &me, cptr->error_str ? cptr->error_str : "Dead socket");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** bad_command
|
** bad_command
|
||||||
** This is called when the commandline is not acceptable.
|
** This is called when the commandline is not acceptable.
|
||||||
@@ -811,6 +828,7 @@ int error = 0;
|
|||||||
extern time_t TSoffset;
|
extern time_t TSoffset;
|
||||||
|
|
||||||
extern int unreal_time_synch(int timeout);
|
extern int unreal_time_synch(int timeout);
|
||||||
|
extern void applymeblock(void);
|
||||||
|
|
||||||
extern MODVAR Event *events;
|
extern MODVAR Event *events;
|
||||||
extern struct MODVAR ThrottlingBucket *ThrottlingHash[THROTTLING_HASH_SIZE+1];
|
extern struct MODVAR ThrottlingBucket *ThrottlingHash[THROTTLING_HASH_SIZE+1];
|
||||||
@@ -997,19 +1015,26 @@ int InitwIRCD(int argc, char *argv[])
|
|||||||
egid = getegid();
|
egid = getegid();
|
||||||
|
|
||||||
#ifndef IRC_USER
|
#ifndef IRC_USER
|
||||||
|
if (!euid && uid)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Sorry, a SUID root IRCd without IRC_USER in include/config.h is not supported.\n"
|
||||||
|
"It would be very dangerous. Go edit include/config.h and set IRC_USER and\n"
|
||||||
|
"IRC_GROUP to a nonprivileged username and recompile.\n");
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
if (!euid)
|
if (!euid)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"WARNING: You are running UnrealIRCd as root and it is not\n"
|
"WARNING: You are running UnrealIRCd as root and it is not\n"
|
||||||
" configured to drop priviliges. This is _very_ dangerous,\n"
|
" configured to drop priviliges. This is VERY dangerous,\n"
|
||||||
" as any compromise of your UnrealIRCd is the same as\n"
|
" as any compromise of your UnrealIRCd is the same as\n"
|
||||||
" giving a cracker root SSH access to your box.\n"
|
" giving a cracker root SSH access to your box.\n"
|
||||||
" You should either start UnrealIRCd under a different\n"
|
" You should either start UnrealIRCd under a different\n"
|
||||||
" account than root, or set IRC_USER in include/config.h\n"
|
" account than root, or set IRC_USER in include/config.h\n"
|
||||||
" to a nonprivileged username and recompile.\n");
|
" to a nonprivileged username and recompile.\n");
|
||||||
|
sleep(1); /* just to catch their attention */
|
||||||
}
|
}
|
||||||
#endif /* IRC_USER */
|
#endif /* IRC_USER */
|
||||||
|
|
||||||
# ifdef PROFIL
|
# ifdef PROFIL
|
||||||
(void)monstartup(0, etext);
|
(void)monstartup(0, etext);
|
||||||
(void)moncontrol(1);
|
(void)moncontrol(1);
|
||||||
@@ -1039,7 +1064,7 @@ int InitwIRCD(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
if (geteuid() != 0)
|
if (geteuid() != 0)
|
||||||
fprintf(stderr, "WARNING: IRCd compiled with CHROOTDIR but effective user id is not root!? "
|
fprintf(stderr, "WARNING: IRCd compiled with CHROOTDIR but effective user id is not root!? "
|
||||||
"Booting is very likely to fail...\n");
|
"Booting is very likely to fail. You should start the IRCd as root instead.\n");
|
||||||
init_resolver(1);
|
init_resolver(1);
|
||||||
{
|
{
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
@@ -1088,6 +1113,39 @@ int InitwIRCD(int argc, char *argv[])
|
|||||||
exit(5);
|
exit(5);
|
||||||
}
|
}
|
||||||
#endif /*CHROOTDIR*/
|
#endif /*CHROOTDIR*/
|
||||||
|
#if !defined(IRC_USER) && !defined(_WIN32)
|
||||||
|
if ((uid != euid) && !euid) {
|
||||||
|
(void)fprintf(stderr,
|
||||||
|
"ERROR: do not run ircd setuid root. Make it setuid a normal user.\n");
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(IRC_USER) && defined(IRC_GROUP)
|
||||||
|
if ((int)getuid() == 0) {
|
||||||
|
/* NOTE: irc_uid/irc_gid have been looked up earlier, before the chrooting code */
|
||||||
|
|
||||||
|
if ((irc_uid == 0) || (irc_gid == 0)) {
|
||||||
|
(void)fprintf(stderr,
|
||||||
|
"ERROR: SETUID and SETGID have not been set properly"
|
||||||
|
"\nPlease read your documentation\n(HINT: IRC_USER and IRC_GROUP in include/config.h cannot be root/wheel)\n");
|
||||||
|
exit(-1);
|
||||||
|
} else {
|
||||||
|
/* run as a specified user */
|
||||||
|
(void)fprintf(stderr, "ircd invoked as root, changing to uid %d (%s) and gid %d (%s)...\n", irc_uid, IRC_USER, irc_gid, IRC_GROUP);
|
||||||
|
if (setgid(irc_gid))
|
||||||
|
{
|
||||||
|
fprintf(stderr, "ERROR: Unable to change group: %s\n", strerror(errno));
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
if (setuid(irc_uid))
|
||||||
|
{
|
||||||
|
fprintf(stderr, "ERROR: Unable to change userid: %s\n", strerror(errno));
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
myargv = argv;
|
myargv = argv;
|
||||||
#else
|
#else
|
||||||
@@ -1150,12 +1208,8 @@ int InitwIRCD(int argc, char *argv[])
|
|||||||
case 'q':
|
case 'q':
|
||||||
bootopt |= BOOT_QUICK;
|
bootopt |= BOOT_QUICK;
|
||||||
break;
|
break;
|
||||||
case 'd':
|
|
||||||
if (setuid((uid_t) uid) == -1)
|
|
||||||
printf("WARNING: Could not drop privileges: %s\n", strerror(errno));
|
|
||||||
#else
|
|
||||||
case 'd':
|
|
||||||
#endif
|
#endif
|
||||||
|
case 'd':
|
||||||
dpath = p;
|
dpath = p;
|
||||||
break;
|
break;
|
||||||
case 'F':
|
case 'F':
|
||||||
@@ -1169,9 +1223,6 @@ int InitwIRCD(int argc, char *argv[])
|
|||||||
else
|
else
|
||||||
printf("ERROR: Command line config with a setuid/setgid ircd is not allowed");
|
printf("ERROR: Command line config with a setuid/setgid ircd is not allowed");
|
||||||
#else
|
#else
|
||||||
if (setuid((uid_t) uid) == -1)
|
|
||||||
printf("WARNING: could not drop privileges: %s\n", strerror(errno));
|
|
||||||
|
|
||||||
configfile = p;
|
configfile = p;
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
@@ -1239,9 +1290,6 @@ int InitwIRCD(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
case 't':
|
case 't':
|
||||||
if (setuid((uid_t) uid) == -1)
|
|
||||||
printf("WARNING: Could not drop privileges: %s\n", strerror(errno));
|
|
||||||
|
|
||||||
bootopt |= BOOT_TTY;
|
bootopt |= BOOT_TTY;
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
@@ -1259,10 +1307,6 @@ int InitwIRCD(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
case 'x':
|
case 'x':
|
||||||
#ifdef DEBUGMODE
|
#ifdef DEBUGMODE
|
||||||
# ifndef _WIN32
|
|
||||||
if (setuid((uid_t) uid) == -1)
|
|
||||||
printf("WARNING: Could not drop privileges: %s\n", strerror(errno));
|
|
||||||
# endif
|
|
||||||
debuglevel = atoi(p);
|
debuglevel = atoi(p);
|
||||||
debugmode = *p ? p : "0";
|
debugmode = *p ? p : "0";
|
||||||
bootopt |= BOOT_DEBUG;
|
bootopt |= BOOT_DEBUG;
|
||||||
@@ -1371,15 +1415,6 @@ int InitwIRCD(int argc, char *argv[])
|
|||||||
chmod(CPATH, DEFAULT_PERMISSIONS);
|
chmod(CPATH, DEFAULT_PERMISSIONS);
|
||||||
#endif
|
#endif
|
||||||
init_dynconf();
|
init_dynconf();
|
||||||
#ifdef STATIC_LINKING
|
|
||||||
{
|
|
||||||
ModuleInfo ModCoreInfo;
|
|
||||||
ModCoreInfo.size = sizeof(ModuleInfo);
|
|
||||||
ModCoreInfo.module_load = 0;
|
|
||||||
ModCoreInfo.handle = NULL;
|
|
||||||
l_commands_Test(&ModCoreInfo);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
/*
|
/*
|
||||||
* Add default class
|
* Add default class
|
||||||
*/
|
*/
|
||||||
@@ -1424,21 +1459,17 @@ int InitwIRCD(int argc, char *argv[])
|
|||||||
open_debugfile();
|
open_debugfile();
|
||||||
if (portnum < 0)
|
if (portnum < 0)
|
||||||
portnum = PORTNUM;
|
portnum = PORTNUM;
|
||||||
|
memset(&me, 0, sizeof(me));
|
||||||
me.port = portnum;
|
me.port = portnum;
|
||||||
(void)init_sys();
|
(void)init_sys();
|
||||||
me.flags = FLAGS_LISTEN;
|
me.flags = FLAGS_LISTEN;
|
||||||
me.fd = -1;
|
me.fd = -1;
|
||||||
SetMe(&me);
|
SetMe(&me);
|
||||||
make_server(&me);
|
make_server(&me);
|
||||||
|
applymeblock();
|
||||||
#ifdef HAVE_SYSLOG
|
#ifdef HAVE_SYSLOG
|
||||||
openlog("ircd", LOG_PID | LOG_NDELAY, LOG_DAEMON);
|
openlog("ircd", LOG_PID | LOG_NDELAY, LOG_DAEMON);
|
||||||
#endif
|
#endif
|
||||||
/*
|
|
||||||
* Put in our info
|
|
||||||
*/
|
|
||||||
strlcpy(me.info, conf_me->info, sizeof(me.info));
|
|
||||||
strlcpy(me.name, conf_me->name, sizeof(me.name));
|
|
||||||
strlcpy(me.id, conf_me->sid, sizeof(me.name));
|
|
||||||
uid_init();
|
uid_init();
|
||||||
run_configuration();
|
run_configuration();
|
||||||
ircd_log(LOG_ERROR, "UnrealIRCd started.");
|
ircd_log(LOG_ERROR, "UnrealIRCd started.");
|
||||||
@@ -1485,44 +1516,6 @@ int InitwIRCD(int argc, char *argv[])
|
|||||||
R_fin_id = strlen(REPORT_FIN_ID);
|
R_fin_id = strlen(REPORT_FIN_ID);
|
||||||
R_fail_id = strlen(REPORT_FAIL_ID);
|
R_fail_id = strlen(REPORT_FAIL_ID);
|
||||||
|
|
||||||
#if !defined(IRC_USER) && !defined(_WIN32)
|
|
||||||
if ((uid != euid) && !euid) {
|
|
||||||
(void)fprintf(stderr,
|
|
||||||
"ERROR: do not run ircd setuid root. Make it setuid a normal user.\n");
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(IRC_USER) && defined(IRC_GROUP)
|
|
||||||
if ((int)getuid() == 0) {
|
|
||||||
/* NOTE: irc_uid/irc_gid have been looked up earlier, before the chrooting code */
|
|
||||||
|
|
||||||
if ((irc_uid == 0) || (irc_gid == 0)) {
|
|
||||||
(void)fprintf(stderr,
|
|
||||||
"ERROR: SETUID and SETGID have not been set properly"
|
|
||||||
"\nPlease read your documentation\n(HINT: IRC_USER and IRC_GROUP in include/config.h cannot be root/wheel)\n");
|
|
||||||
exit(-1);
|
|
||||||
} else {
|
|
||||||
/*
|
|
||||||
* run as a specified user
|
|
||||||
*/
|
|
||||||
|
|
||||||
(void)fprintf(stderr, "WARNING: ircd invoked as root\n");
|
|
||||||
(void)fprintf(stderr, " changing to uid %d\n", irc_uid);
|
|
||||||
(void)fprintf(stderr, " changing to gid %d\n", irc_gid);
|
|
||||||
if (setgid(irc_gid))
|
|
||||||
{
|
|
||||||
fprintf(stderr, "ERROR: Unable to change group: %s\n", strerror(errno));
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
if (setuid(irc_uid))
|
|
||||||
{
|
|
||||||
fprintf(stderr, "ERROR: Unable to change userid: %s\n", strerror(errno));
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (TIMESYNCH)
|
if (TIMESYNCH)
|
||||||
{
|
{
|
||||||
if (!unreal_time_synch(TIMESYNCH_TIMEOUT))
|
if (!unreal_time_synch(TIMESYNCH_TIMEOUT))
|
||||||
@@ -1535,7 +1528,6 @@ int InitwIRCD(int argc, char *argv[])
|
|||||||
write_pidfile();
|
write_pidfile();
|
||||||
Debug((DEBUG_NOTICE, "Server ready..."));
|
Debug((DEBUG_NOTICE, "Server ready..."));
|
||||||
init_throttling_hash();
|
init_throttling_hash();
|
||||||
init_modef();
|
|
||||||
loop.ircd_booted = 1;
|
loop.ircd_booted = 1;
|
||||||
#if defined(HAVE_SETPROCTITLE)
|
#if defined(HAVE_SETPROCTITLE)
|
||||||
setproctitle("%s", me.name);
|
setproctitle("%s", me.name);
|
||||||
@@ -1547,9 +1539,6 @@ int InitwIRCD(int argc, char *argv[])
|
|||||||
PS_STRINGS->ps_argvstr = me.name;
|
PS_STRINGS->ps_argvstr = me.name;
|
||||||
#endif
|
#endif
|
||||||
module_loadall(0);
|
module_loadall(0);
|
||||||
#ifdef STATIC_LINKING
|
|
||||||
l_commands_Load(0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
return 1;
|
return 1;
|
||||||
@@ -1661,6 +1650,9 @@ void SocketLoop(void *dummy)
|
|||||||
delay = MIN(delay, TIMESEC);
|
delay = MIN(delay, TIMESEC);
|
||||||
|
|
||||||
fd_select(delay * 1000);
|
fd_select(delay * 1000);
|
||||||
|
|
||||||
|
process_clients();
|
||||||
|
|
||||||
timeofday = time(NULL) + TSoffset;
|
timeofday = time(NULL) + TSoffset;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1711,8 +1703,8 @@ static void open_debugfile(void)
|
|||||||
(void)strlcpy(cptr->sockhost, me.sockhost,
|
(void)strlcpy(cptr->sockhost, me.sockhost,
|
||||||
sizeof cptr->sockhost);
|
sizeof cptr->sockhost);
|
||||||
# ifndef _WIN32
|
# ifndef _WIN32
|
||||||
(void)printf("isatty = %d ttyname = %#x\n",
|
/*(void)printf("isatty = %d ttyname = %#x\n",
|
||||||
isatty(2), (u_int)ttyname(2));
|
isatty(2), (u_int)ttyname(2)); */
|
||||||
if (!(bootopt & BOOT_TTY)) { /* leave debugging output on fd 2 */
|
if (!(bootopt & BOOT_TTY)) { /* leave debugging output on fd 2 */
|
||||||
(void)truncate(LOGFILE, 0);
|
(void)truncate(LOGFILE, 0);
|
||||||
if ((fd = open(LOGFILE, O_WRONLY | O_CREAT, 0600)) < 0)
|
if ((fd = open(LOGFILE, O_WRONLY | O_CREAT, 0600)) < 0)
|
||||||
|
|||||||
+12
-8
@@ -41,11 +41,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
char *ircvsnprintf(char *str, size_t size, const char *format, va_list vl) {
|
char *ircvsnprintf(char *str, size_t size, const char *format, va_list vl) {
|
||||||
if (!size) return str;
|
|
||||||
char* str_begin = str;
|
char* str_begin = str;
|
||||||
char c;
|
char c;
|
||||||
const char* end = str+size-1; //for comparison, not dereferencing. It is the last position a null can go.
|
const char* end = str+size-1; //for comparison, not dereferencing. It is the last position a null can go.
|
||||||
|
|
||||||
|
if (!size) return str;
|
||||||
|
|
||||||
while (str!=end && (c = *format++))
|
while (str!=end && (c = *format++))
|
||||||
{
|
{
|
||||||
if (c == '%')
|
if (c == '%')
|
||||||
@@ -65,9 +66,10 @@ char *ircvsnprintf(char *str, size_t size, const char *format, va_list vl) {
|
|||||||
[ 100000000 , 4294967295 ]
|
[ 100000000 , 4294967295 ]
|
||||||
Actually prints like "%010lu" */
|
Actually prints like "%010lu" */
|
||||||
int i;
|
int i;
|
||||||
|
unsigned long int v;
|
||||||
format++;
|
format++;
|
||||||
if (str+10>end) break;
|
if (str+10>end) break;
|
||||||
unsigned long int v = va_arg(vl, unsigned long int);
|
v = va_arg(vl, unsigned long int);
|
||||||
for (i = 9; i>=0; i--) {
|
for (i = 9; i>=0; i--) {
|
||||||
str[i] = (v%10)+'0';
|
str[i] = (v%10)+'0';
|
||||||
v /= 10;
|
v /= 10;
|
||||||
@@ -76,8 +78,10 @@ char *ircvsnprintf(char *str, size_t size, const char *format, va_list vl) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (c == 'd' || c == 'i') {
|
if (c == 'd' || c == 'i') {
|
||||||
|
char scratch_buffer[16], *t;
|
||||||
int v = va_arg(vl, int);
|
int v = va_arg(vl, int);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
size_t len;
|
||||||
if (v<0) {
|
if (v<0) {
|
||||||
v*=-1;
|
v*=-1;
|
||||||
*str++ = '-';
|
*str++ = '-';
|
||||||
@@ -88,35 +92,35 @@ char *ircvsnprintf(char *str, size_t size, const char *format, va_list vl) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
char scratch_buffer[16];
|
t = scratch_buffer + sizeof(scratch_buffer);
|
||||||
char* t = scratch_buffer + sizeof(scratch_buffer);
|
|
||||||
while (v) {
|
while (v) {
|
||||||
*--t = (v%10) + '0';
|
*--t = (v%10) + '0';
|
||||||
v/=10;
|
v/=10;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t len = sizeof(scratch_buffer)-(t-scratch_buffer);
|
len = sizeof(scratch_buffer)-(t-scratch_buffer);
|
||||||
if ((str+len)>end) break;
|
if ((str+len)>end) break;
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
*str++=t[i];
|
*str++=t[i];
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (c == 'u') {
|
if (c == 'u') {
|
||||||
|
char scratch_buffer[16], *t;
|
||||||
unsigned int v = va_arg(vl, unsigned int);
|
unsigned int v = va_arg(vl, unsigned int);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
size_t len;
|
||||||
if (v==0) {
|
if (v==0) {
|
||||||
*str++ = '0';
|
*str++ = '0';
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
char scratch_buffer[16];
|
t = scratch_buffer + sizeof(scratch_buffer);
|
||||||
char* t = scratch_buffer + sizeof(scratch_buffer);
|
|
||||||
while (v) {
|
while (v) {
|
||||||
*--t = (v%10) + '0';
|
*--t = (v%10) + '0';
|
||||||
v/=10;
|
v/=10;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t len = sizeof(scratch_buffer)-(t-scratch_buffer);
|
len = sizeof(scratch_buffer)-(t-scratch_buffer);
|
||||||
if ((str+len)>end) break;
|
if ((str+len)>end) break;
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
*str++=t[i];
|
*str++=t[i];
|
||||||
|
|||||||
+6
-158
@@ -184,6 +184,7 @@ void free_client(aClient *cptr)
|
|||||||
if (!list_empty(&cptr->special_node))
|
if (!list_empty(&cptr->special_node))
|
||||||
list_del(&cptr->special_node);
|
list_del(&cptr->special_node);
|
||||||
|
|
||||||
|
RunHook(HOOKTYPE_FREE_CLIENT, cptr);
|
||||||
if (cptr->passwd)
|
if (cptr->passwd)
|
||||||
MyFree((char *)cptr->passwd);
|
MyFree((char *)cptr->passwd);
|
||||||
if (cptr->error_str)
|
if (cptr->error_str)
|
||||||
@@ -266,9 +267,13 @@ aServer *make_server(aClient *cptr)
|
|||||||
*/
|
*/
|
||||||
void free_user(anUser *user, aClient *cptr)
|
void free_user(anUser *user, aClient *cptr)
|
||||||
{
|
{
|
||||||
--user->refcnt;
|
if (user->refcnt == 0)
|
||||||
|
sendto_realops("[BUG] free_user: ref count for '%s' was already 0!?", user->username);
|
||||||
|
else
|
||||||
|
--user->refcnt;
|
||||||
if (user->refcnt == 0)
|
if (user->refcnt == 0)
|
||||||
{
|
{
|
||||||
|
RunHook2(HOOKTYPE_FREE_USER, user, cptr);
|
||||||
if (user->away)
|
if (user->away)
|
||||||
MyFree(user->away);
|
MyFree(user->away);
|
||||||
if (user->swhois)
|
if (user->swhois)
|
||||||
@@ -560,160 +565,3 @@ ListStruct *del_ListItem(ListStruct *item, ListStruct **list) {
|
|||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef JOINTHROTTLE
|
|
||||||
/** Adds a aJFlood entry to user & channel and returns entry.
|
|
||||||
* NOTE: Does not check for already-existing-entry
|
|
||||||
*/
|
|
||||||
aJFlood *cmodej_addentry(aClient *cptr, aChannel *chptr)
|
|
||||||
{
|
|
||||||
aJFlood *e;
|
|
||||||
|
|
||||||
#ifdef DEBUGMODE
|
|
||||||
if (!IsPerson(cptr))
|
|
||||||
abort();
|
|
||||||
|
|
||||||
for (e=cptr->user->jflood; e; e=e->next_u)
|
|
||||||
if (e->chptr == chptr)
|
|
||||||
abort();
|
|
||||||
|
|
||||||
for (e=chptr->jflood; e; e=e->next_c)
|
|
||||||
if (e->cptr == cptr)
|
|
||||||
abort();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
e = MyMallocEx(sizeof(aJFlood));
|
|
||||||
e->cptr = cptr;
|
|
||||||
e->chptr = chptr;
|
|
||||||
e->prev_u = e->prev_c = NULL;
|
|
||||||
e->next_u = cptr->user->jflood;
|
|
||||||
e->next_c = chptr->jflood;
|
|
||||||
if (cptr->user->jflood)
|
|
||||||
cptr->user->jflood->prev_u = e;
|
|
||||||
if (chptr->jflood)
|
|
||||||
chptr->jflood->prev_c = e;
|
|
||||||
cptr->user->jflood = chptr->jflood = e;
|
|
||||||
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Removes an individual entry from list and frees it.
|
|
||||||
*/
|
|
||||||
void cmodej_delentry(aJFlood *e)
|
|
||||||
{
|
|
||||||
/* remove from user.. */
|
|
||||||
if (e->prev_u)
|
|
||||||
e->prev_u->next_u = e->next_u;
|
|
||||||
else
|
|
||||||
e->cptr->user->jflood = e->next_u; /* new head */
|
|
||||||
if (e->next_u)
|
|
||||||
e->next_u->prev_u = e->prev_u;
|
|
||||||
|
|
||||||
/* remove from channel.. */
|
|
||||||
if (e->prev_c)
|
|
||||||
e->prev_c->next_c = e->next_c;
|
|
||||||
else
|
|
||||||
e->chptr->jflood = e->next_c; /* new head */
|
|
||||||
if (e->next_c)
|
|
||||||
e->next_c->prev_c = e->prev_c;
|
|
||||||
|
|
||||||
/* actually free it */
|
|
||||||
MyFree(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Removes all entries belonging to user from all lists and free them. */
|
|
||||||
void cmodej_deluserentries(aClient *cptr)
|
|
||||||
{
|
|
||||||
aJFlood *e, *e_next;
|
|
||||||
|
|
||||||
for (e=cptr->user->jflood; e; e=e_next)
|
|
||||||
{
|
|
||||||
e_next = e->next_u;
|
|
||||||
|
|
||||||
/* remove from channel.. */
|
|
||||||
if (e->prev_c)
|
|
||||||
e->prev_c->next_c = e->next_c;
|
|
||||||
else
|
|
||||||
e->chptr->jflood = e->next_c; /* new head */
|
|
||||||
if (e->next_c)
|
|
||||||
e->next_c->prev_c = e->prev_c;
|
|
||||||
|
|
||||||
/* actually free it */
|
|
||||||
MyFree(e);
|
|
||||||
}
|
|
||||||
cptr->user->jflood = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Removes all entries belonging to channel from all lists and free them. */
|
|
||||||
void cmodej_delchannelentries(aChannel *chptr)
|
|
||||||
{
|
|
||||||
aJFlood *e, *e_next;
|
|
||||||
|
|
||||||
for (e=chptr->jflood; e; e=e_next)
|
|
||||||
{
|
|
||||||
e_next = e->next_c;
|
|
||||||
|
|
||||||
/* remove from user.. */
|
|
||||||
if (e->prev_u)
|
|
||||||
e->prev_u->next_u = e->next_u;
|
|
||||||
else
|
|
||||||
e->cptr->user->jflood = e->next_u; /* new head */
|
|
||||||
if (e->next_u)
|
|
||||||
e->next_u->prev_u = e->prev_u;
|
|
||||||
|
|
||||||
/* actually free it */
|
|
||||||
MyFree(e);
|
|
||||||
}
|
|
||||||
chptr->jflood = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Regulary cleans up cmode-j user/chan structs */
|
|
||||||
EVENT(cmodej_cleanup_structs)
|
|
||||||
{
|
|
||||||
aJFlood *e, *e_next;
|
|
||||||
int i;
|
|
||||||
aClient *cptr;
|
|
||||||
aChannel *chptr;
|
|
||||||
int t;
|
|
||||||
CmodeParam *cmp;
|
|
||||||
#ifdef DEBUGMODE
|
|
||||||
int freed=0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (chptr = channel; chptr; chptr=chptr->nextch)
|
|
||||||
{
|
|
||||||
if (!chptr->jflood)
|
|
||||||
continue;
|
|
||||||
t=0;
|
|
||||||
/* t will be kept at 0 if not found or if mode not set,
|
|
||||||
* but DO still check since there are entries left as indicated by ->jflood!
|
|
||||||
*/
|
|
||||||
if (chptr->mode.extmode & EXTMODE_JOINTHROTTLE)
|
|
||||||
{
|
|
||||||
for (cmp = chptr->mode.extmodeparam; cmp; cmp=cmp->next)
|
|
||||||
if (cmp->flag == 'j')
|
|
||||||
t = ((aModejEntry *)cmp)->t;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (e = chptr->jflood; e; e = e_next)
|
|
||||||
{
|
|
||||||
e_next = e->next_c;
|
|
||||||
|
|
||||||
if (e->firstjoin + t < TStime())
|
|
||||||
{
|
|
||||||
cmodej_delentry(e);
|
|
||||||
#ifdef DEBUGMODE
|
|
||||||
freed++;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef DEBUGMODE
|
|
||||||
if (freed)
|
|
||||||
ircd_log(LOG_ERROR, "cmodej_cleanup_structs: %d entries freed [%d bytes]", freed, freed * sizeof(aJFlood));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|||||||
+15
-15
@@ -51,32 +51,32 @@ tor_log2(uint64_t u64)
|
|||||||
{
|
{
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
if (u64 >= (1LLU << 32))
|
if (u64 >= (1ULL << 32))
|
||||||
{
|
{
|
||||||
u64 >>= 32;
|
u64 >>= 32;
|
||||||
r = 32;
|
r = 32;
|
||||||
}
|
}
|
||||||
if (u64 >= (1LLU << 16))
|
if (u64 >= (1ULL << 16))
|
||||||
{
|
{
|
||||||
u64 >>= 16;
|
u64 >>= 16;
|
||||||
r += 16;
|
r += 16;
|
||||||
}
|
}
|
||||||
if (u64 >= (1LLU << 8))
|
if (u64 >= (1ULL << 8))
|
||||||
{
|
{
|
||||||
u64 >>= 8;
|
u64 >>= 8;
|
||||||
r += 8;
|
r += 8;
|
||||||
}
|
}
|
||||||
if (u64 >= (1LLU << 4))
|
if (u64 >= (1ULL << 4))
|
||||||
{
|
{
|
||||||
u64 >>= 4;
|
u64 >>= 4;
|
||||||
r += 4;
|
r += 4;
|
||||||
}
|
}
|
||||||
if (u64 >= (1LLU << 2))
|
if (u64 >= (1ULL << 2))
|
||||||
{
|
{
|
||||||
u64 >>= 2;
|
u64 >>= 2;
|
||||||
r += 2;
|
r += 2;
|
||||||
}
|
}
|
||||||
if (u64 >= (1LLU << 1))
|
if (u64 >= (1ULL << 1))
|
||||||
{
|
{
|
||||||
u64 >>= 1;
|
u64 >>= 1;
|
||||||
r += 1;
|
r += 1;
|
||||||
@@ -98,12 +98,12 @@ round_to_power_of_2(uint64_t u64)
|
|||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
lg2 = tor_log2(u64);
|
lg2 = tor_log2(u64);
|
||||||
low = 1LLU << lg2;
|
low = 1ULL << lg2;
|
||||||
|
|
||||||
if (lg2 == 63)
|
if (lg2 == 63)
|
||||||
return low;
|
return low;
|
||||||
|
|
||||||
high = 1LLU << (lg2 + 1);
|
high = 1ULL << (lg2 + 1);
|
||||||
if (high - u64 < u64 - low)
|
if (high - u64 < u64 - low)
|
||||||
return high;
|
return high;
|
||||||
else
|
else
|
||||||
@@ -475,7 +475,7 @@ mp_pool_new(size_t item_size, size_t chunk_capacity)
|
|||||||
pool->next = mp_allocated_pools;
|
pool->next = mp_allocated_pools;
|
||||||
mp_allocated_pools = pool;
|
mp_allocated_pools = pool;
|
||||||
|
|
||||||
ircd_log(LOG_DEBUG, "Capacity is %lu, item size is %lu, alloc size is %lu",
|
ircd_log(LOG_DBG, "Capacity is %lu, item size is %lu, alloc size is %lu",
|
||||||
(unsigned long)pool->new_chunk_capacity,
|
(unsigned long)pool->new_chunk_capacity,
|
||||||
(unsigned long)pool->item_alloc_size,
|
(unsigned long)pool->item_alloc_size,
|
||||||
(unsigned long)(pool->new_chunk_capacity*pool->item_alloc_size));
|
(unsigned long)(pool->new_chunk_capacity*pool->item_alloc_size));
|
||||||
@@ -671,18 +671,18 @@ mp_pool_log_status(mp_pool_t *pool)
|
|||||||
for (chunk = pool->empty_chunks; chunk; chunk = chunk->next)
|
for (chunk = pool->empty_chunks; chunk; chunk = chunk->next)
|
||||||
bytes_allocated += chunk->mem_size;
|
bytes_allocated += chunk->mem_size;
|
||||||
|
|
||||||
ircd_log(LOG_DEBUG, "%lu bytes in %d empty chunks",
|
ircd_log(LOG_DBG, "%lu bytes in %d empty chunks",
|
||||||
bytes_allocated, pool->n_empty_chunks);
|
bytes_allocated, pool->n_empty_chunks);
|
||||||
for (chunk = pool->used_chunks; chunk; chunk = chunk->next) {
|
for (chunk = pool->used_chunks; chunk; chunk = chunk->next) {
|
||||||
++n_used;
|
++n_used;
|
||||||
bu += chunk->n_allocated * pool->item_alloc_size;
|
bu += chunk->n_allocated * pool->item_alloc_size;
|
||||||
ba += chunk->mem_size;
|
ba += chunk->mem_size;
|
||||||
|
|
||||||
ircd_log(LOG_DEBUG, " used chunk: %d items allocated",
|
ircd_log(LOG_DBG, " used chunk: %d items allocated",
|
||||||
chunk->n_allocated);
|
chunk->n_allocated);
|
||||||
}
|
}
|
||||||
|
|
||||||
ircd_log(LOG_DEBUG, "%lu/%lu bytes in %d partially full chunks",
|
ircd_log(LOG_DBG, "%lu/%lu bytes in %d partially full chunks",
|
||||||
bu, ba, n_used);
|
bu, ba, n_used);
|
||||||
bytes_used += bu;
|
bytes_used += bu;
|
||||||
bytes_allocated += ba;
|
bytes_allocated += ba;
|
||||||
@@ -694,17 +694,17 @@ mp_pool_log_status(mp_pool_t *pool)
|
|||||||
ba += chunk->mem_size;
|
ba += chunk->mem_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
ircd_log(LOG_DEBUG, "%lu/%lu bytes in %d full chunks",
|
ircd_log(LOG_DBG, "%lu/%lu bytes in %d full chunks",
|
||||||
bu, ba, n_full);
|
bu, ba, n_full);
|
||||||
bytes_used += bu;
|
bytes_used += bu;
|
||||||
bytes_allocated += ba;
|
bytes_allocated += ba;
|
||||||
|
|
||||||
ircd_log(LOG_DEBUG, "Total: %lu/%lu bytes allocated "
|
ircd_log(LOG_DBG, "Total: %lu/%lu bytes allocated "
|
||||||
"for cell pools are full.",
|
"for cell pools are full.",
|
||||||
bytes_used, bytes_allocated);
|
bytes_used, bytes_allocated);
|
||||||
|
|
||||||
#ifdef MEMPOOL_STATS
|
#ifdef MEMPOOL_STATS
|
||||||
ircd_log(LOG_DEBUG, "%lu cell allocations ever; "
|
ircd_log(LOG_DBG, "%lu cell allocations ever; "
|
||||||
"%lu chunk allocations ever; "
|
"%lu chunk allocations ever; "
|
||||||
"%lu chunk frees ever.",
|
"%lu chunk frees ever.",
|
||||||
pool->total_items_allocated,
|
pool->total_items_allocated,
|
||||||
|
|||||||
+21
-34
@@ -82,7 +82,7 @@ typedef struct {
|
|||||||
/* Efuncs */
|
/* Efuncs */
|
||||||
int (*do_join)(aClient *cptr, aClient *sptr, int parc, char *parv[]);
|
int (*do_join)(aClient *cptr, aClient *sptr, int parc, char *parv[]);
|
||||||
void (*join_channel)(aChannel *chptr, aClient *cptr, aClient *sptr, int flags);
|
void (*join_channel)(aChannel *chptr, aClient *cptr, aClient *sptr, int flags);
|
||||||
int (*can_join)(aClient *cptr, aClient *sptr, aChannel *chptr, char *key, char *link, char *parv[]);
|
int (*can_join)(aClient *cptr, aClient *sptr, aChannel *chptr, char *key, char *parv[]);
|
||||||
void (*do_mode)(aChannel *chptr, aClient *cptr, aClient *sptr, int parc, char *parv[], time_t sendts, int samode);
|
void (*do_mode)(aChannel *chptr, aClient *cptr, aClient *sptr, int parc, char *parv[], time_t sendts, int samode);
|
||||||
void (*set_mode)(aChannel *chptr, aClient *cptr, int parc, char *parv[], u_int *pcount,
|
void (*set_mode)(aChannel *chptr, aClient *cptr, int parc, char *parv[], u_int *pcount,
|
||||||
char pvar[MAXMODEPARAMS][MODEBUFLEN + 3], int bounce);
|
char pvar[MAXMODEPARAMS][MODEBUFLEN + 3], int bounce);
|
||||||
@@ -109,9 +109,6 @@ int (*dospamfilter)(aClient *sptr, char *str_in, int type, char *target, int fla
|
|||||||
int (*dospamfilter_viruschan)(aClient *sptr, aTKline *tk, int type);
|
int (*dospamfilter_viruschan)(aClient *sptr, aTKline *tk, int type);
|
||||||
int (*find_tkline_match_zap_ex)(aClient *cptr, aTKline **rettk);
|
int (*find_tkline_match_zap_ex)(aClient *cptr, aTKline **rettk);
|
||||||
void (*send_list)(aClient *cptr, int numsend);
|
void (*send_list)(aClient *cptr, int numsend);
|
||||||
char *(*stripbadwords_channel)(char *str, int *blocked);
|
|
||||||
char *(*stripbadwords_message)(char *str, int *blocked);
|
|
||||||
char *(*stripbadwords_quit)(char *str, int *blocked);
|
|
||||||
unsigned char *(*StripColors)(unsigned char *text);
|
unsigned char *(*StripColors)(unsigned char *text);
|
||||||
const char *(*StripControlCodes)(unsigned char *text);
|
const char *(*StripControlCodes)(unsigned char *text);
|
||||||
void (*spamfilter_build_user_string)(char *buf, char *nick, aClient *acptr);
|
void (*spamfilter_build_user_string)(char *buf, char *nick, aClient *acptr);
|
||||||
@@ -149,9 +146,9 @@ static const EfunctionsList efunction_table[MAXEFUNCTIONS] = {
|
|||||||
/* 25 */ {"dospamfilter_viruschan", (void *)&dospamfilter_viruschan},
|
/* 25 */ {"dospamfilter_viruschan", (void *)&dospamfilter_viruschan},
|
||||||
/* 26 */ {"find_tkline_match_zap_ex", (void *)&find_tkline_match_zap_ex},
|
/* 26 */ {"find_tkline_match_zap_ex", (void *)&find_tkline_match_zap_ex},
|
||||||
/* 27 */ {"send_list", (void *)&send_list},
|
/* 27 */ {"send_list", (void *)&send_list},
|
||||||
/* 28 */ {"stripbadwords_channel", (void *)&stripbadwords_channel},
|
/* 28 */ {NULL,NULL},
|
||||||
/* 29 */ {"stripbadwords_message", (void *)&stripbadwords_message},
|
/* 29 */ {NULL,NULL},
|
||||||
/* 30 */ {"stripbadwords_quit", (void *)&stripbadwords_quit},
|
/* 30 */ {NULL,NULL},
|
||||||
/* 31 */ {"StripColors", (void *)&StripColors},
|
/* 31 */ {"StripColors", (void *)&StripColors},
|
||||||
/* 32 */ {"StripControlCodes", (void *)&StripControlCodes},
|
/* 32 */ {"StripControlCodes", (void *)&StripControlCodes},
|
||||||
/* 33 */ {"spamfilter_build_user_string", (void *)&spamfilter_build_user_string},
|
/* 33 */ {"spamfilter_build_user_string", (void *)&spamfilter_build_user_string},
|
||||||
@@ -211,7 +208,7 @@ void DeleteTempModules(void)
|
|||||||
{
|
{
|
||||||
if (strcmp(hData.cFileName, ".") || strcmp(hData.cFileName, ".."))
|
if (strcmp(hData.cFileName, ".") || strcmp(hData.cFileName, ".."))
|
||||||
{
|
{
|
||||||
ircsnprintf(tempbuf, sizeof(tempbuf), "tmp/%s", hdata.cFileName);
|
ircsnprintf(tempbuf, sizeof(tempbuf), "tmp/%s", hData.cFileName);
|
||||||
remove(tempbuf);
|
remove(tempbuf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -302,7 +299,6 @@ unsigned int maj, min, plevel;
|
|||||||
*/
|
*/
|
||||||
char *Module_Create(char *path_)
|
char *Module_Create(char *path_)
|
||||||
{
|
{
|
||||||
#ifndef STATIC_LINKING
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
HMODULE Mod;
|
HMODULE Mod;
|
||||||
#else /* _WIN32 */
|
#else /* _WIN32 */
|
||||||
@@ -330,8 +326,18 @@ char *Module_Create(char *path_)
|
|||||||
if (!strstr(path, MODULE_SUFFIX))
|
if (!strstr(path, MODULE_SUFFIX))
|
||||||
{
|
{
|
||||||
char dirbase[1024];
|
char dirbase[1024];
|
||||||
|
#ifdef CHROOTDIR
|
||||||
|
/* Not so sure if I like this magic... */
|
||||||
|
if (!strncmp(path, "modules/", 8) && (access("modules", F_OK)<0) && (access("src/modules", F_OK)==0))
|
||||||
|
strcpy(dirbase, "./src");
|
||||||
|
else
|
||||||
|
strcpy(dirbase, ".");
|
||||||
|
#elif !defined(_WIN32)
|
||||||
unreal_getpathname(SPATH, dirbase);
|
unreal_getpathname(SPATH, dirbase);
|
||||||
ircsnprintf(pathbuf, sizeof(pathbuf), "%s/%s%s", dirbase, path, MODULE_SUFFIX);
|
#else
|
||||||
|
strcpy(dirbase, ".");
|
||||||
|
#endif
|
||||||
|
ircsnprintf(pathbuf, sizeof(pathbuf), "%s/%s%s", dirbase, path, MODULE_SUFFIX);
|
||||||
path = pathbuf;
|
path = pathbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -498,11 +504,6 @@ char *Module_Create(char *path_)
|
|||||||
|
|
||||||
if (path != path_ && path != pathbuf)
|
if (path != path_ && path != pathbuf)
|
||||||
free(path);
|
free(path);
|
||||||
|
|
||||||
#else /* !STATIC_LINKING */
|
|
||||||
return "We don't support dynamic linking";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module_DelayChildren(Module *m)
|
void Module_DelayChildren(Module *m)
|
||||||
@@ -860,7 +861,6 @@ vFP Module_SymEx(
|
|||||||
#endif
|
#endif
|
||||||
, char *name)
|
, char *name)
|
||||||
{
|
{
|
||||||
#ifndef STATIC_LINKING
|
|
||||||
vFP fp;
|
vFP fp;
|
||||||
|
|
||||||
if (!name)
|
if (!name)
|
||||||
@@ -870,13 +870,10 @@ vFP Module_SymEx(
|
|||||||
if (fp)
|
if (fp)
|
||||||
return (fp);
|
return (fp);
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vFP Module_Sym(char *name)
|
vFP Module_Sym(char *name)
|
||||||
{
|
{
|
||||||
#ifndef STATIC_LINKING
|
|
||||||
vFP fp;
|
vFP fp;
|
||||||
Module *mi;
|
Module *mi;
|
||||||
|
|
||||||
@@ -893,12 +890,10 @@ vFP Module_Sym(char *name)
|
|||||||
return (fp);
|
return (fp);
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vFP Module_SymX(char *name, Module **mptr)
|
vFP Module_SymX(char *name, Module **mptr)
|
||||||
{
|
{
|
||||||
#ifndef STATIC_LINKING
|
|
||||||
vFP fp;
|
vFP fp;
|
||||||
Module *mi;
|
Module *mi;
|
||||||
|
|
||||||
@@ -919,7 +914,6 @@ vFP Module_SymX(char *name, Module **mptr)
|
|||||||
}
|
}
|
||||||
*mptr = NULL;
|
*mptr = NULL;
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -927,7 +921,6 @@ vFP Module_SymX(char *name, Module **mptr)
|
|||||||
|
|
||||||
void module_loadall(int module_load)
|
void module_loadall(int module_load)
|
||||||
{
|
{
|
||||||
#ifndef STATIC_LINKING
|
|
||||||
iFP fp;
|
iFP fp;
|
||||||
Module *mi, *next;
|
Module *mi, *next;
|
||||||
|
|
||||||
@@ -952,7 +945,6 @@ void module_loadall(int module_load)
|
|||||||
else
|
else
|
||||||
mi->flags = MODFLAG_LOADED;
|
mi->flags = MODFLAG_LOADED;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int Module_IsAlreadyChild(Module *parent, Module *child)
|
inline int Module_IsAlreadyChild(Module *parent, Module *child)
|
||||||
@@ -983,7 +975,6 @@ int Module_Depend_Resolve(Module *p, char *path)
|
|||||||
|
|
||||||
if (d == NULL)
|
if (d == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
#ifndef STATIC_LINKING
|
|
||||||
while (d->pointer)
|
while (d->pointer)
|
||||||
{
|
{
|
||||||
if ((*(d->pointer) = Module_SymEx(p->dll, d->symbol)))
|
if ((*(d->pointer) = Module_SymEx(p->dll, d->symbol)))
|
||||||
@@ -1023,13 +1014,6 @@ int Module_Depend_Resolve(Module *p, char *path)
|
|||||||
d++;
|
d++;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
|
||||||
while (d->pointer)
|
|
||||||
{
|
|
||||||
*((vFP *)d->pointer) = (vFP) d->realfunc;
|
|
||||||
d++;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* m_module.
|
/* m_module.
|
||||||
@@ -1581,11 +1565,14 @@ void unload_all_modules(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int ModuleSetOptions(Module *module, unsigned int options)
|
unsigned int ModuleSetOptions(Module *module, unsigned int options, int action)
|
||||||
{
|
{
|
||||||
unsigned int oldopts = module->options;
|
unsigned int oldopts = module->options;
|
||||||
|
|
||||||
module->options = options;
|
if (action)
|
||||||
|
module->options |= options;
|
||||||
|
else
|
||||||
|
module->options &= ~options;
|
||||||
return oldopts;
|
return oldopts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-41
@@ -20,7 +20,7 @@
|
|||||||
#*/
|
#*/
|
||||||
# major edit from fez - to compile objects individually...
|
# major edit from fez - to compile objects individually...
|
||||||
|
|
||||||
INCLUDES = ../include/auth.h ../include/badwords.h ../include/channel.h \
|
INCLUDES = ../include/auth.h ../include/channel.h \
|
||||||
../include/class.h ../include/common.h ../include/config.h ../include/dbuf.h \
|
../include/class.h ../include/common.h ../include/config.h ../include/dbuf.h \
|
||||||
../include/dynconf.h ../include/events.h ../include/fdlist.h ../include/h.h \
|
../include/dynconf.h ../include/events.h ../include/fdlist.h ../include/h.h \
|
||||||
../include/hash.h ../include/inet.h ../include/ircsprintf.h \
|
../include/hash.h ../include/inet.h ../include/ircsprintf.h \
|
||||||
@@ -54,36 +54,10 @@ R_MODULES= \
|
|||||||
m_connect.so m_dccallow.so m_userip.so m_nick.so m_user.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_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_addmotd.so \
|
m_botmotd.so m_lusers.so m_names.so m_svsnolag.so m_addmotd.so \
|
||||||
m_svslusers.so m_starttls.so m_nopost.so m_issecure.so m_cap.so \
|
m_svslusers.so m_starttls.so m_nopost.so m_cap.so \
|
||||||
m_sasl.so cap_invitenotify.so
|
m_sasl.so cap_invitenotify.so
|
||||||
|
|
||||||
MODES = chm_permanent.so
|
MODULES=cloak.so $(R_MODULES)
|
||||||
|
|
||||||
#note change of .c to .o
|
|
||||||
COMMANDS=m_sethost.o m_chghost.o m_chgident.o m_setname.o m_setident.o \
|
|
||||||
m_sdesc.o m_svsmode.o m_swhois.o m_svsmotd.o m_svsnline.o \
|
|
||||||
m_who.o m_mkpasswd.o m_away.o m_svsnoop.o m_svso.o m_svsnick.o \
|
|
||||||
m_adminchat.o m_chgname.o m_guest.o m_kill.o \
|
|
||||||
m_lag.o m_message.o m_nachat.o m_oper.o m_pingpong.o \
|
|
||||||
m_quit.o m_rping.o m_sendumode.o m_sqline.o \
|
|
||||||
m_tsctl.o m_unkline.o m_unsqline.o m_unzline.o m_whois.o \
|
|
||||||
m_tkl.o m_vhost.o m_cycle.o m_svsjoin.o m_svspart.o \
|
|
||||||
m_svslusers.o m_svswatch.o m_svssilence.o m_sendsno.o \
|
|
||||||
m_svssno.o m_sajoin.o m_sapart.o m_samode.o m_kick.o m_topic.o \
|
|
||||||
m_invite.o m_list.o m_time.o m_svskill.o m_sjoin.o \
|
|
||||||
m_pass.o m_userhost.o m_ison.o m_silence.o m_knock.o m_umode2.o \
|
|
||||||
m_squit.o m_protoctl.o m_addmotd.o m_addomotd.o \
|
|
||||||
m_wallops.o m_admin.o m_globops.o m_locops.o m_chatops.o \
|
|
||||||
m_trace.o m_netinfo.o m_links.o m_help.o m_rules.o \
|
|
||||||
m_close.o m_map.o m_eos.o m_server.o m_stats.o \
|
|
||||||
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_starttls.o \
|
|
||||||
m_nopost.o m_issecure.o m_cap.o m_sasl.o
|
|
||||||
|
|
||||||
|
|
||||||
MODULES=cloak.so $(R_MODULES) $(MODES)
|
|
||||||
MODULEFLAGS=@MODULEFLAGS@
|
MODULEFLAGS=@MODULEFLAGS@
|
||||||
CC=@CC@
|
CC=@CC@
|
||||||
RM=@RM@
|
RM=@RM@
|
||||||
@@ -91,6 +65,8 @@ RM=@RM@
|
|||||||
all: build
|
all: build
|
||||||
|
|
||||||
build: $(MODULES)
|
build: $(MODULES)
|
||||||
|
cd chanmodes; $(MAKE) all
|
||||||
|
cd usermodes; $(MAKE) all
|
||||||
|
|
||||||
custommodule: $(MODULEFILE).c
|
custommodule: $(MODULEFILE).c
|
||||||
$(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
|
$(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
|
||||||
@@ -504,10 +480,6 @@ m_nopost.so: m_nopost.c $(INCLUDES)
|
|||||||
$(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
|
$(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
|
||||||
-o m_nopost.so m_nopost.c
|
-o m_nopost.so m_nopost.c
|
||||||
|
|
||||||
m_issecure.so: m_issecure.c $(INCLUDES)
|
|
||||||
$(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
|
|
||||||
-o m_issecure.so m_issecure.c
|
|
||||||
|
|
||||||
m_cap.so: m_cap.c $(INCLUDES)
|
m_cap.so: m_cap.c $(INCLUDES)
|
||||||
$(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
|
$(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
|
||||||
-o m_cap.so m_cap.c
|
-o m_cap.so m_cap.c
|
||||||
@@ -524,14 +496,6 @@ cap_invitenotify.so: cap_invitenotify.c $(INCLUDES)
|
|||||||
$(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
|
$(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
|
||||||
-o cap_invitenotify.so cap_invitenotify.c
|
-o cap_invitenotify.so cap_invitenotify.c
|
||||||
|
|
||||||
#############################################################################
|
|
||||||
# channel modes
|
|
||||||
#############################################################################
|
|
||||||
|
|
||||||
chm_permanent.so: chm_permanent.c $(INCLUDES)
|
|
||||||
$(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
|
|
||||||
-o chm_permanent.so chm_permanent.c
|
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
# and now the remaining modules...
|
# and now the remaining modules...
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|||||||
@@ -17,13 +17,28 @@
|
|||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
#include "config.h"
|
||||||
#include <assert.h>
|
|
||||||
#include "struct.h"
|
#include "struct.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "sys.h"
|
#include "sys.h"
|
||||||
|
#include "numeric.h"
|
||||||
|
#include "msg.h"
|
||||||
|
#include "proto.h"
|
||||||
|
#include "channel.h"
|
||||||
|
#include <time.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <io.h>
|
||||||
|
#endif
|
||||||
|
#include <fcntl.h>
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include "version.h"
|
||||||
|
#endif
|
||||||
#include "m_cap.h"
|
#include "m_cap.h"
|
||||||
|
|
||||||
ModuleHeader MOD_HEADER(cap_invitenotify)
|
ModuleHeader MOD_HEADER(cap_invitenotify)
|
||||||
@@ -35,14 +50,15 @@ ModuleHeader MOD_HEADER(cap_invitenotify)
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
static ClientCapability cap_invitenotify = {
|
|
||||||
.name = "invite-notify",
|
|
||||||
.cap = PROTO_INVITENOTIFY,
|
|
||||||
};
|
|
||||||
|
|
||||||
static void cap_invitenotify_caplist(struct list_head *head)
|
static void cap_invitenotify_caplist(struct list_head *head)
|
||||||
{
|
{
|
||||||
clicap_append(head, &cap_invitenotify);
|
ClientCapability *cap;
|
||||||
|
|
||||||
|
cap = MyMallocEx(sizeof(ClientCapability));
|
||||||
|
cap->name = strdup("invite-notify");
|
||||||
|
cap->cap = PROTO_INVITENOTIFY;
|
||||||
|
clicap_append(head, cap);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cap_invitenotify_invite(aClient *from, aClient *to, aChannel *chptr)
|
static void cap_invitenotify_invite(aClient *from, aClient *to, aChannel *chptr)
|
||||||
|
|||||||
@@ -0,0 +1,90 @@
|
|||||||
|
#************************************************************************
|
||||||
|
#* IRC - Internet Relay Chat, src/modules/chanmodes/Makefile
|
||||||
|
#* Copyright (C) Carsten V. Munk 2001 & The UnrealIRCd Team
|
||||||
|
#*
|
||||||
|
#* 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.
|
||||||
|
#*/
|
||||||
|
|
||||||
|
INCLUDES = ../../include/auth.h ../../include/channel.h \
|
||||||
|
../../include/class.h ../../include/common.h ../../include/config.h ../../include/dbuf.h \
|
||||||
|
../../include/dynconf.h ../../include/events.h ../../include/fdlist.h ../../include/h.h \
|
||||||
|
../../include/hash.h ../../include/inet.h ../../include/ircsprintf.h \
|
||||||
|
../../include/license.h ../../include/macros.h ../../include/md5.h \
|
||||||
|
../../include/modules.h ../../include/modversion.h ../../include/msg.h \
|
||||||
|
../../include/numeric.h ../../include/proto.h ../../include/res.h \
|
||||||
|
../../include/resource.h ../../include/setup.h ../../include/sjoin.h \
|
||||||
|
../../include/sock.h ../../include/ssl.h ../../include/struct.h ../../include/sys.h \
|
||||||
|
../../include/threads.h ../../include/types.h ../../include/url.h \
|
||||||
|
../../include/version.h ../../include/whowas.h
|
||||||
|
|
||||||
|
R_MODULES= \
|
||||||
|
nocolor.so stripcolor.so issecure.so permanent.so jointhrottle.so floodprot.so \
|
||||||
|
noctcp.so link.so censor.so
|
||||||
|
|
||||||
|
MODULES=$(R_MODULES)
|
||||||
|
MODULEFLAGS=@MODULEFLAGS@
|
||||||
|
CC=@CC@
|
||||||
|
RM=@RM@
|
||||||
|
|
||||||
|
all: build
|
||||||
|
|
||||||
|
build: $(MODULES)
|
||||||
|
|
||||||
|
custommodule: $(MODULEFILE).c
|
||||||
|
$(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
|
||||||
|
-o $(MODULEFILE).so $(MODULEFILE).c $(EXLIBS)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(RM) -f *.o *.so *~ core
|
||||||
|
|
||||||
|
#############################################################################
|
||||||
|
# .so's section
|
||||||
|
#############################################################################
|
||||||
|
|
||||||
|
issecure.so: issecure.c $(INCLUDES)
|
||||||
|
$(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
|
||||||
|
-o issecure.so issecure.c
|
||||||
|
|
||||||
|
nocolor.so: nocolor.c $(INCLUDES)
|
||||||
|
$(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
|
||||||
|
-o nocolor.so nocolor.c
|
||||||
|
|
||||||
|
stripcolor.so: stripcolor.c $(INCLUDES)
|
||||||
|
$(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
|
||||||
|
-o stripcolor.so stripcolor.c
|
||||||
|
|
||||||
|
permanent.so: permanent.c $(INCLUDES)
|
||||||
|
$(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
|
||||||
|
-o permanent.so permanent.c
|
||||||
|
|
||||||
|
jointhrottle.so: jointhrottle.c $(INCLUDES)
|
||||||
|
$(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
|
||||||
|
-o jointhrottle.so jointhrottle.c
|
||||||
|
|
||||||
|
floodprot.so: floodprot.c $(INCLUDES)
|
||||||
|
$(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
|
||||||
|
-o floodprot.so floodprot.c
|
||||||
|
|
||||||
|
noctcp.so: noctcp.c $(INCLUDES)
|
||||||
|
$(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
|
||||||
|
-o noctcp.so noctcp.c
|
||||||
|
|
||||||
|
link.so: link.c $(INCLUDES)
|
||||||
|
$(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
|
||||||
|
-o link.so link.c
|
||||||
|
|
||||||
|
censor.so: censor.c $(INCLUDES) ../../include/badwords.h
|
||||||
|
$(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
|
||||||
|
-o censor.so censor.c
|
||||||
@@ -0,0 +1,661 @@
|
|||||||
|
/*
|
||||||
|
* Channel Mode +G
|
||||||
|
* (C) Copyright 2005-current Bram Matthys and The UnrealIRCd team.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#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 <time.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <io.h>
|
||||||
|
#endif
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include "h.h"
|
||||||
|
#include "badwords.h"
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include "version.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
ModuleHeader MOD_HEADER(censor)
|
||||||
|
= {
|
||||||
|
"chanmodes/censor",
|
||||||
|
"$Id$",
|
||||||
|
"Channel Mode +G",
|
||||||
|
"3.2-b8-1",
|
||||||
|
NULL,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Cmode_t EXTMODE_CENSOR = 0L;
|
||||||
|
|
||||||
|
#define IsCensored(x) ((x)->mode.extmode & EXTMODE_CENSOR)
|
||||||
|
|
||||||
|
char *censor_pre_chanmsg(aClient *sptr, aChannel *chptr, char *text, int notice);
|
||||||
|
char *censor_pre_local_part(aClient *sptr, aChannel *chptr, char *text);
|
||||||
|
char *censor_pre_local_quit(aClient *sptr, char *text);
|
||||||
|
|
||||||
|
DLLFUNC int censor_config_test(ConfigFile *, ConfigEntry *, int, int *);
|
||||||
|
DLLFUNC int censor_config_run(ConfigFile *, ConfigEntry *, int);
|
||||||
|
|
||||||
|
ModuleInfo *ModInfo = NULL;
|
||||||
|
|
||||||
|
ConfigItem_badword *conf_badword_channel = NULL;
|
||||||
|
ConfigItem_badword *conf_badword_quit = NULL;
|
||||||
|
|
||||||
|
static ConfigItem_badword *copy_badword_struct(ConfigItem_badword *ca, int regex, int regflags);
|
||||||
|
|
||||||
|
|
||||||
|
DLLFUNC int MOD_TEST(censor)(ModuleInfo *modinfo)
|
||||||
|
{
|
||||||
|
HookAddEx(modinfo->handle, HOOKTYPE_CONFIGTEST, censor_config_test);
|
||||||
|
return MOD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
DLLFUNC int MOD_INIT(censor)(ModuleInfo *modinfo)
|
||||||
|
{
|
||||||
|
CmodeInfo req;
|
||||||
|
|
||||||
|
ModInfo = modinfo;
|
||||||
|
|
||||||
|
MARK_AS_OFFICIAL_MODULE(modinfo);
|
||||||
|
|
||||||
|
memset(&req, 0, sizeof(req));
|
||||||
|
req.paracount = 0;
|
||||||
|
req.is_ok = extcmode_default_requirechop;
|
||||||
|
req.flag = 'G';
|
||||||
|
CmodeAdd(modinfo->handle, req, &EXTMODE_CENSOR);
|
||||||
|
|
||||||
|
HookAddPCharEx(modinfo->handle, HOOKTYPE_PRE_CHANMSG, censor_pre_chanmsg);
|
||||||
|
HookAddPCharEx(modinfo->handle, HOOKTYPE_PRE_LOCAL_PART, censor_pre_local_part);
|
||||||
|
HookAddPCharEx(modinfo->handle, HOOKTYPE_PRE_LOCAL_QUIT, censor_pre_local_quit);
|
||||||
|
|
||||||
|
HookAddEx(modinfo->handle, HOOKTYPE_CONFIGRUN, censor_config_run);
|
||||||
|
return MOD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
DLLFUNC int MOD_LOAD(censor)(int module_load)
|
||||||
|
{
|
||||||
|
return MOD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DLLFUNC int MOD_UNLOAD(censor)(int module_unload)
|
||||||
|
{
|
||||||
|
ConfigItem_badword *badword, *next;
|
||||||
|
|
||||||
|
for (badword = conf_badword_channel; badword; badword = (ConfigItem_badword *) next)
|
||||||
|
{
|
||||||
|
next = badword->next;
|
||||||
|
ircfree(badword->word);
|
||||||
|
if (badword->replace)
|
||||||
|
ircfree(badword->replace);
|
||||||
|
regfree(&badword->expr);
|
||||||
|
DelListItem(badword, conf_badword_channel);
|
||||||
|
MyFree(badword);
|
||||||
|
}
|
||||||
|
for (badword = conf_badword_quit; badword; badword = (ConfigItem_badword *) next)
|
||||||
|
{
|
||||||
|
next = badword->next;
|
||||||
|
ircfree(badword->word);
|
||||||
|
if (badword->replace)
|
||||||
|
ircfree(badword->replace);
|
||||||
|
regfree(&badword->expr);
|
||||||
|
DelListItem(badword, conf_badword_quit);
|
||||||
|
MyFree(badword);
|
||||||
|
}
|
||||||
|
return MOD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
DLLFUNC int censor_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
|
||||||
|
{
|
||||||
|
int errors = 0;
|
||||||
|
ConfigEntry *cep;
|
||||||
|
char has_word = 0, has_replace = 0, has_action = 0, action = 'r';
|
||||||
|
|
||||||
|
if (type != CONFIG_MAIN)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (!ce || !ce->ce_varname || strcmp(ce->ce_varname, "badword"))
|
||||||
|
return 0; /* not interested */
|
||||||
|
|
||||||
|
if (!ce->ce_vardata)
|
||||||
|
{
|
||||||
|
config_error("%s:%i: badword without type",
|
||||||
|
ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else if (strcmp(ce->ce_vardata, "channel") &&
|
||||||
|
strcmp(ce->ce_vardata, "quit") && strcmp(ce->ce_vardata, "all")) {
|
||||||
|
/* config_error("%s:%i: badword with unknown type",
|
||||||
|
ce->ce_fileptr->cf_filename, ce->ce_varlinenum); -- can't do that.. */
|
||||||
|
return 0; /* unhandled */
|
||||||
|
}
|
||||||
|
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
|
||||||
|
{
|
||||||
|
if (config_is_blankorempty(cep, "badword"))
|
||||||
|
{
|
||||||
|
errors++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!strcmp(cep->ce_varname, "word"))
|
||||||
|
{
|
||||||
|
char *errbuf;
|
||||||
|
if (has_word)
|
||||||
|
{
|
||||||
|
config_warn_duplicate(cep->ce_fileptr->cf_filename,
|
||||||
|
cep->ce_varlinenum, "badword::word");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
has_word = 1;
|
||||||
|
if ((errbuf = unreal_checkregex(cep->ce_vardata,1,1)))
|
||||||
|
{
|
||||||
|
config_error("%s:%i: badword::%s contains an invalid regex: %s",
|
||||||
|
cep->ce_fileptr->cf_filename,
|
||||||
|
cep->ce_varlinenum,
|
||||||
|
cep->ce_varname, errbuf);
|
||||||
|
errors++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!strcmp(cep->ce_varname, "replace"))
|
||||||
|
{
|
||||||
|
if (has_replace)
|
||||||
|
{
|
||||||
|
config_warn_duplicate(cep->ce_fileptr->cf_filename,
|
||||||
|
cep->ce_varlinenum, "badword::replace");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
has_replace = 1;
|
||||||
|
}
|
||||||
|
else if (!strcmp(cep->ce_varname, "action"))
|
||||||
|
{
|
||||||
|
if (has_action)
|
||||||
|
{
|
||||||
|
config_warn_duplicate(cep->ce_fileptr->cf_filename,
|
||||||
|
cep->ce_varlinenum, "badword::action");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
has_action = 1;
|
||||||
|
if (!strcmp(cep->ce_vardata, "replace"))
|
||||||
|
action = 'r';
|
||||||
|
else if (!strcmp(cep->ce_vardata, "block"))
|
||||||
|
action = 'b';
|
||||||
|
else
|
||||||
|
{
|
||||||
|
config_error("%s:%d: Unknown badword::action '%s'",
|
||||||
|
cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
|
||||||
|
cep->ce_vardata);
|
||||||
|
errors++;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
config_error_unknown(cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
|
||||||
|
"badword", cep->ce_varname);
|
||||||
|
errors++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!has_word)
|
||||||
|
{
|
||||||
|
config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
|
||||||
|
"badword::word");
|
||||||
|
errors++;
|
||||||
|
}
|
||||||
|
if (has_action)
|
||||||
|
{
|
||||||
|
if (has_replace && action == 'b')
|
||||||
|
{
|
||||||
|
config_error("%s:%i: badword::action is block but badword::replace exists",
|
||||||
|
ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
|
||||||
|
errors++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*errs = errors;
|
||||||
|
return errors ? -1 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DLLFUNC int censor_config_run(ConfigFile *cf, ConfigEntry *ce, int type)
|
||||||
|
{
|
||||||
|
ConfigEntry *cep, *word = NULL;
|
||||||
|
ConfigItem_badword *ca;
|
||||||
|
char *tmp;
|
||||||
|
short regex = 0;
|
||||||
|
int regflags = 0;
|
||||||
|
int ast_l = 0, ast_r = 0;
|
||||||
|
|
||||||
|
if (type != CONFIG_MAIN)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (!ce || !ce->ce_varname || strcmp(ce->ce_varname, "badword"))
|
||||||
|
return 0; /* not interested */
|
||||||
|
|
||||||
|
if (strcmp(ce->ce_vardata, "channel") &&
|
||||||
|
strcmp(ce->ce_vardata, "quit") && strcmp(ce->ce_vardata, "all"))
|
||||||
|
return 0; /* not for us */
|
||||||
|
|
||||||
|
ca = MyMallocEx(sizeof(ConfigItem_badword));
|
||||||
|
ca->action = BADWORD_REPLACE;
|
||||||
|
regflags = REG_ICASE|REG_EXTENDED;
|
||||||
|
|
||||||
|
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
|
||||||
|
{
|
||||||
|
if (!strcmp(cep->ce_varname, "action"))
|
||||||
|
{
|
||||||
|
if (!strcmp(cep->ce_vardata, "block"))
|
||||||
|
{
|
||||||
|
ca->action = BADWORD_BLOCK;
|
||||||
|
/* If it is set to just block, then we don't need to worry about
|
||||||
|
* replacements
|
||||||
|
*/
|
||||||
|
regflags |= REG_NOSUB;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!strcmp(cep->ce_varname, "replace"))
|
||||||
|
{
|
||||||
|
ircstrdup(ca->replace, cep->ce_vardata);
|
||||||
|
}
|
||||||
|
else if (!strcmp(cep->ce_varname, "word"))
|
||||||
|
word = cep;
|
||||||
|
}
|
||||||
|
/* The fast badwords routine can do: "blah" "*blah" "blah*" and "*blah*",
|
||||||
|
* in all other cases use regex.
|
||||||
|
*/
|
||||||
|
for (tmp = word->ce_vardata; *tmp; tmp++) {
|
||||||
|
if (!isalnum(*tmp) && !(*tmp >= 128)) {
|
||||||
|
if ((word->ce_vardata == tmp) && (*tmp == '*')) {
|
||||||
|
ast_l = 1; /* Asterisk at the left */
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ((*(tmp + 1) == '\0') && (*tmp == '*')) {
|
||||||
|
ast_r = 1; /* Asterisk at the right */
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
regex = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (regex)
|
||||||
|
{
|
||||||
|
ca->type = BADW_TYPE_REGEX;
|
||||||
|
ircstrdup(ca->word, word->ce_vardata);
|
||||||
|
regcomp(&ca->expr, ca->word, regflags);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char *tmpw;
|
||||||
|
ca->type = BADW_TYPE_FAST;
|
||||||
|
ca->word = tmpw = MyMallocEx(strlen(word->ce_vardata) - ast_l - ast_r + 1);
|
||||||
|
/* Copy except for asterisks */
|
||||||
|
for (tmp = word->ce_vardata; *tmp; tmp++)
|
||||||
|
if (*tmp != '*')
|
||||||
|
*tmpw++ = *tmp;
|
||||||
|
*tmpw = '\0';
|
||||||
|
if (ast_l)
|
||||||
|
ca->type |= BADW_TYPE_FAST_L;
|
||||||
|
if (ast_r)
|
||||||
|
ca->type |= BADW_TYPE_FAST_R;
|
||||||
|
}
|
||||||
|
if (!strcmp(ce->ce_vardata, "channel"))
|
||||||
|
AddListItem(ca, conf_badword_channel);
|
||||||
|
else if (!strcmp(ce->ce_vardata, "quit"))
|
||||||
|
AddListItem(ca, conf_badword_quit);
|
||||||
|
else if (!strcmp(ce->ce_vardata, "all"))
|
||||||
|
{
|
||||||
|
AddListItem(ca, conf_badword_channel);
|
||||||
|
AddListItem(copy_badword_struct(ca,regex,regflags), conf_badword_quit);
|
||||||
|
return 0; /* pretend we didn't see it, so other modules can handle 'all' as well */
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ConfigItem_badword *copy_badword_struct(ConfigItem_badword *ca, int regex, int regflags)
|
||||||
|
{
|
||||||
|
ConfigItem_badword *x = MyMalloc(sizeof(ConfigItem_badword));
|
||||||
|
memcpy(x, ca, sizeof(ConfigItem_badword));
|
||||||
|
x->word = strdup(ca->word);
|
||||||
|
if (ca->replace)
|
||||||
|
x->replace = strdup(ca->replace);
|
||||||
|
if (regex)
|
||||||
|
{
|
||||||
|
memset(&x->expr, 0, sizeof(regex_t));
|
||||||
|
regcomp(&x->expr, x->word, regflags);
|
||||||
|
}
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* our own strcasestr implementation because strcasestr is often not
|
||||||
|
* available or is not working correctly.
|
||||||
|
*/
|
||||||
|
char *our_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 */
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int fast_badword_match(ConfigItem_badword *badword, char *line)
|
||||||
|
{
|
||||||
|
char *p;
|
||||||
|
int bwlen = strlen(badword->word);
|
||||||
|
if ((badword->type & BADW_TYPE_FAST_L) && (badword->type & BADW_TYPE_FAST_R))
|
||||||
|
return (our_strcasestr(line, badword->word) ? 1 : 0);
|
||||||
|
|
||||||
|
p = line;
|
||||||
|
while((p = our_strcasestr(p, badword->word)))
|
||||||
|
{
|
||||||
|
if (!(badword->type & BADW_TYPE_FAST_L))
|
||||||
|
{
|
||||||
|
if ((p != line) && !iswseperator(*(p - 1))) /* aaBLA but no *BLA */
|
||||||
|
goto next;
|
||||||
|
}
|
||||||
|
if (!(badword->type & BADW_TYPE_FAST_R))
|
||||||
|
{
|
||||||
|
if (!iswseperator(*(p + bwlen))) /* BLAaa but no BLA* */
|
||||||
|
goto next;
|
||||||
|
}
|
||||||
|
/* Looks like it matched */
|
||||||
|
return 1;
|
||||||
|
next:
|
||||||
|
p += bwlen;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
/* fast_badword_replace:
|
||||||
|
* a fast replace routine written by Syzop used for replacing badwords.
|
||||||
|
* searches in line for huntw and replaces it with replacew,
|
||||||
|
* buf is used for the result and max is sizeof(buf).
|
||||||
|
* (Internal assumptions: max > 0 AND max > strlen(line)+1)
|
||||||
|
*/
|
||||||
|
inline int fast_badword_replace(ConfigItem_badword *badword, char *line, char *buf, int max)
|
||||||
|
{
|
||||||
|
/* Some aliases ;P */
|
||||||
|
char *replacew = badword->replace ? badword->replace : REPLACEWORD;
|
||||||
|
char *pold = line, *pnew = buf; /* Pointers to old string and new string */
|
||||||
|
char *poldx = line;
|
||||||
|
int replacen = -1; /* Only calculated if needed. w00t! saves us a few nanosecs? lol */
|
||||||
|
int searchn = -1;
|
||||||
|
char *startw, *endw;
|
||||||
|
char *c_eol = buf + max - 1; /* Cached end of (new) line */
|
||||||
|
int run = 1;
|
||||||
|
int cleaned = 0;
|
||||||
|
|
||||||
|
Debug((DEBUG_NOTICE, "replacing %s -> %s in '%s'", badword->word, replacew, line));
|
||||||
|
|
||||||
|
while(run) {
|
||||||
|
pold = our_strcasestr(pold, badword->word);
|
||||||
|
if (!pold)
|
||||||
|
break;
|
||||||
|
if (replacen == -1)
|
||||||
|
replacen = strlen(replacew);
|
||||||
|
if (searchn == -1)
|
||||||
|
searchn = strlen(badword->word);
|
||||||
|
/* 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 (!(badword->type & BADW_TYPE_FAST_L) && (pold != startw)) {
|
||||||
|
/* not matched */
|
||||||
|
pold++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Hunt for end of word */
|
||||||
|
for (endw = pold; ((*endw != '\0') && (!iswseperator(*endw))); endw++);
|
||||||
|
|
||||||
|
if (!(badword->type & BADW_TYPE_FAST_R) && (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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns a string, which has been filtered by the words loaded via
|
||||||
|
* the loadbadwords() function. It's primary use is to filter swearing
|
||||||
|
* in both private and public messages
|
||||||
|
*/
|
||||||
|
|
||||||
|
char *stripbadwords(char *str, ConfigItem_badword *start_bw, int *blocked)
|
||||||
|
{
|
||||||
|
regmatch_t pmatch[MAX_MATCH];
|
||||||
|
static char cleanstr[4096];
|
||||||
|
char buf[4096];
|
||||||
|
char *ptr;
|
||||||
|
int matchlen, m, stringlen, cleaned;
|
||||||
|
ConfigItem_badword *this_word;
|
||||||
|
|
||||||
|
*blocked = 0;
|
||||||
|
|
||||||
|
if (!start_bw)
|
||||||
|
return str;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* work on a copy
|
||||||
|
*/
|
||||||
|
stringlen = strlcpy(cleanstr, StripControlCodes(str), sizeof cleanstr);
|
||||||
|
memset(&pmatch, 0, sizeof pmatch);
|
||||||
|
matchlen = 0;
|
||||||
|
buf[0] = '\0';
|
||||||
|
cleaned = 0;
|
||||||
|
|
||||||
|
for (this_word = start_bw; this_word; this_word = (ConfigItem_badword *)this_word->next)
|
||||||
|
{
|
||||||
|
if (this_word->type & BADW_TYPE_FAST)
|
||||||
|
{
|
||||||
|
if (this_word->action == BADWORD_BLOCK)
|
||||||
|
{
|
||||||
|
if (fast_badword_match(this_word, cleanstr))
|
||||||
|
{
|
||||||
|
*blocked = 1;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int n;
|
||||||
|
/* fast_badword_replace() does size checking so we can use 512 here instead of 4096 */
|
||||||
|
n = fast_badword_replace(this_word, cleanstr, buf, 512);
|
||||||
|
if (!cleaned && n)
|
||||||
|
cleaned = n;
|
||||||
|
strcpy(cleanstr, buf);
|
||||||
|
memset(buf, 0, sizeof(buf)); /* regexp likes this somehow */
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
if (this_word->type & BADW_TYPE_REGEX)
|
||||||
|
{
|
||||||
|
if (this_word->action == BADWORD_BLOCK)
|
||||||
|
{
|
||||||
|
if (!regexec(&this_word->expr, cleanstr, 0, NULL, 0))
|
||||||
|
{
|
||||||
|
*blocked = 1;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ptr = cleanstr; /* set pointer to start of string */
|
||||||
|
while (regexec(&this_word->expr, ptr, MAX_MATCH, pmatch,0) != REG_NOMATCH)
|
||||||
|
{
|
||||||
|
if (pmatch[0].rm_so == -1)
|
||||||
|
break;
|
||||||
|
m = pmatch[0].rm_eo - pmatch[0].rm_so;
|
||||||
|
if (m == 0)
|
||||||
|
break; /* anti-loop */
|
||||||
|
cleaned = 1;
|
||||||
|
matchlen += m;
|
||||||
|
strlncat(buf, ptr, sizeof buf, pmatch[0].rm_so);
|
||||||
|
if (this_word->replace)
|
||||||
|
strlcat(buf, this_word->replace, sizeof buf);
|
||||||
|
else
|
||||||
|
strlcat(buf, REPLACEWORD, sizeof buf);
|
||||||
|
ptr += pmatch[0].rm_eo; /* Set pointer after the match pos */
|
||||||
|
memset(&pmatch, 0, sizeof(pmatch));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* All the better to eat you with! */
|
||||||
|
strlcat(buf, ptr, sizeof buf);
|
||||||
|
memcpy(cleanstr, buf, sizeof cleanstr);
|
||||||
|
memset(buf, 0, sizeof(buf));
|
||||||
|
if (matchlen == stringlen)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cleanstr[511] = '\0'; /* cutoff, just to be sure */
|
||||||
|
|
||||||
|
return (cleaned) ? cleanstr : str;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *stripbadwords_channel(char *str, int *blocked)
|
||||||
|
{
|
||||||
|
return stripbadwords(str, conf_badword_channel, blocked);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *stripbadwords_quit(char *str, int *blocked)
|
||||||
|
{
|
||||||
|
return stripbadwords(str, conf_badword_quit, blocked);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
char *censor_pre_chanmsg(aClient *sptr, aChannel *chptr, char *text, int notice)
|
||||||
|
{
|
||||||
|
int blocked;
|
||||||
|
|
||||||
|
if (!IsCensored(chptr))
|
||||||
|
return text;
|
||||||
|
|
||||||
|
text = stripbadwords_channel(text, &blocked);
|
||||||
|
if (blocked)
|
||||||
|
{
|
||||||
|
if (!notice)
|
||||||
|
sendto_one(sptr, err_str(ERR_CANNOTSENDTOCHAN),
|
||||||
|
me.name, sptr->name, chptr->chname,
|
||||||
|
"Swearing is not permitted in this channel", chptr->chname);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *censor_pre_local_part(aClient *sptr, aChannel *chptr, char *text)
|
||||||
|
{
|
||||||
|
int blocked;
|
||||||
|
|
||||||
|
if (!IsCensored(chptr))
|
||||||
|
return text;
|
||||||
|
|
||||||
|
text = stripbadwords_channel(text, &blocked);
|
||||||
|
return blocked ? NULL : text;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Is any channel where the user is in +G? */
|
||||||
|
static int IsAnyChannelCensored(aClient *sptr)
|
||||||
|
{
|
||||||
|
Membership *lp;
|
||||||
|
|
||||||
|
for (lp = sptr->user->channel; lp; lp = lp->next)
|
||||||
|
if (IsCensored(lp->chptr))
|
||||||
|
return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *censor_pre_local_quit(aClient *sptr, char *text)
|
||||||
|
{
|
||||||
|
int blocked;
|
||||||
|
|
||||||
|
if (IsAnyChannelCensored(sptr))
|
||||||
|
text = stripbadwords_quit(text, &blocked);
|
||||||
|
return blocked ? NULL : text;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: when stats is modular, make it call this for badwords
|
||||||
|
int stats_badwords(aClient *sptr, char *para)
|
||||||
|
{
|
||||||
|
ConfigItem_badword *words;
|
||||||
|
|
||||||
|
for (words = conf_badword_channel; words; words = (ConfigItem_badword *) words->next)
|
||||||
|
{
|
||||||
|
sendto_one(sptr, ":%s %i %s :c %c %s%s%s %s",
|
||||||
|
me.name, RPL_TEXT, sptr->name, words->type & BADW_TYPE_REGEX ? 'R' : 'F',
|
||||||
|
(words->type & BADW_TYPE_FAST_L) ? "*" : "", words->word,
|
||||||
|
(words->type & BADW_TYPE_FAST_R) ? "*" : "",
|
||||||
|
words->action == BADWORD_REPLACE ? (words->replace ? words->replace : "<censored>") : "");
|
||||||
|
}
|
||||||
|
for (words = conf_badword_quit; words; words = (ConfigItem_badword *) words->next)
|
||||||
|
{
|
||||||
|
sendto_one(sptr, ":%s %i %s :q %c %s%s%s %s",
|
||||||
|
me.name, RPL_TEXT, sptr->name, words->type & BADW_TYPE_REGEX ? 'R' : 'F',
|
||||||
|
(words->type & BADW_TYPE_FAST_L) ? "*" : "", words->word,
|
||||||
|
(words->type & BADW_TYPE_FAST_R) ? "*" : "",
|
||||||
|
words->action == BADWORD_REPLACE ? (words->replace ? words->replace : "<censored>") : "");
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Channel Is Secure UnrealIRCd module (Channel Mode +Z)
|
* Channel Is Secure UnrealIRCd module (Channel Mode +Z)
|
||||||
* (C) Copyright 2010 Bram Matthys (Syzop) and the UnrealIRCd team
|
* (C) Copyright 2010-.. Bram Matthys (Syzop) and the UnrealIRCd team
|
||||||
*
|
*
|
||||||
* This module will indicate if a channel is secure, and if so will set +Z.
|
* This module will indicate if a channel is secure, and if so will set +Z.
|
||||||
* Secure is defined as: all users on the channel are connected through SSL/TLS
|
* Secure is defined as: all users on the channel are connected through SSL/TLS
|
||||||
@@ -42,18 +42,15 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
#include "badwords.h"
|
|
||||||
#endif
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DLLFUNC CMD_FUNC(m_issecure);
|
DLLFUNC CMD_FUNC(issecure);
|
||||||
|
|
||||||
ModuleHeader MOD_HEADER(m_issecure)
|
ModuleHeader MOD_HEADER(issecure)
|
||||||
= {
|
= {
|
||||||
"m_issecure",
|
"chanmodes/issecure",
|
||||||
"$Id$",
|
"$Id$",
|
||||||
"Channel Mode +Z",
|
"Channel Mode +Z",
|
||||||
"3.2-b8-1",
|
"3.2-b8-1",
|
||||||
@@ -66,7 +63,7 @@ Cmode_t EXTCMODE_ISSECURE;
|
|||||||
#define IsSecureChanIndicated(chptr) (chptr->mode.extmode & EXTCMODE_ISSECURE)
|
#define IsSecureChanIndicated(chptr) (chptr->mode.extmode & EXTCMODE_ISSECURE)
|
||||||
|
|
||||||
|
|
||||||
int modeZ_is_ok(aClient *sptr, aChannel *chptr, char *para, int checkt, int what);
|
int modeZ_is_ok(aClient *sptr, aChannel *chptr, char mode, char *para, int checkt, int what);
|
||||||
DLLFUNC int issecure_join(aClient *cptr, aClient *sptr, aChannel *chptr, char *parv[]);
|
DLLFUNC int issecure_join(aClient *cptr, aClient *sptr, aChannel *chptr, char *parv[]);
|
||||||
DLLFUNC int issecure_part(aClient *cptr, aClient *sptr, aChannel *chptr, char *comment);
|
DLLFUNC int issecure_part(aClient *cptr, aClient *sptr, aChannel *chptr, char *comment);
|
||||||
DLLFUNC int issecure_quit(aClient *acptr, char *comment);
|
DLLFUNC int issecure_quit(aClient *acptr, char *comment);
|
||||||
@@ -75,12 +72,12 @@ DLLFUNC int issecure_chanmode(aClient *cptr, aClient *sptr, aChannel *chptr,
|
|||||||
char *modebuf, char *parabuf, int sendts, int samode);
|
char *modebuf, char *parabuf, int sendts, int samode);
|
||||||
|
|
||||||
|
|
||||||
DLLFUNC int MOD_TEST(m_issecure)(ModuleInfo *modinfo)
|
DLLFUNC int MOD_TEST(issecure)(ModuleInfo *modinfo)
|
||||||
{
|
{
|
||||||
return MOD_SUCCESS;
|
return MOD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
DLLFUNC int MOD_INIT(m_issecure)(ModuleInfo *modinfo)
|
DLLFUNC int MOD_INIT(issecure)(ModuleInfo *modinfo)
|
||||||
{
|
{
|
||||||
CmodeInfo req;
|
CmodeInfo req;
|
||||||
|
|
||||||
@@ -107,17 +104,17 @@ CmodeInfo req;
|
|||||||
return MOD_SUCCESS;
|
return MOD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
DLLFUNC int MOD_LOAD(m_issecure)(int module_load)
|
DLLFUNC int MOD_LOAD(issecure)(int module_load)
|
||||||
{
|
{
|
||||||
return MOD_SUCCESS;
|
return MOD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
DLLFUNC int MOD_UNLOAD(m_issecure)(int module_unload)
|
DLLFUNC int MOD_UNLOAD(issecure)(int module_unload)
|
||||||
{
|
{
|
||||||
return MOD_SUCCESS;
|
return MOD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int modeZ_is_ok(aClient *sptr, aChannel *chptr, char *para, int checkt, int what)
|
int modeZ_is_ok(aClient *sptr, aChannel *chptr, char mode, char *para, int checkt, int what)
|
||||||
{
|
{
|
||||||
/* Reject any attempt to set or unset our mode. Even to IRCOps */
|
/* Reject any attempt to set or unset our mode. Even to IRCOps */
|
||||||
return EX_ALWAYS_DENY;
|
return EX_ALWAYS_DENY;
|
||||||
@@ -0,0 +1,500 @@
|
|||||||
|
/*
|
||||||
|
* Channel Mode +j.
|
||||||
|
* (C) Copyright 2005-.. The UnrealIRCd team.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#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 <time.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <io.h>
|
||||||
|
#endif
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include "h.h"
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include "version.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
ModuleHeader MOD_HEADER(jointhrottle)
|
||||||
|
= {
|
||||||
|
"chanmodes/jointhrottle",
|
||||||
|
"$Id$",
|
||||||
|
"Channel Mode +j",
|
||||||
|
"3.2-b8-1",
|
||||||
|
NULL,
|
||||||
|
};
|
||||||
|
|
||||||
|
ModuleInfo *ModInfo = NULL;
|
||||||
|
|
||||||
|
Cmode_t EXTMODE_JOINTHROTTLE = 0L;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
unsigned short num;
|
||||||
|
unsigned short t;
|
||||||
|
} aModejEntry;
|
||||||
|
|
||||||
|
int cmodej_is_ok(aClient *sptr, aChannel *chptr, char mode, char *para, int type, int what);
|
||||||
|
void *cmodej_put_param(void *r_in, char *param);
|
||||||
|
char *cmodej_get_param(void *r_in);
|
||||||
|
char *cmodej_conv_param(char *param_in, aClient *sptr);
|
||||||
|
void cmodej_free_param(void *r);
|
||||||
|
void *cmodej_dup_struct(void *r_in);
|
||||||
|
int cmodej_sjoin_check(aChannel *chptr, void *ourx, void *theirx);
|
||||||
|
|
||||||
|
int jointhrottle_can_join(aClient *sptr, aChannel *chptr, char *key, char *link, char *parv[]);
|
||||||
|
int jointhrottle_local_join(aClient *cptr, aClient *sptr, aChannel *chptr, char *parv[]);
|
||||||
|
static int isjthrottled(aClient *cptr, aChannel *chptr);
|
||||||
|
static void cmodej_increase_usercounter(aClient *cptr, aChannel *chptr);
|
||||||
|
EVENT(cmodej_cleanup_structs);
|
||||||
|
int cmodej_exit_one_client(aClient *sptr);
|
||||||
|
int cmodej_channel_destroy(aChannel *chptr);
|
||||||
|
aJFlood *cmodej_addentry(aClient *cptr, aChannel *chptr);
|
||||||
|
|
||||||
|
DLLFUNC int MOD_INIT(jointhrottle)(ModuleInfo *modinfo)
|
||||||
|
{
|
||||||
|
CmodeInfo req;
|
||||||
|
ModuleSetOptions(modinfo->handle, MOD_OPT_PERM, 1);
|
||||||
|
MARK_AS_OFFICIAL_MODULE(modinfo);
|
||||||
|
ModInfo = modinfo;
|
||||||
|
memset(&req, 0, sizeof(req));
|
||||||
|
req.paracount = 1;
|
||||||
|
req.is_ok = cmodej_is_ok;
|
||||||
|
req.flag = 'j';
|
||||||
|
req.put_param = cmodej_put_param;
|
||||||
|
req.get_param = cmodej_get_param;
|
||||||
|
req.conv_param = cmodej_conv_param;
|
||||||
|
req.free_param = cmodej_free_param;
|
||||||
|
req.dup_struct = cmodej_dup_struct;
|
||||||
|
req.sjoin_check = cmodej_sjoin_check;
|
||||||
|
CmodeAdd(modinfo->handle, req, &EXTMODE_JOINTHROTTLE);
|
||||||
|
|
||||||
|
HookAddEx(modinfo->handle, HOOKTYPE_CAN_JOIN, jointhrottle_can_join);
|
||||||
|
HookAddEx(modinfo->handle, HOOKTYPE_LOCAL_JOIN, jointhrottle_local_join);
|
||||||
|
HookAddEx(modinfo->handle, HOOKTYPE_EXIT_ONE_CLIENT, cmodej_exit_one_client);
|
||||||
|
HookAddEx(modinfo->handle, HOOKTYPE_CHANNEL_DESTROY, cmodej_channel_destroy);
|
||||||
|
return MOD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
DLLFUNC int MOD_LOAD(jointhrottle)(int module_load)
|
||||||
|
{
|
||||||
|
EventAddEx(ModInfo->handle, "cmodej_cleanup_structs", 60, 0, cmodej_cleanup_structs, NULL);
|
||||||
|
return MOD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DLLFUNC int MOD_UNLOAD(jointhrottle)(int module_unload)
|
||||||
|
{
|
||||||
|
sendto_realops("Mod_Unload was called??? Argh!! We will loose all flood counters!");
|
||||||
|
return MOD_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
int cmodej_is_ok(aClient *sptr, aChannel *chptr, char mode, char *para, int type, int what)
|
||||||
|
{
|
||||||
|
if ((type == EXCHK_ACCESS) || (type == EXCHK_ACCESS_ERR))
|
||||||
|
{
|
||||||
|
if (IsPerson(sptr) && is_chan_op(sptr, chptr))
|
||||||
|
return EX_ALLOW;
|
||||||
|
if (type == EXCHK_ACCESS_ERR) /* can only be due to being halfop */
|
||||||
|
sendto_one(sptr, err_str(ERR_NOTFORHALFOPS), me.name, sptr->name, 'j');
|
||||||
|
return EX_DENY;
|
||||||
|
} else
|
||||||
|
if (type == EXCHK_PARAM)
|
||||||
|
{
|
||||||
|
/* Check parameter.. syntax should be X:Y, X should be 1-255, Y should be 1-999 */
|
||||||
|
char buf[32], *p;
|
||||||
|
int num, t, fail = 0;
|
||||||
|
|
||||||
|
strlcpy(buf, para, sizeof(buf));
|
||||||
|
p = strchr(buf, ':');
|
||||||
|
if (!p)
|
||||||
|
{
|
||||||
|
fail = 1;
|
||||||
|
} else {
|
||||||
|
*p++ = '\0';
|
||||||
|
num = atoi(buf);
|
||||||
|
t = atoi(p);
|
||||||
|
if ((num < 1) || (num > 255) || (t < 1) || (t > 999))
|
||||||
|
fail = 1;
|
||||||
|
}
|
||||||
|
if (fail)
|
||||||
|
{
|
||||||
|
sendnotice(sptr, "Error in setting +j, syntax: +j <num>:<seconds>, where <num> must be 1-255, and <seconds> 1-999");
|
||||||
|
return EX_DENY;
|
||||||
|
}
|
||||||
|
return EX_ALLOW;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* falltrough -- should not be used */
|
||||||
|
return EX_DENY;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *cmodej_put_param(void *r_in, char *param)
|
||||||
|
{
|
||||||
|
aModejEntry *r = (aModejEntry *)r_in;
|
||||||
|
char buf[32], *p;
|
||||||
|
int num, t;
|
||||||
|
|
||||||
|
if (!r)
|
||||||
|
{
|
||||||
|
/* Need to create one */
|
||||||
|
r = (aModejEntry *)MyMallocEx(sizeof(aModejEntry));
|
||||||
|
}
|
||||||
|
strlcpy(buf, param, sizeof(buf));
|
||||||
|
p = strchr(buf, ':');
|
||||||
|
if (p)
|
||||||
|
{
|
||||||
|
*p++ = '\0';
|
||||||
|
num = atoi(buf);
|
||||||
|
t = atoi(p);
|
||||||
|
if (num < 1) num = 1;
|
||||||
|
if (num > 255) num = 255;
|
||||||
|
if (t < 1) t = 1;
|
||||||
|
if (t > 999) t = 999;
|
||||||
|
r->num = num;
|
||||||
|
r->t = t;
|
||||||
|
} else {
|
||||||
|
r->num = 0;
|
||||||
|
r->t = 0;
|
||||||
|
}
|
||||||
|
return (void *)r;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *cmodej_get_param(void *r_in)
|
||||||
|
{
|
||||||
|
aModejEntry *r = (aModejEntry *)r_in;
|
||||||
|
static char retbuf[16];
|
||||||
|
|
||||||
|
if (!r)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
snprintf(retbuf, sizeof(retbuf), "%hu:%hu", r->num, r->t);
|
||||||
|
return retbuf;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *cmodej_conv_param(char *param_in, aClient *sptr)
|
||||||
|
{
|
||||||
|
static char retbuf[32];
|
||||||
|
char param[32], *p;
|
||||||
|
int num, t, fail = 0;
|
||||||
|
|
||||||
|
strlcpy(param, param_in, sizeof(param));
|
||||||
|
p = strchr(param, ':');
|
||||||
|
if (!p)
|
||||||
|
return NULL;
|
||||||
|
*p++ = '\0';
|
||||||
|
num = atoi(param);
|
||||||
|
t = atoi(p);
|
||||||
|
if (num < 1)
|
||||||
|
num = 1;
|
||||||
|
if (num > 255)
|
||||||
|
num = 255;
|
||||||
|
if (t < 1)
|
||||||
|
t = 1;
|
||||||
|
if (t > 999)
|
||||||
|
t = 999;
|
||||||
|
|
||||||
|
snprintf(retbuf, sizeof(retbuf), "%d:%d", num, t);
|
||||||
|
return retbuf;
|
||||||
|
}
|
||||||
|
|
||||||
|
void cmodej_free_param(void *r)
|
||||||
|
{
|
||||||
|
MyFree(r);
|
||||||
|
}
|
||||||
|
|
||||||
|
void *cmodej_dup_struct(void *r_in)
|
||||||
|
{
|
||||||
|
aModejEntry *r = (aModejEntry *)r_in;
|
||||||
|
aModejEntry *w = (aModejEntry *)MyMalloc(sizeof(aModejEntry));
|
||||||
|
|
||||||
|
memcpy(w, r, sizeof(aModejEntry));
|
||||||
|
return (void *)w;
|
||||||
|
}
|
||||||
|
|
||||||
|
int cmodej_sjoin_check(aChannel *chptr, void *ourx, void *theirx)
|
||||||
|
{
|
||||||
|
aModejEntry *our = (aModejEntry *)ourx;
|
||||||
|
aModejEntry *their = (aModejEntry *)theirx;
|
||||||
|
|
||||||
|
if (our->t != their->t)
|
||||||
|
{
|
||||||
|
if (our->t > their->t)
|
||||||
|
return EXSJ_WEWON;
|
||||||
|
else
|
||||||
|
return EXSJ_THEYWON;
|
||||||
|
}
|
||||||
|
else if (our->num != their->num)
|
||||||
|
{
|
||||||
|
if (our->num > their->num)
|
||||||
|
return EXSJ_WEWON;
|
||||||
|
else
|
||||||
|
return EXSJ_THEYWON;
|
||||||
|
} else
|
||||||
|
return EXSJ_SAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int isjthrottled(aClient *cptr, aChannel *chptr)
|
||||||
|
{
|
||||||
|
aModejEntry *m;
|
||||||
|
aJFlood *e;
|
||||||
|
int num=0, t=0;
|
||||||
|
|
||||||
|
if (!MyClient(cptr))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
m = (aModejEntry *)GETPARASTRUCT(chptr, 'j');
|
||||||
|
if (!m) return 0; /* caller made an error? */
|
||||||
|
num = m->num;
|
||||||
|
t = m->t;
|
||||||
|
|
||||||
|
#ifdef DEBUGMODE
|
||||||
|
if (!num || !t)
|
||||||
|
abort();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Grab user<->chan entry.. */
|
||||||
|
for (e = cptr->user->jflood; e; e=e->next_u)
|
||||||
|
if (e->chptr == chptr)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (!e)
|
||||||
|
return 0; /* Not present, so cannot be throttled */
|
||||||
|
|
||||||
|
/* Ok... now the actual check:
|
||||||
|
* if ([timer valid] && [one more join would exceed num])
|
||||||
|
*/
|
||||||
|
if (((TStime() - e->firstjoin) < t) && (e->numjoins == num))
|
||||||
|
return 1; /* Throttled */
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void cmodej_increase_usercounter(aClient *cptr, aChannel *chptr)
|
||||||
|
{
|
||||||
|
aModejEntry *m;
|
||||||
|
aJFlood *e;
|
||||||
|
int num=0, t=0;
|
||||||
|
|
||||||
|
if (!MyClient(cptr))
|
||||||
|
return;
|
||||||
|
|
||||||
|
m = (aModejEntry *)GETPARASTRUCT(chptr, 'j');
|
||||||
|
if (!m) return;
|
||||||
|
num = m->num;
|
||||||
|
t = m->t;
|
||||||
|
|
||||||
|
#ifdef DEBUGMODE
|
||||||
|
if (!num || !t)
|
||||||
|
abort();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Grab user<->chan entry.. */
|
||||||
|
for (e = cptr->user->jflood; e; e=e->next_u)
|
||||||
|
if (e->chptr == chptr)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (!e)
|
||||||
|
{
|
||||||
|
/* Allocate one */
|
||||||
|
e = cmodej_addentry(cptr, chptr);
|
||||||
|
e->firstjoin = TStime();
|
||||||
|
e->numjoins = 1;
|
||||||
|
} else
|
||||||
|
if ((TStime() - e->firstjoin) < t) /* still valid? */
|
||||||
|
{
|
||||||
|
e->numjoins++;
|
||||||
|
} else {
|
||||||
|
/* reset :p */
|
||||||
|
e->firstjoin = TStime();
|
||||||
|
e->numjoins = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int jointhrottle_can_join(aClient *sptr, aChannel *chptr, char *key, char *link, char *parv[])
|
||||||
|
{
|
||||||
|
if (!IsAnOper(sptr) &&
|
||||||
|
(chptr->mode.extmode & EXTMODE_JOINTHROTTLE) && isjthrottled(sptr, chptr))
|
||||||
|
return ERR_TOOMANYJOINS;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int jointhrottle_local_join(aClient *cptr, aClient *sptr, aChannel *chptr, char *parv[])
|
||||||
|
{
|
||||||
|
cmodej_increase_usercounter(cptr, chptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Adds a aJFlood entry to user & channel and returns entry.
|
||||||
|
* NOTE: Does not check for already-existing-entry
|
||||||
|
*/
|
||||||
|
aJFlood *cmodej_addentry(aClient *cptr, aChannel *chptr)
|
||||||
|
{
|
||||||
|
aJFlood *e;
|
||||||
|
|
||||||
|
#ifdef DEBUGMODE
|
||||||
|
if (!IsPerson(cptr))
|
||||||
|
abort();
|
||||||
|
|
||||||
|
for (e=cptr->user->jflood; e; e=e->next_u)
|
||||||
|
if (e->chptr == chptr)
|
||||||
|
abort();
|
||||||
|
|
||||||
|
for (e=chptr->jflood; e; e=e->next_c)
|
||||||
|
if (e->cptr == cptr)
|
||||||
|
abort();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
e = MyMallocEx(sizeof(aJFlood));
|
||||||
|
e->cptr = cptr;
|
||||||
|
e->chptr = chptr;
|
||||||
|
e->prev_u = e->prev_c = NULL;
|
||||||
|
e->next_u = cptr->user->jflood;
|
||||||
|
e->next_c = chptr->jflood;
|
||||||
|
if (cptr->user->jflood)
|
||||||
|
cptr->user->jflood->prev_u = e;
|
||||||
|
if (chptr->jflood)
|
||||||
|
chptr->jflood->prev_c = e;
|
||||||
|
cptr->user->jflood = chptr->jflood = e;
|
||||||
|
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Removes an individual entry from list and frees it.
|
||||||
|
*/
|
||||||
|
void cmodej_delentry(aJFlood *e)
|
||||||
|
{
|
||||||
|
/* remove from user.. */
|
||||||
|
if (e->prev_u)
|
||||||
|
e->prev_u->next_u = e->next_u;
|
||||||
|
else
|
||||||
|
e->cptr->user->jflood = e->next_u; /* new head */
|
||||||
|
if (e->next_u)
|
||||||
|
e->next_u->prev_u = e->prev_u;
|
||||||
|
|
||||||
|
/* remove from channel.. */
|
||||||
|
if (e->prev_c)
|
||||||
|
e->prev_c->next_c = e->next_c;
|
||||||
|
else
|
||||||
|
e->chptr->jflood = e->next_c; /* new head */
|
||||||
|
if (e->next_c)
|
||||||
|
e->next_c->prev_c = e->prev_c;
|
||||||
|
|
||||||
|
/* actually free it */
|
||||||
|
MyFree(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Removes all entries belonging to user from all lists and free them. */
|
||||||
|
void cmodej_deluserentries(aClient *cptr)
|
||||||
|
{
|
||||||
|
aJFlood *e, *e_next;
|
||||||
|
|
||||||
|
for (e=cptr->user->jflood; e; e=e_next)
|
||||||
|
{
|
||||||
|
e_next = e->next_u;
|
||||||
|
|
||||||
|
/* remove from channel.. */
|
||||||
|
if (e->prev_c)
|
||||||
|
e->prev_c->next_c = e->next_c;
|
||||||
|
else
|
||||||
|
e->chptr->jflood = e->next_c; /* new head */
|
||||||
|
if (e->next_c)
|
||||||
|
e->next_c->prev_c = e->prev_c;
|
||||||
|
|
||||||
|
/* actually free it */
|
||||||
|
MyFree(e);
|
||||||
|
}
|
||||||
|
cptr->user->jflood = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Removes all entries belonging to channel from all lists and free them. */
|
||||||
|
void cmodej_delchannelentries(aChannel *chptr)
|
||||||
|
{
|
||||||
|
aJFlood *e, *e_next;
|
||||||
|
|
||||||
|
for (e=chptr->jflood; e; e=e_next)
|
||||||
|
{
|
||||||
|
e_next = e->next_c;
|
||||||
|
|
||||||
|
/* remove from user.. */
|
||||||
|
if (e->prev_u)
|
||||||
|
e->prev_u->next_u = e->next_u;
|
||||||
|
else
|
||||||
|
e->cptr->user->jflood = e->next_u; /* new head */
|
||||||
|
if (e->next_u)
|
||||||
|
e->next_u->prev_u = e->prev_u;
|
||||||
|
|
||||||
|
/* actually free it */
|
||||||
|
MyFree(e);
|
||||||
|
}
|
||||||
|
chptr->jflood = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Regularly cleans up cmode-j user/chan structs */
|
||||||
|
EVENT(cmodej_cleanup_structs)
|
||||||
|
{
|
||||||
|
aJFlood *e, *e_next;
|
||||||
|
int i;
|
||||||
|
aClient *cptr;
|
||||||
|
aChannel *chptr;
|
||||||
|
int t;
|
||||||
|
//void *cmp;
|
||||||
|
#ifdef DEBUGMODE
|
||||||
|
int freed=0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
for (chptr = channel; chptr; chptr=chptr->nextch)
|
||||||
|
{
|
||||||
|
if (!chptr->jflood)
|
||||||
|
continue;
|
||||||
|
t=0;
|
||||||
|
/* t will be kept at 0 if not found or if mode not set,
|
||||||
|
* but DO still check since there are entries left as indicated by ->jflood!
|
||||||
|
*/
|
||||||
|
if (chptr->mode.extmode & EXTMODE_JOINTHROTTLE)
|
||||||
|
{
|
||||||
|
t = ((aModejEntry *)GETPARASTRUCT(chptr, 'j'))->t;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (e = chptr->jflood; e; e = e_next)
|
||||||
|
{
|
||||||
|
e_next = e->next_c;
|
||||||
|
|
||||||
|
if (e->firstjoin + t < TStime())
|
||||||
|
{
|
||||||
|
cmodej_delentry(e);
|
||||||
|
#ifdef DEBUGMODE
|
||||||
|
freed++;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUGMODE
|
||||||
|
if (freed)
|
||||||
|
ircd_log(LOG_ERROR, "cmodej_cleanup_structs: %d entries freed [%ld bytes]", freed, freed * sizeof(aJFlood));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
int cmodej_exit_one_client(aClient *sptr)
|
||||||
|
{
|
||||||
|
cmodej_deluserentries(sptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int cmodej_channel_destroy(aChannel *chptr)
|
||||||
|
{
|
||||||
|
cmodej_delchannelentries(chptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,214 @@
|
|||||||
|
/*
|
||||||
|
* Channel Mode +L.
|
||||||
|
* (C) Copyright 1999-.. The UnrealIRCd team.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#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 <time.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <io.h>
|
||||||
|
#endif
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include "h.h"
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include "version.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
ModuleHeader MOD_HEADER(link)
|
||||||
|
= {
|
||||||
|
"chanmodes/link",
|
||||||
|
"$Id$",
|
||||||
|
"Channel Mode +L",
|
||||||
|
"3.2-b8-1",
|
||||||
|
NULL,
|
||||||
|
};
|
||||||
|
|
||||||
|
Cmode_t EXTMODE_LINK = 0L;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
char linked[CHANNELLEN+1];
|
||||||
|
} aModeLEntry;
|
||||||
|
|
||||||
|
int cmodeL_is_ok(aClient *sptr, aChannel *chptr, char mode, char *para, int type, int what);
|
||||||
|
void *cmodeL_put_param(void *r_in, char *param);
|
||||||
|
char *cmodeL_get_param(void *r_in);
|
||||||
|
char *cmodeL_conv_param(char *param_in, aClient *sptr);
|
||||||
|
void cmodeL_free_param(void *r);
|
||||||
|
void *cmodeL_dup_struct(void *r_in);
|
||||||
|
int cmodeL_sjoin_check(aChannel *chptr, void *ourx, void *theirx);
|
||||||
|
|
||||||
|
int link_can_join_limitexceeded(aClient *sptr, aChannel *chptr, char *key, char *link, char *parv[]);
|
||||||
|
|
||||||
|
DLLFUNC int MOD_INIT(link)(ModuleInfo *modinfo)
|
||||||
|
{
|
||||||
|
CmodeInfo req;
|
||||||
|
ModuleSetOptions(modinfo->handle, MOD_OPT_PERM, 1);
|
||||||
|
MARK_AS_OFFICIAL_MODULE(modinfo);
|
||||||
|
memset(&req, 0, sizeof(req));
|
||||||
|
req.paracount = 1;
|
||||||
|
req.is_ok = cmodeL_is_ok;
|
||||||
|
req.flag = 'L';
|
||||||
|
req.unset_with_param = 1; /* Oh yeah, we are special! */
|
||||||
|
req.put_param = cmodeL_put_param;
|
||||||
|
req.get_param = cmodeL_get_param;
|
||||||
|
req.conv_param = cmodeL_conv_param;
|
||||||
|
req.free_param = cmodeL_free_param;
|
||||||
|
req.dup_struct = cmodeL_dup_struct;
|
||||||
|
req.sjoin_check = cmodeL_sjoin_check;
|
||||||
|
CmodeAdd(modinfo->handle, req, &EXTMODE_LINK);
|
||||||
|
|
||||||
|
HookAddEx(modinfo->handle, HOOKTYPE_CAN_JOIN_LIMITEXCEEDED, link_can_join_limitexceeded);
|
||||||
|
return MOD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
DLLFUNC int MOD_LOAD(link)(int module_load)
|
||||||
|
{
|
||||||
|
return MOD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DLLFUNC int MOD_UNLOAD(link)(int module_unload)
|
||||||
|
{
|
||||||
|
return MOD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int cmodeL_is_ok(aClient *sptr, aChannel *chptr, char mode, char *para, int type, int what)
|
||||||
|
{
|
||||||
|
if ((type == EXCHK_ACCESS) || (type == EXCHK_ACCESS_ERR))
|
||||||
|
{
|
||||||
|
if (IsPerson(sptr) && is_chanowner(sptr, chptr))
|
||||||
|
return EX_ALLOW;
|
||||||
|
if (type == EXCHK_ACCESS_ERR) /* can only be due to being halfop */
|
||||||
|
sendto_one(sptr, err_str(ERR_CHANOWNPRIVNEEDED), me.name, sptr->name, chptr->chname);
|
||||||
|
return EX_DENY;
|
||||||
|
} else
|
||||||
|
if (type == EXCHK_PARAM)
|
||||||
|
{
|
||||||
|
/* Check parameter.. syntax is +L #channel */
|
||||||
|
char buf[CHANNELLEN+1], *p;
|
||||||
|
|
||||||
|
if (strchr(para, ','))
|
||||||
|
return EX_DENY; /* multiple channels not permitted */
|
||||||
|
if (!IsChannelName(para))
|
||||||
|
{
|
||||||
|
if (MyClient(sptr))
|
||||||
|
sendto_one(sptr, err_str(ERR_NOSUCHCHANNEL), me.name, sptr->name, para);
|
||||||
|
return EX_DENY;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This needs to be exactly the same as in conv_param... */
|
||||||
|
strlcpy(buf, para, sizeof(buf));
|
||||||
|
clean_channelname(buf);
|
||||||
|
if ((p = strchr(buf, ':')))
|
||||||
|
*p = '\0';
|
||||||
|
if (find_channel(buf, NULL) == chptr)
|
||||||
|
{
|
||||||
|
if (MyClient(sptr))
|
||||||
|
sendto_one(sptr, err_str(ERR_CANNOTCHANGECHANMODE),
|
||||||
|
me.name, sptr->name, 'L',
|
||||||
|
"a channel cannot be linked to itself");
|
||||||
|
return EX_DENY;
|
||||||
|
}
|
||||||
|
return EX_ALLOW;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* falltrough -- should not be used */
|
||||||
|
return EX_DENY;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *cmodeL_put_param(void *r_in, char *param)
|
||||||
|
{
|
||||||
|
aModeLEntry *r = (aModeLEntry *)r_in;
|
||||||
|
|
||||||
|
if (!r)
|
||||||
|
{
|
||||||
|
/* Need to create one */
|
||||||
|
r = (aModeLEntry *)MyMallocEx(sizeof(aModeLEntry));
|
||||||
|
}
|
||||||
|
strlcpy(r->linked, param, sizeof(r->linked));
|
||||||
|
return (void *)r;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *cmodeL_get_param(void *r_in)
|
||||||
|
{
|
||||||
|
aModeLEntry *r = (aModeLEntry *)r_in;
|
||||||
|
static char retbuf[CHANNELLEN+1];
|
||||||
|
|
||||||
|
if (!r)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
strlcpy(retbuf, r->linked, sizeof(retbuf));
|
||||||
|
return retbuf;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *cmodeL_conv_param(char *param_in, aClient *sptr)
|
||||||
|
{
|
||||||
|
static char buf[CHANNELLEN+1];
|
||||||
|
char *p;
|
||||||
|
|
||||||
|
strlcpy(buf, param_in, sizeof(buf));
|
||||||
|
clean_channelname(buf);
|
||||||
|
if ((p = strchr(buf, ':')))
|
||||||
|
*p = '\0';
|
||||||
|
|
||||||
|
if (*buf == '\0')
|
||||||
|
strcpy(buf, "#<INVALID>"); /* better safe than sorry */
|
||||||
|
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
void cmodeL_free_param(void *r)
|
||||||
|
{
|
||||||
|
MyFree(r);
|
||||||
|
}
|
||||||
|
|
||||||
|
void *cmodeL_dup_struct(void *r_in)
|
||||||
|
{
|
||||||
|
aModeLEntry *r = (aModeLEntry *)r_in;
|
||||||
|
aModeLEntry *w = (aModeLEntry *)MyMalloc(sizeof(aModeLEntry));
|
||||||
|
|
||||||
|
memcpy(w, r, sizeof(aModeLEntry));
|
||||||
|
return (void *)w;
|
||||||
|
}
|
||||||
|
|
||||||
|
int cmodeL_sjoin_check(aChannel *chptr, void *ourx, void *theirx)
|
||||||
|
{
|
||||||
|
aModeLEntry *our = (aModeLEntry *)ourx;
|
||||||
|
aModeLEntry *their = (aModeLEntry *)theirx;
|
||||||
|
|
||||||
|
if (!strcmp(our->linked, their->linked))
|
||||||
|
return EXSJ_SAME;
|
||||||
|
if (strcmp(our->linked, their->linked) > 0)
|
||||||
|
return EXSJ_WEWON;
|
||||||
|
return EXSJ_THEYWON;
|
||||||
|
}
|
||||||
|
|
||||||
|
int link_can_join_limitexceeded(aClient *sptr, aChannel *chptr, char *key, char *link, char *parv[])
|
||||||
|
{
|
||||||
|
if (chptr->mode.extmode & EXTMODE_LINK)
|
||||||
|
{
|
||||||
|
/* We are linked. */
|
||||||
|
char *linked = cm_getparameter(chptr, 'L');
|
||||||
|
if (!linked)
|
||||||
|
return 0; /* uh-huh? +L but not found. */
|
||||||
|
sendto_one(sptr,
|
||||||
|
err_str(ERR_LINKCHANNEL), me.name, sptr->name, chptr->chname, linked);
|
||||||
|
parv[0] = sptr->name;
|
||||||
|
parv[1] = linked;
|
||||||
|
do_join(sptr, sptr, 2, parv);
|
||||||
|
return -1; /* Original channel join = ignored */
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,148 @@
|
|||||||
|
/*
|
||||||
|
* Block Color UnrealIRCd Module (Channel Mode +c)
|
||||||
|
* (C) Copyright 2000-.. Bram Matthys (Syzop) and the UnrealIRCd team
|
||||||
|
*
|
||||||
|
* 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 "proto.h"
|
||||||
|
#include "channel.h"
|
||||||
|
#include <time.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <io.h>
|
||||||
|
#endif
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include "h.h"
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include "version.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
DLLFUNC CMD_FUNC(nocolor);
|
||||||
|
|
||||||
|
ModuleHeader MOD_HEADER(nocolor)
|
||||||
|
= {
|
||||||
|
"chanmodes/nocolor",
|
||||||
|
"$Id$",
|
||||||
|
"Channel Mode +c",
|
||||||
|
"3.2-b8-1",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
Cmode_t EXTCMODE_NOCOLOR;
|
||||||
|
|
||||||
|
#define IsNoColor(chptr) (chptr->mode.extmode & EXTCMODE_NOCOLOR)
|
||||||
|
|
||||||
|
DLLFUNC char *nocolor_prechanmsg(aClient *sptr, aChannel *chptr, char *text, int notice);
|
||||||
|
DLLFUNC char *nocolor_prelocalpart(aClient *sptr, aChannel *chptr, char *comment);
|
||||||
|
DLLFUNC char *nocolor_prelocalquit(aClient *sptr, char *comment);
|
||||||
|
|
||||||
|
DLLFUNC int MOD_TEST(nocolor)(ModuleInfo *modinfo)
|
||||||
|
{
|
||||||
|
return MOD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
DLLFUNC int MOD_INIT(nocolor)(ModuleInfo *modinfo)
|
||||||
|
{
|
||||||
|
CmodeInfo req;
|
||||||
|
|
||||||
|
/* Channel mode */
|
||||||
|
memset(&req, 0, sizeof(req));
|
||||||
|
req.paracount = 0;
|
||||||
|
req.flag = 'c';
|
||||||
|
req.is_ok = extcmode_default_requirechop;
|
||||||
|
CmodeAdd(modinfo->handle, req, &EXTCMODE_NOCOLOR);
|
||||||
|
|
||||||
|
HookAddPCharEx(modinfo->handle, HOOKTYPE_PRE_CHANMSG, nocolor_prechanmsg);
|
||||||
|
HookAddPCharEx(modinfo->handle, HOOKTYPE_PRE_LOCAL_PART, nocolor_prelocalpart);
|
||||||
|
HookAddPCharEx(modinfo->handle, HOOKTYPE_PRE_LOCAL_QUIT, nocolor_prelocalquit);
|
||||||
|
|
||||||
|
MARK_AS_OFFICIAL_MODULE(modinfo);
|
||||||
|
return MOD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
DLLFUNC int MOD_LOAD(nocolor)(int module_load)
|
||||||
|
{
|
||||||
|
return MOD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
DLLFUNC int MOD_UNLOAD(nocolor)(int module_unload)
|
||||||
|
{
|
||||||
|
return MOD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int IsUsingColor(char *s)
|
||||||
|
{
|
||||||
|
if (!s)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
for (; *s; s++)
|
||||||
|
if (*s == 3 || *s == 27 || *s == 4 || *s == 22) /* mirc color, ansi, rgb, reverse */
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
DLLFUNC char *nocolor_prechanmsg(aClient *sptr, aChannel *chptr, char *text, int notice)
|
||||||
|
{
|
||||||
|
if (MyClient(sptr) && IsNoColor(chptr) && IsUsingColor(text))
|
||||||
|
{
|
||||||
|
if (!notice)
|
||||||
|
{
|
||||||
|
sendto_one(sptr, err_str(ERR_CANNOTSENDTOCHAN),
|
||||||
|
me.name, sptr->name, chptr->chname,
|
||||||
|
"Color is not permitted in this channel", chptr->chname);
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
DLLFUNC char *nocolor_prelocalpart(aClient *sptr, aChannel *chptr, char *comment)
|
||||||
|
{
|
||||||
|
if (MyClient(sptr) && IsNoColor(chptr) && IsUsingColor(comment))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Is any channel where the user is in +c? */
|
||||||
|
static int IsAnyChannelNoColor(aClient *sptr)
|
||||||
|
{
|
||||||
|
Membership *lp;
|
||||||
|
|
||||||
|
for (lp = sptr->user->channel; lp; lp = lp->next)
|
||||||
|
if (IsNoColor(lp->chptr))
|
||||||
|
return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
DLLFUNC char *nocolor_prelocalquit(aClient *sptr, char *comment)
|
||||||
|
{
|
||||||
|
if (MyClient(sptr) && !BadPtr(comment) && IsUsingColor(comment) && IsAnyChannelNoColor(sptr))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return comment;
|
||||||
|
}
|
||||||
@@ -0,0 +1,115 @@
|
|||||||
|
/*
|
||||||
|
* Block CTCP UnrealIRCd Module (Channel Mode +C)
|
||||||
|
* (C) Copyright 2000-.. Bram Matthys (Syzop) and the UnrealIRCd team
|
||||||
|
*
|
||||||
|
* 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 "proto.h"
|
||||||
|
#include "channel.h"
|
||||||
|
#include <time.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <io.h>
|
||||||
|
#endif
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include "h.h"
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include "version.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
DLLFUNC CMD_FUNC(noctcp);
|
||||||
|
|
||||||
|
ModuleHeader MOD_HEADER(noctcp)
|
||||||
|
= {
|
||||||
|
"chanmodes/noctcp",
|
||||||
|
"$Id$",
|
||||||
|
"Channel Mode +C",
|
||||||
|
"3.2-b8-1",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
Cmode_t EXTCMODE_NOCTCP;
|
||||||
|
|
||||||
|
#define IsNoCTCP(chptr) (chptr->mode.extmode & EXTCMODE_NOCTCP)
|
||||||
|
|
||||||
|
DLLFUNC char *noctcp_prechanmsg(aClient *sptr, aChannel *chptr, char *text, int notice);
|
||||||
|
|
||||||
|
DLLFUNC int MOD_TEST(noctcp)(ModuleInfo *modinfo)
|
||||||
|
{
|
||||||
|
return MOD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
DLLFUNC int MOD_INIT(noctcp)(ModuleInfo *modinfo)
|
||||||
|
{
|
||||||
|
CmodeInfo req;
|
||||||
|
|
||||||
|
memset(&req, 0, sizeof(req));
|
||||||
|
req.paracount = 0;
|
||||||
|
req.flag = 'C';
|
||||||
|
req.is_ok = extcmode_default_requirechop;
|
||||||
|
CmodeAdd(modinfo->handle, req, &EXTCMODE_NOCTCP);
|
||||||
|
|
||||||
|
HookAddPCharEx(modinfo->handle, HOOKTYPE_PRE_CHANMSG, noctcp_prechanmsg);
|
||||||
|
|
||||||
|
MARK_AS_OFFICIAL_MODULE(modinfo);
|
||||||
|
return MOD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
DLLFUNC int MOD_LOAD(noctcp)(int module_load)
|
||||||
|
{
|
||||||
|
return MOD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
DLLFUNC int MOD_UNLOAD(noctcp)(int module_unload)
|
||||||
|
{
|
||||||
|
return MOD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int IsACTCP(char *s)
|
||||||
|
{
|
||||||
|
if (!s)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if ((*s == '\001') && strncmp(&s[1], "ACTION ", 7))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
DLLFUNC char *noctcp_prechanmsg(aClient *sptr, aChannel *chptr, char *text, int notice)
|
||||||
|
{
|
||||||
|
if (MyClient(sptr) && IsNoCTCP(chptr) && IsACTCP(text))
|
||||||
|
{
|
||||||
|
if (!notice)
|
||||||
|
{
|
||||||
|
sendto_one(sptr, err_str(ERR_CANNOTSENDTOCHAN),
|
||||||
|
me.name, sptr->name, chptr->chname,
|
||||||
|
"CTCPs are not permitted in this channel", chptr->chname);
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return text;
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* UnrealIRCd, src/modules/chm_permanent.c
|
* UnrealIRCd, src/modules/chanmodes/permanent.c
|
||||||
* Copyright (c) 2013 William Pitcock <nenolod@dereferenced.org>
|
* Copyright (c) 2013 William Pitcock <nenolod@dereferenced.org>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -24,11 +24,10 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "sys.h"
|
#include "sys.h"
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#include "m_cap.h"
|
|
||||||
|
|
||||||
ModuleHeader MOD_HEADER(chm_permanent)
|
ModuleHeader MOD_HEADER(permanent)
|
||||||
= {
|
= {
|
||||||
"chm_permanent",
|
"chanmodes/permanent",
|
||||||
"$Id$",
|
"$Id$",
|
||||||
"Permanent channel mode (+P)",
|
"Permanent channel mode (+P)",
|
||||||
"3.2-b8-1",
|
"3.2-b8-1",
|
||||||
@@ -37,13 +36,13 @@ ModuleHeader MOD_HEADER(chm_permanent)
|
|||||||
|
|
||||||
static Cmode_t EXTMODE_PERMANENT = 0L;
|
static Cmode_t EXTMODE_PERMANENT = 0L;
|
||||||
|
|
||||||
static void chm_permanent_channel_destroy(aChannel *chptr, bool *should_destroy)
|
static void permanent_channel_destroy(aChannel *chptr, bool *should_destroy)
|
||||||
{
|
{
|
||||||
if (chptr->mode.extmode & EXTMODE_PERMANENT)
|
if (chptr->mode.extmode & EXTMODE_PERMANENT)
|
||||||
*should_destroy = false;
|
*should_destroy = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int chm_permanent_is_ok(aClient *cptr, aChannel *chptr, char *para, int checkt, int what)
|
static int permanent_is_ok(aClient *cptr, aChannel *chptr, char mode, char *para, int checkt, int what)
|
||||||
{
|
{
|
||||||
if (IsOper(cptr))
|
if (IsOper(cptr))
|
||||||
return EX_ALLOW;
|
return EX_ALLOW;
|
||||||
@@ -52,30 +51,31 @@ static int chm_permanent_is_ok(aClient *cptr, aChannel *chptr, char *para, int c
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* This is called on module init, before Server Ready */
|
/* This is called on module init, before Server Ready */
|
||||||
DLLFUNC int MOD_INIT(chm_permanent)(ModuleInfo *modinfo)
|
DLLFUNC int MOD_INIT(permanent)(ModuleInfo *modinfo)
|
||||||
{
|
{
|
||||||
CmodeInfo chm_permanent = { };
|
CmodeInfo req;
|
||||||
|
|
||||||
MARK_AS_OFFICIAL_MODULE(modinfo);
|
MARK_AS_OFFICIAL_MODULE(modinfo);
|
||||||
|
|
||||||
chm_permanent.paracount = 0;
|
memset(&req, 0, sizeof(req));
|
||||||
chm_permanent.flag = 'P';
|
req.paracount = 0;
|
||||||
chm_permanent.is_ok = chm_permanent_is_ok;
|
req.flag = 'P';
|
||||||
CmodeAdd(modinfo->handle, chm_permanent, &EXTMODE_PERMANENT);
|
req.is_ok = permanent_is_ok;
|
||||||
|
CmodeAdd(modinfo->handle, req, &EXTMODE_PERMANENT);
|
||||||
|
|
||||||
HookAddVoidEx(modinfo->handle, HOOKTYPE_CHANNEL_DESTROY, chm_permanent_channel_destroy);
|
HookAddVoidEx(modinfo->handle, HOOKTYPE_CHANNEL_DESTROY, permanent_channel_destroy);
|
||||||
|
|
||||||
return MOD_SUCCESS;
|
return MOD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Is first run when server is 100% ready */
|
/* Is first run when server is 100% ready */
|
||||||
DLLFUNC int MOD_LOAD(chm_permanent)(int module_load)
|
DLLFUNC int MOD_LOAD(permanent)(int module_load)
|
||||||
{
|
{
|
||||||
return MOD_SUCCESS;
|
return MOD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called when module is unloaded */
|
/* Called when module is unloaded */
|
||||||
DLLFUNC int MOD_UNLOAD(chm_permanent)(int module_unload)
|
DLLFUNC int MOD_UNLOAD(permanent)(int module_unload)
|
||||||
{
|
{
|
||||||
return MOD_SUCCESS;
|
return MOD_SUCCESS;
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,130 @@
|
|||||||
|
/*
|
||||||
|
* Strip Color UnrealIRCd Module (Channel Mode +S)
|
||||||
|
* (C) Copyright 2000-.. Bram Matthys (Syzop) and the UnrealIRCd team
|
||||||
|
*
|
||||||
|
* 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 "proto.h"
|
||||||
|
#include "channel.h"
|
||||||
|
#include <time.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <io.h>
|
||||||
|
#endif
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include "h.h"
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include "version.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
DLLFUNC CMD_FUNC(stripcolor);
|
||||||
|
|
||||||
|
ModuleHeader MOD_HEADER(stripcolor)
|
||||||
|
= {
|
||||||
|
"chanmodes/stripcolor",
|
||||||
|
"$Id$",
|
||||||
|
"Channel Mode +S",
|
||||||
|
"3.2-b8-1",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
Cmode_t EXTCMODE_STRIPCOLOR;
|
||||||
|
|
||||||
|
#define IsStripColor(chptr) (chptr->mode.extmode & EXTCMODE_STRIPCOLOR)
|
||||||
|
|
||||||
|
DLLFUNC char *stripcolor_prechanmsg(aClient *sptr, aChannel *chptr, char *text, int notice);
|
||||||
|
DLLFUNC char *stripcolor_prelocalpart(aClient *sptr, aChannel *chptr, char *comment);
|
||||||
|
DLLFUNC char *stripcolor_prelocalquit(aClient *sptr, char *comment);
|
||||||
|
|
||||||
|
DLLFUNC int MOD_TEST(stripcolor)(ModuleInfo *modinfo)
|
||||||
|
{
|
||||||
|
return MOD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
DLLFUNC int MOD_INIT(stripcolor)(ModuleInfo *modinfo)
|
||||||
|
{
|
||||||
|
CmodeInfo req;
|
||||||
|
|
||||||
|
/* Channel mode */
|
||||||
|
memset(&req, 0, sizeof(req));
|
||||||
|
req.paracount = 0;
|
||||||
|
req.flag = 'S';
|
||||||
|
req.is_ok = extcmode_default_requirechop;
|
||||||
|
CmodeAdd(modinfo->handle, req, &EXTCMODE_STRIPCOLOR);
|
||||||
|
|
||||||
|
HookAddPCharEx(modinfo->handle, HOOKTYPE_PRE_CHANMSG, stripcolor_prechanmsg);
|
||||||
|
HookAddPCharEx(modinfo->handle, HOOKTYPE_PRE_LOCAL_PART, stripcolor_prelocalpart);
|
||||||
|
HookAddPCharEx(modinfo->handle, HOOKTYPE_PRE_LOCAL_QUIT, stripcolor_prelocalquit);
|
||||||
|
|
||||||
|
MARK_AS_OFFICIAL_MODULE(modinfo);
|
||||||
|
return MOD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
DLLFUNC int MOD_LOAD(stripcolor)(int module_load)
|
||||||
|
{
|
||||||
|
return MOD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
DLLFUNC int MOD_UNLOAD(stripcolor)(int module_unload)
|
||||||
|
{
|
||||||
|
return MOD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
DLLFUNC char *stripcolor_prechanmsg(aClient *sptr, aChannel *chptr, char *text, int notice)
|
||||||
|
{
|
||||||
|
if (MyClient(sptr) && IsStripColor(chptr))
|
||||||
|
text = StripColors(text);
|
||||||
|
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
DLLFUNC char *stripcolor_prelocalpart(aClient *sptr, aChannel *chptr, char *comment)
|
||||||
|
{
|
||||||
|
if (MyClient(sptr) && IsStripColor(chptr))
|
||||||
|
comment = StripColors(comment);
|
||||||
|
|
||||||
|
return comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Is any channel where the user is in +S? */
|
||||||
|
static int IsAnyChannelStripColor(aClient *sptr)
|
||||||
|
{
|
||||||
|
Membership *lp;
|
||||||
|
|
||||||
|
for (lp = sptr->user->channel; lp; lp = lp->next)
|
||||||
|
if (IsStripColor(lp->chptr))
|
||||||
|
return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DLLFUNC char *stripcolor_prelocalquit(aClient *sptr, char *comment)
|
||||||
|
{
|
||||||
|
if (MyClient(sptr) && !BadPtr(comment) && IsAnyChannelStripColor(sptr))
|
||||||
|
comment = StripColors(comment);
|
||||||
|
|
||||||
|
return comment;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,608 +0,0 @@
|
|||||||
/*
|
|
||||||
* Unreal Internet Relay Chat Daemon - src/l_commands.c
|
|
||||||
* (C) 2000 Carsten Munk (Techie/Stskeeps) <stskeeps@tspre.org>
|
|
||||||
*
|
|
||||||
* Wrapper for making commands.so
|
|
||||||
*
|
|
||||||
* 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 <time.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#ifdef _WIN32
|
|
||||||
#include <io.h>
|
|
||||||
#endif
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include "h.h"
|
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
#include "badwords.h"
|
|
||||||
#endif
|
|
||||||
#include "version.h"
|
|
||||||
#ifndef STATIC_LINKING
|
|
||||||
#define DYNAMIC_LINKING
|
|
||||||
#else
|
|
||||||
#undef DYNAMIC_LINKING
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* l_commands.c/commands.so is a special case so we have to do this manually :p */
|
|
||||||
#ifdef DYNAMIC_LINKING
|
|
||||||
#include "modversion.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern ModuleHeader m_svsnoop_Header;
|
|
||||||
ModuleInfo *ModCmdsInfo;
|
|
||||||
/* Place includes here */
|
|
||||||
/* replace this with a common name of your module */
|
|
||||||
#ifdef DYNAMIC_LINKING
|
|
||||||
ModuleHeader Mod_Header
|
|
||||||
#else
|
|
||||||
ModuleHeader l_commands_Header
|
|
||||||
#endif
|
|
||||||
= {
|
|
||||||
"commands", /* Name of module */
|
|
||||||
"3.2.10", /* Version */
|
|
||||||
"Wrapper library for m_ commands", /* Short description of module */
|
|
||||||
"3.2-b8-1",
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The purpose of these ifdefs, are that we can "static" link the ircd if we
|
|
||||||
* want to
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern int m_join_Test(ModuleInfo *modinfo);
|
|
||||||
extern int m_mode_Test(ModuleInfo *modinfo), m_nick_Test(ModuleInfo *modinfo);
|
|
||||||
extern int m_tkl_Test(ModuleInfo *modinfo), m_list_Test(ModuleInfo *modinfo);
|
|
||||||
extern int m_message_Test(ModuleInfo *modinfo), m_server_Test(ModuleInfo *modinfo);
|
|
||||||
extern int m_nopost_Test(ModuleInfo *modinfo), m_issecure_Test(ModuleInfo *modinfo);
|
|
||||||
|
|
||||||
extern int m_sethost_Init(ModuleInfo *modinfo), m_setname_Init(ModuleInfo *modinfo), m_chghost_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_chgident_Init(ModuleInfo *modinfo), m_setident_Init(ModuleInfo *modinfo), m_sdesc_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_svsmode_Init(ModuleInfo *modinfo), m_swhois_Init(ModuleInfo *modinfo), m_svsmotd_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_svsnline_Init(ModuleInfo *modinfo), m_who_Init(ModuleInfo *modinfo), m_mkpasswd_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_away_Init(ModuleInfo *modinfo), m_svsnoop_Init(ModuleInfo *modinfo), m_svso_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_svsnick_Init(ModuleInfo *modinfo), m_adminchat_Init(ModuleInfo *modinfo), m_nachat_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_lag_Init(ModuleInfo *modinfo), m_rping_Init(ModuleInfo *modinfo), m_sendumode_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_tsctl_Init(ModuleInfo *modinfo), m_chgname_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_message_Init(ModuleInfo *modinfo), m_whois_Init(ModuleInfo *modinfo), m_quit_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_kill_Init(ModuleInfo *modinfo), m_pingpong_Init(ModuleInfo *modinfo), m_oper_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_akill_Init(ModuleInfo *modinfo), m_rakill_Init(ModuleInfo *modinfo), m_userip_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_unzline_Init(ModuleInfo *modinfo), m_unkline_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_sqline_Init(ModuleInfo *modinfo), m_unsqline_Init(ModuleInfo *modinfo), m_tkl_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_vhost_Init(ModuleInfo *modinfo), m_cycle_Init(ModuleInfo *modinfo), m_svsjoin_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_svspart_Init(ModuleInfo *modinfo), m_svslusers_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_svswatch_Init(ModuleInfo *modinfo), m_svssilence_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_sendsno_Init(ModuleInfo *modinfo), m_svssno_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_sajoin_Init(ModuleInfo *modinfo), m_sapart_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_kick_Init(ModuleInfo *modinfo), m_topic_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_invite_Init(ModuleInfo *modinfo), m_list_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_samode_Init(ModuleInfo *modinfo), m_time_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_svskill_Init(ModuleInfo *modinfo), m_sjoin_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_pass_Init(ModuleInfo *modinfo), m_userhost_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_ison_Init(ModuleInfo *modinfo), m_silence_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_knock_Init(ModuleInfo *modinfo), m_umode2_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_squit_Init(ModuleInfo *modinfo), m_protoctl_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_addmotd_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_addomotd_Init(ModuleInfo *modinfo), m_wallops_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_admin_Init(ModuleInfo *modinfo), m_globops_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_locops_Init(ModuleInfo *modinfo), m_chatops_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_trace_Init(ModuleInfo *modinfo), m_netinfo_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_links_Init(ModuleInfo *modinfo), m_help_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_rules_Init(ModuleInfo *modinfo), m_close_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_map_Init(ModuleInfo *modinfo), m_eos_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_server_Init(ModuleInfo *modinfo), m_stats_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_svsfline_Init(ModuleInfo *modinfo), m_undccdeny_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_dccdeny_Init(ModuleInfo *modinfo), m_whowas_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_connect_Init(ModuleInfo *modinfo), m_dccallow_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_nick_Init(ModuleInfo *modinfo), m_user_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_mode_Init(ModuleInfo *modinfo), m_watch_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_part_Init(ModuleInfo *modinfo), m_join_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_motd_Init(ModuleInfo *modinfo), m_opermotd_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_botmotd_Init(ModuleInfo *modinfo), m_lusers_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_names_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_svsnolag_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_starttls_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_nopost_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_issecure_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_cap_Init(ModuleInfo *modinfo);
|
|
||||||
extern int m_sasl_Init(ModuleInfo *modinfo);
|
|
||||||
#ifdef GUEST
|
|
||||||
extern int m_guest_Init(ModuleInfo *modinfo);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
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);
|
|
||||||
extern int m_svsmode_Load(int module_load), m_swhois_Load(int module_load), m_svsmotd_Load(int module_load);
|
|
||||||
extern int m_svsnline_Load(int module_load), m_who_Load(int module_load), m_mkpasswd_Load(int module_load);
|
|
||||||
extern int m_away_Load(int module_load), m_svsnoop_Load(int module_load), m_svso_Load(int module_load);
|
|
||||||
extern int m_svsnick_Load(int module_load), m_adminchat_Load(int module_load), m_nachat_Load(int module_load);
|
|
||||||
extern int m_lag_Load(int module_load), m_rping_Load(int module_load), m_sendumode_Load(int module_load);
|
|
||||||
extern int m_tsctl_Load(int module_load), m_chgname_Load(int module_load);
|
|
||||||
extern int m_message_Load(int module_load), m_whois_Load(int module_load), m_quit_Load(int module_load);
|
|
||||||
extern int m_kill_Load(int module_load), m_pingpong_Load(int module_load), m_oper_Load(int module_load);
|
|
||||||
extern int m_akill_Load(int module_load), m_rakill_Load(int module_load), m_userip_Load(int unused);
|
|
||||||
extern int m_unzline_Load(int module_load), m_unkline_Load(int module_load);
|
|
||||||
extern int m_sqline_Load(int module_load), m_unsqline_Load(int module_load), m_tkl_Load(int module_load);
|
|
||||||
extern int m_vhost_Load(int module_load), m_cycle_Load(int module_load), m_svsjoin_Load(int module_load);
|
|
||||||
extern int m_svspart_Load(int module_load), m_svslusers_Load(int module_load);
|
|
||||||
extern int m_svswatch_Load(int module_load), m_svssilence_Load(int module_load);
|
|
||||||
extern int m_sendsno_Load(int module_load), m_svssno_Load(int module_load);
|
|
||||||
extern int m_sajoin_Load(int module_load), m_sapart_Load(int module_load);
|
|
||||||
extern int m_kick_Load(int module_load), m_topic_Load(int module_load);
|
|
||||||
extern int m_invite_Load(int module_load), m_list_Load(int module_load);
|
|
||||||
extern int m_samode_Load(int module_load), m_time_Load(int module_load);
|
|
||||||
extern int m_svskill_Load(int module_load), m_sjoin_Load(int module_load);
|
|
||||||
extern int m_pass_Load(int module_load), m_userhost_Load(int module_load);
|
|
||||||
extern int m_ison_Load(int module_load), m_silence_Load(int module_load);
|
|
||||||
extern int m_knock_Load(int module_load), m_umode2_Load(int module_load);
|
|
||||||
extern int m_squit_Load(int module_load), m_protoctl_Load(int module_load);
|
|
||||||
extern int m_addmotd_Load(int module_load);
|
|
||||||
extern int m_addomotd_Load(int module_load), m_wallops_Load(int module_load);
|
|
||||||
extern int m_admin_Load(int module_load), m_globops_Load(int module_load);
|
|
||||||
extern int m_locops_Load(int module_load), m_chatops_Load(int module_load);
|
|
||||||
extern int m_trace_Load(int module_load), m_netinfo_Load(int module_load);
|
|
||||||
extern int m_links_Load(int module_load), m_help_Load(int module_load);
|
|
||||||
extern int m_rules_Load(int module_load), m_close_Load(int module_load);
|
|
||||||
extern int m_map_Load(int module_load), m_eos_Load(int module_load);
|
|
||||||
extern int m_server_Load(int module_load), m_stats_Load(int module_load);
|
|
||||||
extern int m_svsfline_Load(int module_load), m_undccdeny_Load(int module_load);
|
|
||||||
extern int m_dccdeny_Load(int module_load), m_whowas_Load(int module_load);
|
|
||||||
extern int m_connect_Load(int module_load), m_dccallow_Load(int module_load);
|
|
||||||
extern int m_nick_Load(int module_load), m_user_Load(int module_load);
|
|
||||||
extern int m_mode_Load(int module_load), m_watch_Load(int module_load);
|
|
||||||
extern int m_part_Load(int module_load), m_join_Load(int module_load);
|
|
||||||
extern int m_motd_Load(int module_load), m_opermotd_Load(int module_load);
|
|
||||||
extern int m_botmotd_Load(int module_load), m_lusers_Load(int module_load);
|
|
||||||
extern int m_names_Load(int module_load);
|
|
||||||
extern int m_svsnolag_Load(int module_load);
|
|
||||||
extern int m_starttls_Load(int module_load);
|
|
||||||
extern int m_nopost_Load(int module_load);
|
|
||||||
extern int m_issecure_Load(int module_load);
|
|
||||||
extern int m_cap_Load(int module_load);
|
|
||||||
extern int m_sasl_Load(int module_load);
|
|
||||||
#ifdef GUEST
|
|
||||||
extern int m_guest_Load(int module_load);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
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();
|
|
||||||
extern int m_svsmotd_Unload(), m_svsnline_Unload(), m_who_Unload(), m_mkpasswd_Unload();
|
|
||||||
extern int m_away_Unload(), m_svsnoop_Unload(), m_svso_Unload(), m_svsnick_Unload();
|
|
||||||
extern int m_adminchat_Unload(), m_nachat_Unload(), m_lag_Unload(), m_rping_Unload();
|
|
||||||
extern int m_sendumode_Unload(), m_tsctl_Unload(), m_chgname_Unload();
|
|
||||||
extern int m_message_Unload(), m_whois_Unload(), m_quit_Unload(), m_kill_Unload();
|
|
||||||
extern int m_pingpong_Unload(), m_oper_Unload(), m_akill_Unload(), m_rakill_Unload();
|
|
||||||
extern int m_unzline_Unload(), m_unkline_Unload(), m_userip_Unload();
|
|
||||||
extern int m_sqline_Unload(), m_unsqline_Unload(), m_tkl_Unload(), m_vhost_Unload();
|
|
||||||
extern int m_cycle_Unload(), m_svsjoin_Unload(), m_svspart_Unload(), m_svslusers_Unload();
|
|
||||||
extern int m_svswatch_Unload(), m_svssilence_Unload(), m_svskill_Unload();
|
|
||||||
extern int m_sendsno_Unload(), m_svssno_Unload(), m_time_Unload();
|
|
||||||
extern int m_sajoin_Unload(), m_sapart_Unload();
|
|
||||||
extern int m_kick_Unload(), m_topic_Unload(), m_umode2_Unload();
|
|
||||||
extern int m_invite_Unload(), m_list_Unload(), m_squit_Unload();
|
|
||||||
extern int m_samode_Unload(), m_sjoin_Unload(), m_protoctl_Unload();
|
|
||||||
extern int m_addmotd_Unload();
|
|
||||||
extern int m_addomotd_Unload();
|
|
||||||
extern int m_pass_Unload(), m_userhost_Unload(), m_knock_Unload();
|
|
||||||
extern int m_ison_Unload(), m_silence_Unload();
|
|
||||||
extern int m_wallops_Unload(), m_admin_Unload(), m_globops_Unload();
|
|
||||||
extern int m_locops_Unload(), m_chatops_Unload(), m_trace_Unload();
|
|
||||||
extern int m_netinfo_Unload(), m_links_Unload(), m_help_Unload();
|
|
||||||
extern int m_rules_Unload(), m_close_Unload(), m_map_Unload();
|
|
||||||
extern int m_eos_Unload(), m_server_Unload(), m_stats_Unload();
|
|
||||||
extern int m_svsfline_Unload(), m_dccdeny_Unload(), m_undccdeny_Unload();
|
|
||||||
extern int m_whowas_Unload(), m_connect_Unload(), m_dccallow_Unload();
|
|
||||||
extern int m_nick_Unload(), m_user_Unload(), m_mode_Unload();
|
|
||||||
extern int m_watch_Unload(), m_part_Unload(), m_join_Unload();
|
|
||||||
extern int m_motd_Unload(), m_opermotd_Unload(), m_botmotd_Unload();
|
|
||||||
extern int m_lusers_Unload(), m_names_Unload(), m_svsnolag_Unload();
|
|
||||||
extern int m_starttls_Unload();
|
|
||||||
extern int m_nopost_Unload();
|
|
||||||
extern int m_issecure_Unload();
|
|
||||||
extern int m_cap_Unload();
|
|
||||||
extern int m_sasl_Unload();
|
|
||||||
#ifdef GUEST
|
|
||||||
extern int m_guest_Unload();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef DYNAMIC_LINKING
|
|
||||||
DLLFUNC int Mod_Test(ModuleInfo *modinfo)
|
|
||||||
#else
|
|
||||||
int l_commands_Test(ModuleInfo *modinfo)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
#ifdef SCAN_API
|
|
||||||
Module p;
|
|
||||||
#endif
|
|
||||||
MARK_AS_OFFICIAL_MODULE(modinfo);
|
|
||||||
ModCmdsInfo = modinfo;
|
|
||||||
m_join_Test(ModCmdsInfo);
|
|
||||||
m_mode_Test(ModCmdsInfo);
|
|
||||||
m_nick_Test(ModCmdsInfo);
|
|
||||||
m_tkl_Test(ModCmdsInfo);
|
|
||||||
m_list_Test(ModCmdsInfo);
|
|
||||||
m_message_Test(ModCmdsInfo);
|
|
||||||
m_server_Test(ModCmdsInfo);
|
|
||||||
m_nopost_Test(ModCmdsInfo);
|
|
||||||
return MOD_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef DYNAMIC_LINKING
|
|
||||||
DLLFUNC int Mod_Init(ModuleInfo *modinfo)
|
|
||||||
#else
|
|
||||||
int l_commands_Init(ModuleInfo *modinfo)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
int module_load;
|
|
||||||
#ifdef SCAN_API
|
|
||||||
Module p;
|
|
||||||
#endif
|
|
||||||
/*
|
|
||||||
* We call our add_Command crap here
|
|
||||||
*/
|
|
||||||
module_load = ModCmdsInfo->module_load;
|
|
||||||
m_sethost_Init(ModCmdsInfo);
|
|
||||||
m_setname_Init(ModCmdsInfo);
|
|
||||||
m_chghost_Init(ModCmdsInfo);
|
|
||||||
m_chgident_Init(ModCmdsInfo);
|
|
||||||
m_setident_Init(ModCmdsInfo);
|
|
||||||
m_sdesc_Init(ModCmdsInfo);
|
|
||||||
m_svsmode_Init(ModCmdsInfo);
|
|
||||||
m_swhois_Init(ModCmdsInfo);
|
|
||||||
m_svsmotd_Init(ModCmdsInfo);
|
|
||||||
m_svsnline_Init(ModCmdsInfo);
|
|
||||||
m_who_Init(ModCmdsInfo);
|
|
||||||
m_mkpasswd_Init(ModCmdsInfo);
|
|
||||||
m_away_Init(ModCmdsInfo);
|
|
||||||
m_svsnoop_Init(ModCmdsInfo);
|
|
||||||
m_svso_Init(ModCmdsInfo);
|
|
||||||
m_svsnick_Init(ModCmdsInfo);
|
|
||||||
m_adminchat_Init(ModCmdsInfo);
|
|
||||||
m_nachat_Init(ModCmdsInfo);
|
|
||||||
m_lag_Init(ModCmdsInfo);
|
|
||||||
m_rping_Init(ModCmdsInfo);
|
|
||||||
m_sendumode_Init(ModCmdsInfo);
|
|
||||||
m_tsctl_Init(ModCmdsInfo);
|
|
||||||
m_chgname_Init(ModCmdsInfo);
|
|
||||||
m_message_Init(ModCmdsInfo);
|
|
||||||
m_whois_Init(ModCmdsInfo);
|
|
||||||
m_quit_Init(ModCmdsInfo);
|
|
||||||
m_kill_Init(ModCmdsInfo);
|
|
||||||
m_pingpong_Init(ModCmdsInfo);
|
|
||||||
m_oper_Init(ModCmdsInfo);
|
|
||||||
m_akill_Init(ModCmdsInfo);
|
|
||||||
m_rakill_Init(ModCmdsInfo);
|
|
||||||
m_unzline_Init(ModCmdsInfo);
|
|
||||||
m_unkline_Init(ModCmdsInfo);
|
|
||||||
m_sqline_Init(ModCmdsInfo);
|
|
||||||
m_unsqline_Init(ModCmdsInfo);
|
|
||||||
m_tkl_Init(ModCmdsInfo);
|
|
||||||
m_vhost_Init(ModCmdsInfo);
|
|
||||||
m_cycle_Init(ModCmdsInfo);
|
|
||||||
m_svsjoin_Init(ModCmdsInfo);
|
|
||||||
m_svspart_Init(ModCmdsInfo);
|
|
||||||
m_svswatch_Init(ModCmdsInfo);
|
|
||||||
m_svssilence_Init(ModCmdsInfo);
|
|
||||||
m_svslusers_Init(ModCmdsInfo);
|
|
||||||
m_sendsno_Init(ModCmdsInfo);
|
|
||||||
m_svssno_Init(ModCmdsInfo);
|
|
||||||
m_sajoin_Init(ModCmdsInfo);
|
|
||||||
m_sapart_Init(ModCmdsInfo);
|
|
||||||
m_samode_Init(ModCmdsInfo);
|
|
||||||
m_kick_Init(ModCmdsInfo);
|
|
||||||
m_topic_Init(ModCmdsInfo);
|
|
||||||
m_invite_Init(ModCmdsInfo);
|
|
||||||
m_list_Init(ModCmdsInfo);
|
|
||||||
m_time_Init(ModCmdsInfo);
|
|
||||||
m_sjoin_Init(ModCmdsInfo);
|
|
||||||
m_pass_Init(ModCmdsInfo);
|
|
||||||
m_userhost_Init(ModCmdsInfo);
|
|
||||||
m_ison_Init(ModCmdsInfo);
|
|
||||||
m_silence_Init(ModCmdsInfo);
|
|
||||||
m_svskill_Init(ModCmdsInfo);
|
|
||||||
m_knock_Init(ModCmdsInfo);
|
|
||||||
m_umode2_Init(ModCmdsInfo);
|
|
||||||
m_squit_Init(ModCmdsInfo);
|
|
||||||
m_protoctl_Init(ModCmdsInfo);
|
|
||||||
m_addmotd_Init(ModCmdsInfo);
|
|
||||||
m_addomotd_Init(ModCmdsInfo);
|
|
||||||
m_wallops_Init(ModCmdsInfo);
|
|
||||||
m_admin_Init(ModCmdsInfo);
|
|
||||||
m_globops_Init(ModCmdsInfo);
|
|
||||||
m_locops_Init(ModCmdsInfo);
|
|
||||||
m_chatops_Init(ModCmdsInfo);
|
|
||||||
m_trace_Init(ModCmdsInfo);
|
|
||||||
m_netinfo_Init(ModCmdsInfo);
|
|
||||||
m_links_Init(ModCmdsInfo);
|
|
||||||
m_help_Init(ModCmdsInfo);
|
|
||||||
m_rules_Init(ModCmdsInfo);
|
|
||||||
m_close_Init(ModCmdsInfo);
|
|
||||||
m_map_Init(ModCmdsInfo);
|
|
||||||
m_eos_Init(ModCmdsInfo);
|
|
||||||
m_server_Init(ModCmdsInfo);
|
|
||||||
m_stats_Init(ModCmdsInfo);
|
|
||||||
m_svsfline_Init(ModCmdsInfo);
|
|
||||||
m_dccdeny_Init(ModCmdsInfo);
|
|
||||||
m_undccdeny_Init(ModCmdsInfo);
|
|
||||||
m_whowas_Init(ModCmdsInfo);
|
|
||||||
m_connect_Init(ModCmdsInfo);
|
|
||||||
m_dccallow_Init(ModCmdsInfo);
|
|
||||||
m_userip_Init(ModCmdsInfo);
|
|
||||||
m_nick_Init(ModCmdsInfo);
|
|
||||||
m_user_Init(ModCmdsInfo);
|
|
||||||
m_mode_Init(ModCmdsInfo);
|
|
||||||
m_watch_Init(ModCmdsInfo);
|
|
||||||
m_part_Init(ModCmdsInfo);
|
|
||||||
m_join_Init(ModCmdsInfo);
|
|
||||||
m_motd_Init(ModCmdsInfo);
|
|
||||||
m_opermotd_Init(ModCmdsInfo);
|
|
||||||
m_botmotd_Init(ModCmdsInfo);
|
|
||||||
m_lusers_Init(ModCmdsInfo);
|
|
||||||
m_names_Init(ModCmdsInfo);
|
|
||||||
m_svsnolag_Init(ModCmdsInfo);
|
|
||||||
m_starttls_Init(ModCmdsInfo);
|
|
||||||
m_nopost_Init(ModCmdsInfo);
|
|
||||||
m_issecure_Init(ModCmdsInfo);
|
|
||||||
m_cap_Init(ModCmdsInfo);
|
|
||||||
m_sasl_Init(ModCmdsInfo);
|
|
||||||
#ifdef GUEST
|
|
||||||
m_guest_Init(ModCmdsInfo);
|
|
||||||
#endif
|
|
||||||
MARK_AS_OFFICIAL_MODULE(modinfo);
|
|
||||||
return MOD_SUCCESS;
|
|
||||||
}
|
|
||||||
#ifdef DYNAMIC_LINKING
|
|
||||||
DLLFUNC int Mod_Load(int module_load)
|
|
||||||
#else
|
|
||||||
int l_commands_Load(int module_load)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
m_sethost_Load(module_load);
|
|
||||||
m_setname_Load(module_load);
|
|
||||||
m_chghost_Load(module_load);
|
|
||||||
m_chgident_Load(module_load);
|
|
||||||
m_setident_Load(module_load);
|
|
||||||
m_sdesc_Load(module_load);
|
|
||||||
m_svsmode_Load(module_load);
|
|
||||||
m_swhois_Load(module_load);
|
|
||||||
m_svsmotd_Load(module_load);
|
|
||||||
m_svsnline_Load(module_load);
|
|
||||||
m_who_Load(module_load);
|
|
||||||
m_mkpasswd_Load(module_load);
|
|
||||||
m_away_Load(module_load);
|
|
||||||
m_svsnoop_Load(module_load);
|
|
||||||
m_svso_Load(module_load);
|
|
||||||
m_svsnick_Load(module_load);
|
|
||||||
m_adminchat_Load(module_load);
|
|
||||||
m_nachat_Load(module_load);
|
|
||||||
m_lag_Load(module_load);
|
|
||||||
m_rping_Load(module_load);
|
|
||||||
m_sendumode_Load(module_load);
|
|
||||||
m_tsctl_Load(module_load);
|
|
||||||
m_chgname_Load(module_load);
|
|
||||||
m_message_Load(module_load);
|
|
||||||
m_whois_Load(module_load);
|
|
||||||
m_quit_Load(module_load);
|
|
||||||
m_kill_Load(module_load);
|
|
||||||
m_pingpong_Load(module_load);
|
|
||||||
m_oper_Load(module_load);
|
|
||||||
m_akill_Load(module_load);
|
|
||||||
m_rakill_Load(module_load);
|
|
||||||
m_unzline_Load(module_load);
|
|
||||||
m_unkline_Load(module_load);
|
|
||||||
m_tkl_Load(module_load);
|
|
||||||
m_sqline_Load(module_load);
|
|
||||||
m_unsqline_Load(module_load);
|
|
||||||
m_vhost_Load(module_load);
|
|
||||||
m_cycle_Load(module_load);
|
|
||||||
m_svsjoin_Load(module_load);
|
|
||||||
m_svspart_Load(module_load);
|
|
||||||
m_svswatch_Load(module_load);
|
|
||||||
m_svssilence_Load(module_load);
|
|
||||||
m_svslusers_Load(module_load);
|
|
||||||
m_sendsno_Load(module_load);
|
|
||||||
m_svssno_Load(module_load);
|
|
||||||
m_sajoin_Load(module_load);
|
|
||||||
m_sapart_Load(module_load);
|
|
||||||
m_samode_Load(module_load);
|
|
||||||
m_kick_Load(module_load);
|
|
||||||
m_topic_Load(module_load);
|
|
||||||
m_invite_Load(module_load);
|
|
||||||
m_list_Load(module_load);
|
|
||||||
m_time_Load(module_load);
|
|
||||||
m_svskill_Load(module_load);
|
|
||||||
m_sjoin_Load(module_load);
|
|
||||||
m_pass_Load(module_load);
|
|
||||||
m_userhost_Load(module_load);
|
|
||||||
m_ison_Load(module_load);
|
|
||||||
m_silence_Load(module_load);
|
|
||||||
m_knock_Load(module_load);
|
|
||||||
m_umode2_Load(module_load);
|
|
||||||
m_squit_Load(module_load);
|
|
||||||
m_protoctl_Load(module_load);
|
|
||||||
m_addmotd_Load(module_load);
|
|
||||||
m_addomotd_Load(module_load);
|
|
||||||
m_wallops_Load(module_load);
|
|
||||||
m_admin_Load(module_load);
|
|
||||||
m_globops_Load(module_load);
|
|
||||||
m_locops_Load(module_load);
|
|
||||||
m_chatops_Load(module_load);
|
|
||||||
m_trace_Load(module_load);
|
|
||||||
m_netinfo_Load(module_load);
|
|
||||||
m_links_Load(module_load);
|
|
||||||
m_help_Load(module_load);
|
|
||||||
m_rules_Load(module_load);
|
|
||||||
m_close_Load(module_load);
|
|
||||||
m_map_Load(module_load);
|
|
||||||
m_eos_Load(module_load);
|
|
||||||
m_server_Load(module_load);
|
|
||||||
m_stats_Load(module_load);
|
|
||||||
m_svsfline_Load(module_load);
|
|
||||||
m_dccdeny_Load(module_load);
|
|
||||||
m_undccdeny_Load(module_load);
|
|
||||||
m_whowas_Load(module_load);
|
|
||||||
m_connect_Load(module_load);
|
|
||||||
m_dccallow_Load(module_load);
|
|
||||||
m_userip_Load(module_load);
|
|
||||||
m_nick_Load(module_load);
|
|
||||||
m_user_Load(module_load);
|
|
||||||
m_mode_Load(module_load);
|
|
||||||
m_watch_Load(module_load);
|
|
||||||
m_part_Load(module_load);
|
|
||||||
m_join_Load(module_load);
|
|
||||||
m_motd_Load(module_load);
|
|
||||||
m_opermotd_Load(module_load);
|
|
||||||
m_botmotd_Load(module_load);
|
|
||||||
m_lusers_Load(module_load);
|
|
||||||
m_names_Load(module_load);
|
|
||||||
m_svsnolag_Load(module_load);
|
|
||||||
m_starttls_Load(module_load);
|
|
||||||
m_nopost_Load(module_load);
|
|
||||||
m_issecure_Load(module_load);
|
|
||||||
m_cap_Load(module_load);
|
|
||||||
m_sasl_Load(module_load);
|
|
||||||
#ifdef GUEST
|
|
||||||
m_guest_Load(module_load);
|
|
||||||
#endif
|
|
||||||
return MOD_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef DYNAMIC_LINKING
|
|
||||||
DLLFUNC int Mod_Unload(int module_unload)
|
|
||||||
#else
|
|
||||||
int l_commands_Unload(int module_unload)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
m_sethost_Unload();
|
|
||||||
m_setname_Unload();
|
|
||||||
m_chghost_Unload();
|
|
||||||
m_chgident_Unload();
|
|
||||||
m_setident_Unload();
|
|
||||||
m_sdesc_Unload();
|
|
||||||
m_svsmode_Unload();
|
|
||||||
m_swhois_Unload();
|
|
||||||
m_svsmotd_Unload();
|
|
||||||
m_svsnline_Unload();
|
|
||||||
m_who_Unload();
|
|
||||||
m_mkpasswd_Unload();
|
|
||||||
m_away_Unload();
|
|
||||||
m_svsnoop_Unload();
|
|
||||||
m_svso_Unload();
|
|
||||||
m_svsnick_Unload();
|
|
||||||
m_adminchat_Unload();
|
|
||||||
m_nachat_Unload();
|
|
||||||
m_lag_Unload();
|
|
||||||
m_rping_Unload();
|
|
||||||
m_sendumode_Unload();
|
|
||||||
m_tsctl_Unload();
|
|
||||||
m_chgname_Unload();
|
|
||||||
m_message_Unload();
|
|
||||||
m_whois_Unload();
|
|
||||||
m_quit_Unload();
|
|
||||||
m_kill_Unload();
|
|
||||||
m_pingpong_Unload();
|
|
||||||
m_oper_Unload();
|
|
||||||
m_akill_Unload();
|
|
||||||
m_rakill_Unload();
|
|
||||||
m_unzline_Unload();
|
|
||||||
m_unkline_Unload();
|
|
||||||
m_tkl_Unload();
|
|
||||||
m_sqline_Unload();
|
|
||||||
m_unsqline_Unload();
|
|
||||||
m_vhost_Unload();
|
|
||||||
m_cycle_Unload();
|
|
||||||
m_svsjoin_Unload();
|
|
||||||
m_svspart_Unload();
|
|
||||||
m_svswatch_Unload();
|
|
||||||
m_svssilence_Unload();
|
|
||||||
m_svslusers_Unload();
|
|
||||||
m_sendsno_Unload();
|
|
||||||
m_svssno_Unload();
|
|
||||||
m_sajoin_Unload();
|
|
||||||
m_sapart_Unload();
|
|
||||||
m_samode_Unload();
|
|
||||||
m_kick_Unload();
|
|
||||||
m_topic_Unload();
|
|
||||||
m_invite_Unload();
|
|
||||||
m_list_Unload();
|
|
||||||
m_time_Unload();
|
|
||||||
m_svskill_Unload();
|
|
||||||
m_sjoin_Unload();
|
|
||||||
m_pass_Unload();
|
|
||||||
m_userhost_Unload();
|
|
||||||
m_ison_Unload();
|
|
||||||
m_silence_Unload();
|
|
||||||
m_knock_Unload();
|
|
||||||
m_umode2_Unload();
|
|
||||||
m_squit_Unload();
|
|
||||||
m_protoctl_Unload();
|
|
||||||
m_addmotd_Unload();
|
|
||||||
m_addomotd_Unload();
|
|
||||||
m_wallops_Unload();
|
|
||||||
m_admin_Unload();
|
|
||||||
m_globops_Unload();
|
|
||||||
m_locops_Unload();
|
|
||||||
m_chatops_Unload();
|
|
||||||
m_trace_Unload();
|
|
||||||
m_netinfo_Unload();
|
|
||||||
m_links_Unload();
|
|
||||||
m_help_Unload();
|
|
||||||
m_rules_Unload();
|
|
||||||
m_close_Unload();
|
|
||||||
m_map_Unload();
|
|
||||||
m_eos_Unload();
|
|
||||||
m_server_Unload();
|
|
||||||
m_stats_Unload();
|
|
||||||
m_svsfline_Unload();
|
|
||||||
m_dccdeny_Unload();
|
|
||||||
m_undccdeny_Unload();
|
|
||||||
m_whowas_Unload();
|
|
||||||
m_connect_Unload();
|
|
||||||
m_dccallow_Unload();
|
|
||||||
m_userip_Unload();
|
|
||||||
m_nick_Unload();
|
|
||||||
m_user_Unload();
|
|
||||||
m_mode_Unload();
|
|
||||||
m_watch_Unload();
|
|
||||||
m_part_Unload();
|
|
||||||
m_join_Unload();
|
|
||||||
m_motd_Unload();
|
|
||||||
m_opermotd_Unload();
|
|
||||||
m_botmotd_Unload();
|
|
||||||
m_lusers_Unload();
|
|
||||||
m_names_Unload();
|
|
||||||
m_svsnolag_Unload();
|
|
||||||
m_starttls_Unload();
|
|
||||||
m_nopost_Unload();
|
|
||||||
m_issecure_Unload();
|
|
||||||
m_cap_Unload();
|
|
||||||
m_sasl_Unload();
|
|
||||||
#ifdef GUEST
|
|
||||||
m_guest_Unload();
|
|
||||||
#endif
|
|
||||||
return MOD_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -37,9 +37,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
#include "badwords.h"
|
|
||||||
#endif
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -37,9 +37,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
#include "badwords.h"
|
|
||||||
#endif
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -37,9 +37,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
#include "badwords.h"
|
|
||||||
#endif
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -37,9 +37,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
#include "badwords.h"
|
|
||||||
#endif
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -36,9 +36,6 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#include "proto.h"
|
#include "proto.h"
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
#include "badwords.h"
|
|
||||||
#endif
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -39,9 +39,6 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#include "proto.h"
|
#include "proto.h"
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
#include "badwords.h"
|
|
||||||
#endif
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -37,9 +37,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
#include "badwords.h"
|
|
||||||
#endif
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+32
-29
@@ -38,9 +38,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
#include "badwords.h"
|
|
||||||
#endif
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -61,37 +58,40 @@ ModuleHeader MOD_HEADER(m_cap)
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
static ClientCapability cap_account_notify = {
|
|
||||||
.name = "account-notify",
|
|
||||||
.cap = PROTO_ACCOUNT_NOTIFY,
|
|
||||||
};
|
|
||||||
|
|
||||||
static ClientCapability cap_away_notify = {
|
|
||||||
.name = "away-notify",
|
|
||||||
.cap = PROTO_AWAY_NOTIFY,
|
|
||||||
};
|
|
||||||
|
|
||||||
static ClientCapability cap_multi_prefix = {
|
|
||||||
.name = "multi-prefix",
|
|
||||||
.cap = PROTO_NAMESX,
|
|
||||||
};
|
|
||||||
|
|
||||||
static ClientCapability cap_uhnames = {
|
|
||||||
.name = "userhost-in-names",
|
|
||||||
.cap = PROTO_UHNAMES,
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct list_head *clicap_build_list(void)
|
static struct list_head *clicap_build_list(void)
|
||||||
{
|
{
|
||||||
static struct list_head clicap_list;
|
static struct list_head clicap_list;
|
||||||
|
ClientCapability *cap;
|
||||||
|
|
||||||
INIT_LIST_HEAD(&clicap_list);
|
INIT_LIST_HEAD(&clicap_list);
|
||||||
|
|
||||||
/* add builtins */
|
/* ADD BUILTINS */
|
||||||
clicap_append(&clicap_list, &cap_account_notify);
|
|
||||||
clicap_append(&clicap_list, &cap_away_notify);
|
cap = MyMallocEx(sizeof(ClientCapability));
|
||||||
clicap_append(&clicap_list, &cap_multi_prefix);
|
cap->name = strdup("account-notify");
|
||||||
clicap_append(&clicap_list, &cap_uhnames);
|
cap->cap = PROTO_ACCOUNT_NOTIFY;
|
||||||
|
clicap_append(&clicap_list, cap);
|
||||||
|
|
||||||
|
cap = MyMallocEx(sizeof(ClientCapability));
|
||||||
|
cap->name = strdup("away-notify");
|
||||||
|
cap->cap = PROTO_AWAY_NOTIFY;
|
||||||
|
clicap_append(&clicap_list, cap);
|
||||||
|
|
||||||
|
cap = MyMallocEx(sizeof(ClientCapability));
|
||||||
|
cap->name = strdup("multi-prefix");
|
||||||
|
cap->cap = PROTO_NAMESX;
|
||||||
|
clicap_append(&clicap_list, cap);
|
||||||
|
|
||||||
|
cap = MyMallocEx(sizeof(ClientCapability));
|
||||||
|
cap->name = strdup("userhost-in-names");
|
||||||
|
cap->cap = PROTO_UHNAMES;
|
||||||
|
clicap_append(&clicap_list, cap);
|
||||||
|
|
||||||
|
cap = MyMallocEx(sizeof(ClientCapability));
|
||||||
|
cap->name = strdup("account-notify");
|
||||||
|
cap->cap = PROTO_ACCOUNT_NOTIFY;
|
||||||
|
clicap_append(&clicap_list, cap);
|
||||||
|
|
||||||
RunHook(HOOKTYPE_CAPLIST, &clicap_list);
|
RunHook(HOOKTYPE_CAPLIST, &clicap_list);
|
||||||
|
|
||||||
@@ -140,7 +140,10 @@ static ClientCapability *clicap_find(const char *data, int *negate, int *finishe
|
|||||||
if((s = strchr(p, ' ')))
|
if((s = strchr(p, ' ')))
|
||||||
*s++ = '\0';
|
*s++ = '\0';
|
||||||
|
|
||||||
list_for_each_entry(cap, clicap_list, caplist_node)
|
if (!stricmp(p, "sasl") && (!SASL_SERVER || !find_server(SASL_SERVER, NULL)))
|
||||||
|
return NULL; /* hack: if SASL is disabled or server not online, then pretend it does not exist. -- Syzop */
|
||||||
|
|
||||||
|
list_for_each_entry2(cap, ClientCapability, clicap_list, caplist_node)
|
||||||
{
|
{
|
||||||
if (!stricmp(cap->name, p))
|
if (!stricmp(cap->name, p))
|
||||||
{
|
{
|
||||||
@@ -178,7 +181,7 @@ static void clicap_generate(aClient *sptr, const char *subcmd, int flags, int cl
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
list_for_each_entry(cap, clicap_list, caplist_node)
|
list_for_each_entry2(cap, ClientCapability, clicap_list, caplist_node)
|
||||||
{
|
{
|
||||||
if (flags)
|
if (flags)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -37,9 +37,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
#include "badwords.h"
|
|
||||||
#endif
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -44,9 +44,6 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#include "proto.h"
|
#include "proto.h"
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
#include "badwords.h"
|
|
||||||
#endif
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -168,7 +165,7 @@ DLLFUNC int m_chghost(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case UHALLOW_REJOIN:
|
case UHALLOW_REJOIN:
|
||||||
rejoin_doquits(acptr);
|
rejoin_leave(acptr);
|
||||||
/* join sent later when the host has been changed */
|
/* join sent later when the host has been changed */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -197,7 +194,7 @@ DLLFUNC int m_chghost(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
|||||||
}
|
}
|
||||||
acptr->user->virthost = strdup(parv[2]);
|
acptr->user->virthost = strdup(parv[2]);
|
||||||
if (UHOST_ALLOWED == UHALLOW_REJOIN)
|
if (UHOST_ALLOWED == UHALLOW_REJOIN)
|
||||||
rejoin_dojoinandmode(acptr);
|
rejoin_joinandmode(acptr);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -44,9 +44,6 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#include "proto.h"
|
#include "proto.h"
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
#include "badwords.h"
|
|
||||||
#endif
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -176,7 +173,7 @@ int legalident = 1;
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case UHALLOW_REJOIN:
|
case UHALLOW_REJOIN:
|
||||||
rejoin_doquits(acptr);
|
rejoin_leave(acptr);
|
||||||
/* join sent later when the ident has been changed */
|
/* join sent later when the ident has been changed */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -199,7 +196,7 @@ int legalident = 1;
|
|||||||
sptr->name, acptr->name, parv[2]);
|
sptr->name, acptr->name, parv[2]);
|
||||||
ircsnprintf(acptr->user->username, sizeof(acptr->user->username), "%s", parv[2]);
|
ircsnprintf(acptr->user->username, sizeof(acptr->user->username), "%s", parv[2]);
|
||||||
if (UHOST_ALLOWED == UHALLOW_REJOIN)
|
if (UHOST_ALLOWED == UHALLOW_REJOIN)
|
||||||
rejoin_dojoinandmode(acptr);
|
rejoin_joinandmode(acptr);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -41,9 +41,6 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#include "proto.h"
|
#include "proto.h"
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
#include "badwords.h"
|
|
||||||
#endif
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -26,9 +26,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
#include "badwords.h"
|
|
||||||
#endif
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -37,9 +37,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
#include "badwords.h"
|
|
||||||
#endif
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -37,9 +37,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
#include "badwords.h"
|
|
||||||
#endif
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -36,9 +36,6 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#include "proto.h"
|
#include "proto.h"
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
#include "badwords.h"
|
|
||||||
#endif
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -37,9 +37,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
#include "badwords.h"
|
|
||||||
#endif
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -37,9 +37,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
#include "badwords.h"
|
|
||||||
#endif
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -20,9 +20,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
#include "badwords.h"
|
|
||||||
#endif
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -37,9 +37,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
#include "badwords.h"
|
|
||||||
#endif
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -37,9 +37,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
#include "badwords.h"
|
|
||||||
#endif
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -36,9 +36,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
#include "badwords.h"
|
|
||||||
#endif
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -37,9 +37,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
#include "badwords.h"
|
|
||||||
#endif
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -37,9 +37,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
#include "badwords.h"
|
|
||||||
#endif
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -37,9 +37,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
#include "badwords.h"
|
|
||||||
#endif
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+38
-161
@@ -37,9 +37,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
#include "badwords.h"
|
|
||||||
#endif
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -48,12 +45,8 @@
|
|||||||
DLLFUNC CMD_FUNC(m_join);
|
DLLFUNC CMD_FUNC(m_join);
|
||||||
DLLFUNC void _join_channel(aChannel *chptr, aClient *cptr, aClient *sptr, int flags);
|
DLLFUNC void _join_channel(aChannel *chptr, aClient *cptr, aClient *sptr, int flags);
|
||||||
DLLFUNC CMD_FUNC(_do_join);
|
DLLFUNC CMD_FUNC(_do_join);
|
||||||
DLLFUNC int _can_join(aClient *cptr, aClient *sptr, aChannel *chptr, char *key, char *link, char *parv[]);
|
DLLFUNC int _can_join(aClient *cptr, aClient *sptr, aChannel *chptr, char *key, char *parv[]);
|
||||||
#define MAXBOUNCE 5 /** Most sensible */
|
#define MAXBOUNCE 5 /** Most sensible */
|
||||||
#ifdef JOINTHROTTLE
|
|
||||||
static int isjthrottled(aClient *cptr, aChannel *chptr);
|
|
||||||
static void cmodej_increase_usercounter(aClient *cptr, aChannel *chptr);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Externs */
|
/* Externs */
|
||||||
extern MODVAR int spamf_ugly_vchanoverride;
|
extern MODVAR int spamf_ugly_vchanoverride;
|
||||||
@@ -99,17 +92,26 @@ DLLFUNC int MOD_UNLOAD(m_join)(int module_unload)
|
|||||||
return MOD_SUCCESS;
|
return MOD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now let _invited_ people join thru bans, +i and +l.
|
/* This function checks if a locally connected user may join the channel.
|
||||||
* Checking if an invite exist could be done only if a block exists,
|
* It also provides an number of hooks where modules can plug in to.
|
||||||
* but I'm not too fancy of the complicated structure that'd cause,
|
* Note that the order of checking has been carefully thought of
|
||||||
* when optimization will hopefully take care of it. Most of the time
|
* (eg: bans at the end), so don't change it unless you have a good reason
|
||||||
* a user won't have invites on him anyway. -Donwulff
|
* to do so -- Syzop.
|
||||||
*/
|
*/
|
||||||
|
DLLFUNC int _can_join(aClient *cptr, aClient *sptr, aChannel *chptr, char *key, char *parv[])
|
||||||
DLLFUNC int _can_join(aClient *cptr, aClient *sptr, aChannel *chptr, char *key, char *link, char *parv[])
|
|
||||||
{
|
{
|
||||||
Link *lp;
|
Link *lp;
|
||||||
Ban *banned;
|
Ban *banned;
|
||||||
|
Hook *h;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (h = Hooks[HOOKTYPE_CAN_JOIN]; h; h = h->next)
|
||||||
|
{
|
||||||
|
i = (*(h->func.intfunc))(sptr,chptr,key,parv);
|
||||||
|
if (i != 0)
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if ((chptr->mode.mode & MODE_ONLYSECURE) && !(sptr->umodes & UMODE_SECURE))
|
if ((chptr->mode.mode & MODE_ONLYSECURE) && !(sptr->umodes & UMODE_SECURE))
|
||||||
{
|
{
|
||||||
@@ -147,24 +149,18 @@ Ban *banned;
|
|||||||
if (lp->value.chptr == chptr)
|
if (lp->value.chptr == chptr)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if ((chptr->mode.limit && chptr->users >= chptr->mode.limit))
|
if (chptr->users >= chptr->mode.limit)
|
||||||
{
|
{
|
||||||
if (chptr->mode.link)
|
/* Hmmm.. don't really like this.. and not at this place */
|
||||||
|
|
||||||
|
for (h = Hooks[HOOKTYPE_CAN_JOIN_LIMITEXCEEDED]; h; h = h->next)
|
||||||
{
|
{
|
||||||
if (*chptr->mode.link != '\0')
|
i = (*(h->func.intfunc))(sptr,chptr,key,parv);
|
||||||
{
|
if (i != 0)
|
||||||
/* We are linked. */
|
return i;
|
||||||
sendto_one(sptr,
|
|
||||||
err_str(ERR_LINKCHANNEL), me.name,
|
|
||||||
sptr->name, chptr->chname,
|
|
||||||
chptr->mode.link);
|
|
||||||
parv[0] = sptr->name;
|
|
||||||
parv[1] = (chptr->mode.link);
|
|
||||||
do_join(cptr, sptr, 2, parv);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/* We check this later return (ERR_CHANNELISFULL); */
|
|
||||||
|
/* We later check again for this limit (in case +L was not set) */
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((chptr->mode.mode & MODE_RGSTRONLY) && !IsARegNick(sptr))
|
if ((chptr->mode.mode & MODE_RGSTRONLY) && !IsARegNick(sptr))
|
||||||
@@ -190,97 +186,9 @@ Ban *banned;
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef JOINTHROTTLE
|
|
||||||
if (!IsAnOper(cptr) &&
|
|
||||||
(chptr->mode.extmode & EXTMODE_JOINTHROTTLE) && isjthrottled(cptr, chptr))
|
|
||||||
return ERR_TOOMANYJOINS;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef JOINTHROTTLE
|
|
||||||
static int isjthrottled(aClient *cptr, aChannel *chptr)
|
|
||||||
{
|
|
||||||
CmodeParam *m;
|
|
||||||
aJFlood *e;
|
|
||||||
int num=0, t=0;
|
|
||||||
|
|
||||||
if (!MyClient(cptr))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
for (m = chptr->mode.extmodeparam; m; m=m->next)
|
|
||||||
if (m->flag == 'j')
|
|
||||||
{
|
|
||||||
num = ((aModejEntry *)m)->num;
|
|
||||||
t = ((aModejEntry *)m)->t;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!num || !t)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
/* Grab user<->chan entry.. */
|
|
||||||
for (e = cptr->user->jflood; e; e=e->next_u)
|
|
||||||
if (e->chptr == chptr)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (!e)
|
|
||||||
return 0; /* Not present, so cannot be throttled */
|
|
||||||
|
|
||||||
/* Ok... now the actual check:
|
|
||||||
* if ([timer valid] && [one more join would exceed num])
|
|
||||||
*/
|
|
||||||
if (((TStime() - e->firstjoin) < t) && (e->numjoins == num))
|
|
||||||
return 1; /* Throttled */
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void cmodej_increase_usercounter(aClient *cptr, aChannel *chptr)
|
|
||||||
{
|
|
||||||
CmodeParam *m;
|
|
||||||
aJFlood *e;
|
|
||||||
int num=0, t=0;
|
|
||||||
|
|
||||||
if (!MyClient(cptr))
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (m = chptr->mode.extmodeparam; m; m=m->next)
|
|
||||||
if (m->flag == 'j')
|
|
||||||
{
|
|
||||||
num = ((aModejEntry *)m)->num;
|
|
||||||
t = ((aModejEntry *)m)->t;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!num || !t)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* Grab user<->chan entry.. */
|
|
||||||
for (e = cptr->user->jflood; e; e=e->next_u)
|
|
||||||
if (e->chptr == chptr)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (!e)
|
|
||||||
{
|
|
||||||
/* Allocate one */
|
|
||||||
e = cmodej_addentry(cptr, chptr);
|
|
||||||
e->firstjoin = TStime();
|
|
||||||
e->numjoins = 1;
|
|
||||||
} else
|
|
||||||
if ((TStime() - e->firstjoin) < t) /* still valid? */
|
|
||||||
{
|
|
||||||
e->numjoins++;
|
|
||||||
} else {
|
|
||||||
/* reset :p */
|
|
||||||
e->firstjoin = TStime();
|
|
||||||
e->numjoins = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** m_join
|
** m_join
|
||||||
** parv[0] = sender prefix
|
** parv[0] = sender prefix
|
||||||
@@ -394,21 +302,11 @@ DLLFUNC void _join_channel(aChannel *chptr, aClient *cptr, aClient *sptr, int fl
|
|||||||
if (!Channelmode_Table[i].flag || !Channelmode_Table[i].paracount)
|
if (!Channelmode_Table[i].flag || !Channelmode_Table[i].paracount)
|
||||||
continue;
|
continue;
|
||||||
if (chptr->mode.extmode & Channelmode_Table[i].mode)
|
if (chptr->mode.extmode & Channelmode_Table[i].mode)
|
||||||
{
|
cm_putparameter(chptr, Channelmode_Table[i].flag, iConf.modes_on_join.extparams[i]);
|
||||||
CmodeParam *p;
|
|
||||||
p = Channelmode_Table[i].put_param(NULL, iConf.modes_on_join.extparams[i]);
|
|
||||||
AddListItem(p, chptr->mode.extmodeparam);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
chptr->mode.mode = MODES_ON_JOIN;
|
chptr->mode.mode = MODES_ON_JOIN;
|
||||||
|
|
||||||
if (iConf.modes_on_join.floodprot.per)
|
|
||||||
{
|
|
||||||
chptr->mode.floodprot = MyMalloc(sizeof(ChanFloodProt));
|
|
||||||
memcpy(chptr->mode.floodprot, &iConf.modes_on_join.floodprot, sizeof(ChanFloodProt));
|
|
||||||
}
|
|
||||||
|
|
||||||
*modebuf = *parabuf = 0;
|
*modebuf = *parabuf = 0;
|
||||||
channel_modes(sptr, modebuf, parabuf, sizeof(modebuf), sizeof(parabuf), chptr);
|
channel_modes(sptr, modebuf, parabuf, sizeof(modebuf), sizeof(parabuf), chptr);
|
||||||
/* This should probably be in the SJOIN stuff */
|
/* This should probably be in the SJOIN stuff */
|
||||||
@@ -423,34 +321,21 @@ DLLFUNC void _join_channel(aChannel *chptr, aClient *cptr, aClient *sptr, int fl
|
|||||||
} else {
|
} else {
|
||||||
RunHook4(HOOKTYPE_REMOTE_JOIN, cptr, sptr, chptr, parv); /* (rarely used) */
|
RunHook4(HOOKTYPE_REMOTE_JOIN, cptr, sptr, chptr, parv); /* (rarely used) */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* I'll explain this only once:
|
|
||||||
* 1. if channel is +f
|
|
||||||
* 2. local client OR synced server
|
|
||||||
* 3. then, increase floodcounter
|
|
||||||
* 4. if we reached the limit AND only if source was a local client.. do the action (+i).
|
|
||||||
* Nr 4 is done because otherwise you would have a noticeflood with 'joinflood detected'
|
|
||||||
* from all servers.
|
|
||||||
*/
|
|
||||||
if (chptr->mode.floodprot && (MyClient(sptr) || sptr->srvptr->serv->flags.synced) &&
|
|
||||||
!IsULine(sptr) && do_chanflood(chptr->mode.floodprot, FLD_JOIN) && MyClient(sptr))
|
|
||||||
{
|
|
||||||
do_chanflood_action(chptr, FLD_JOIN, "join");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** User request to join a channel.
|
/** User request to join a channel.
|
||||||
* This routine can be called from both m_join or via do_join->can_join->do_join
|
* This routine is normally called from m_join but can also be called from
|
||||||
* if the channel is 'linked' (chmode +L). We use a counter 'bouncedtimes' which
|
* do_join->can_join->link module->do_join if the channel is 'linked' (chmode +L).
|
||||||
* is set to 0 in m_join, increased every time we enter this loop and decreased
|
* We therefore use a counter 'bouncedtimes' which is set to 0 in m_join,
|
||||||
* anytime we leave the loop. So be carefull ;p.
|
* increased every time we enter this loop and decreased anytime we leave the
|
||||||
|
* loop. So be carefull not to use a simple 'return' after bouncedtimes++. -- Syzop
|
||||||
*/
|
*/
|
||||||
DLLFUNC CMD_FUNC(_do_join)
|
DLLFUNC CMD_FUNC(_do_join)
|
||||||
{
|
{
|
||||||
char jbuf[BUFSIZE];
|
char jbuf[BUFSIZE];
|
||||||
Membership *lp;
|
Membership *lp;
|
||||||
aChannel *chptr;
|
aChannel *chptr;
|
||||||
char *name, *key = NULL, *link = NULL;
|
char *name, *key = NULL;
|
||||||
int i, flags = 0, ishold;
|
int i, flags = 0, ishold;
|
||||||
char *p = NULL, *p2 = NULL;
|
char *p = NULL, *p2 = NULL;
|
||||||
aTKline *tklban;
|
aTKline *tklban;
|
||||||
@@ -468,7 +353,7 @@ DLLFUNC CMD_FUNC(_do_join)
|
|||||||
|
|
||||||
if (bouncedtimes > MAXBOUNCE)
|
if (bouncedtimes > MAXBOUNCE)
|
||||||
{
|
{
|
||||||
/* bounced too many times */
|
/* bounced too many times. yeah.. should be in the link module, I know.. then again, who cares.. */
|
||||||
sendnotice(sptr,
|
sendnotice(sptr,
|
||||||
"*** Couldn't join %s ! - Link setting was too bouncy",
|
"*** Couldn't join %s ! - Link setting was too bouncy",
|
||||||
parv[1]);
|
parv[1]);
|
||||||
@@ -589,18 +474,13 @@ DLLFUNC CMD_FUNC(_do_join)
|
|||||||
sendto_one(sptr, err_str(ERR_FORBIDDENCHANNEL), me.name, BadPtr(parv[0]) ? "*" : parv[0], name, d->reason);
|
sendto_one(sptr, err_str(ERR_FORBIDDENCHANNEL), me.name, BadPtr(parv[0]) ? "*" : parv[0], name, d->reason);
|
||||||
if (d->redirect)
|
if (d->redirect)
|
||||||
{
|
{
|
||||||
sendnotice(sptr,
|
sendnotice(sptr, "*** Redirecting you to %s", d->redirect);
|
||||||
"*** Redirecting you to %s",
|
|
||||||
d->redirect);
|
|
||||||
parv[0] = sptr->name;
|
parv[0] = sptr->name;
|
||||||
parv[1] = d->redirect;
|
parv[1] = d->redirect;
|
||||||
do_join(cptr, sptr, 2, parv);
|
do_join(cptr, sptr, 2, parv);
|
||||||
}
|
}
|
||||||
if (d->class) {
|
if (d->class)
|
||||||
sendnotice(sptr,
|
sendnotice(sptr, "*** Can not join %s: Your class is not allowed", name);
|
||||||
"*** Can not join %s: Your class is not allowed",
|
|
||||||
name);
|
|
||||||
}
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -663,7 +543,7 @@ DLLFUNC CMD_FUNC(_do_join)
|
|||||||
}
|
}
|
||||||
/* If they are allowed, don't check can_join */
|
/* If they are allowed, don't check can_join */
|
||||||
if (i != HOOK_ALLOW &&
|
if (i != HOOK_ALLOW &&
|
||||||
(i = can_join(cptr, sptr, chptr, key, link, parv)))
|
(i = can_join(cptr, sptr, chptr, key, parv)))
|
||||||
{
|
{
|
||||||
#ifndef NO_OPEROVERRIDE
|
#ifndef NO_OPEROVERRIDE
|
||||||
if (i != -1 && !OPCanOverride(sptr))
|
if (i != -1 && !OPCanOverride(sptr))
|
||||||
@@ -681,9 +561,6 @@ DLLFUNC CMD_FUNC(_do_join)
|
|||||||
#endif
|
#endif
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#ifdef JOINTHROTTLE
|
|
||||||
cmodej_increase_usercounter(cptr, chptr);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
join_channel(chptr, cptr, sptr, flags);
|
join_channel(chptr, cptr, sptr, flags);
|
||||||
|
|||||||
+34
-4
@@ -37,9 +37,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
#include "badwords.h"
|
|
||||||
#endif
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -93,8 +90,9 @@ CMD_FUNC(m_kick)
|
|||||||
aClient *who;
|
aClient *who;
|
||||||
aChannel *chptr;
|
aChannel *chptr;
|
||||||
int chasing = 0;
|
int chasing = 0;
|
||||||
char *comment, *name, *p = NULL, *user, *p2 = NULL;
|
char *comment, *name, *p = NULL, *user, *p2 = NULL, *badkick;
|
||||||
Membership *lp;
|
Membership *lp;
|
||||||
|
Hook *h;
|
||||||
|
|
||||||
if (parc < 3 || *parv[1] == '\0')
|
if (parc < 3 || *parv[1] == '\0')
|
||||||
{
|
{
|
||||||
@@ -188,6 +186,38 @@ CMD_FUNC(m_kick)
|
|||||||
}
|
}
|
||||||
/* Store "who" access flags */
|
/* Store "who" access flags */
|
||||||
who_flags = get_access(who, chptr);
|
who_flags = get_access(who, chptr);
|
||||||
|
|
||||||
|
badkick = NULL;
|
||||||
|
for (h = Hooks[HOOKTYPE_CAN_KICK]; h; h = h->next) {
|
||||||
|
badkick = (*(h->func.pcharfunc))(sptr, who, chptr, comment, sptr_flags, who_flags);
|
||||||
|
if (badkick)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (badkick)
|
||||||
|
{
|
||||||
|
/* If set it means 'not allowed to kick'.. now check if (s)he can override that.. */
|
||||||
|
if (op_can_override(sptr))
|
||||||
|
{
|
||||||
|
sendto_snomask(SNO_EYES,
|
||||||
|
"*** OperOverride -- %s (%s@%s) KICK %s %s (%s)",
|
||||||
|
sptr->name, sptr->user->username, sptr->user->realhost,
|
||||||
|
chptr->chname, who->name, comment);
|
||||||
|
ircd_log(LOG_OVERRIDE,"OVERRIDE: %s (%s@%s) KICK %s %s (%s)",
|
||||||
|
sptr->name, sptr->user->username, sptr->user->realhost,
|
||||||
|
chptr->chname, who->name, comment);
|
||||||
|
goto attack; /* all other checks don't matter anymore (and could cause double msgs) */
|
||||||
|
} else {
|
||||||
|
/* Not an oper overriding */
|
||||||
|
if (MyClient(sptr))
|
||||||
|
{
|
||||||
|
/* Send the error message prepared by the can_kick hook and deny the kick */
|
||||||
|
sendto_one(sptr, "%s", badkick);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* we are neither +o nor +h, OR..
|
/* we are neither +o nor +h, OR..
|
||||||
* we are +h but victim is +o, OR...
|
* we are +h but victim is +o, OR...
|
||||||
* we are +h and victim is +h
|
* we are +h and victim is +h
|
||||||
|
|||||||
@@ -36,9 +36,6 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#include "proto.h"
|
#include "proto.h"
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
#include "badwords.h"
|
|
||||||
#endif
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -37,9 +37,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
#include "badwords.h"
|
|
||||||
#endif
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -167,9 +164,6 @@ CMD_FUNC(m_knock)
|
|||||||
|
|
||||||
sendnotice(sptr, "Knocked on %s", chptr->chname);
|
sendnotice(sptr, "Knocked on %s", chptr->chname);
|
||||||
|
|
||||||
if (chptr->mode.floodprot && !IsULine(sptr) &&
|
RunHook2(HOOKTYPE_KNOCK, sptr, chptr);
|
||||||
do_chanflood(chptr->mode.floodprot, FLD_KNOCK) && MyClient(sptr))
|
|
||||||
do_chanflood_action(chptr, FLD_KNOCK, "knock");
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,9 +36,6 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#include "proto.h"
|
#include "proto.h"
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
#include "badwords.h"
|
|
||||||
#endif
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -37,9 +37,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
#include "badwords.h"
|
|
||||||
#endif
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -37,9 +37,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
#include "badwords.h"
|
|
||||||
#endif
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -37,9 +37,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
#include "badwords.h"
|
|
||||||
#endif
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -37,9 +37,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
#include "badwords.h"
|
|
||||||
#endif
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -117,7 +114,7 @@ char flatmap;
|
|||||||
max_connection_count =
|
max_connection_count =
|
||||||
IRCstats.me_clients + IRCstats.me_servers;
|
IRCstats.me_clients + IRCstats.me_servers;
|
||||||
if (max_connection_count % 10 == 0) /* only send on even tens */
|
if (max_connection_count % 10 == 0) /* only send on even tens */
|
||||||
sendto_ops("Maximum connections: %d (%d clients)",
|
sendto_ops("New record on this server: %d connections (%d clients)",
|
||||||
max_connection_count, IRCstats.me_clients);
|
max_connection_count, IRCstats.me_clients);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -37,9 +37,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
#include "badwords.h"
|
|
||||||
#endif
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+11
-367
@@ -36,18 +36,11 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#include "proto.h"
|
#include "proto.h"
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
#include "badwords.h"
|
|
||||||
#endif
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#endif
|
#endif
|
||||||
#include "badwords.h"
|
|
||||||
|
|
||||||
int _is_silenced(aClient *, aClient *);
|
int _is_silenced(aClient *, aClient *);
|
||||||
char *_stripbadwords_channel(char *str, int *blocked);
|
|
||||||
char *_stripbadwords_message(char *str, int *blocked);
|
|
||||||
char *_stripbadwords_quit(char *str, int *blocked);
|
|
||||||
char *_StripColors(unsigned char *text);
|
char *_StripColors(unsigned char *text);
|
||||||
char *_StripControlCodes(unsigned char *text);
|
char *_StripControlCodes(unsigned char *text);
|
||||||
|
|
||||||
@@ -73,9 +66,6 @@ ModuleHeader MOD_HEADER(m_message)
|
|||||||
DLLFUNC int MOD_TEST(m_message)(ModuleInfo *modinfo)
|
DLLFUNC int MOD_TEST(m_message)(ModuleInfo *modinfo)
|
||||||
{
|
{
|
||||||
MARK_AS_OFFICIAL_MODULE(modinfo);
|
MARK_AS_OFFICIAL_MODULE(modinfo);
|
||||||
EfunctionAddPChar(modinfo->handle, EFUNC_STRIPBADWORDS_CHANNEL, _stripbadwords_channel);
|
|
||||||
EfunctionAddPChar(modinfo->handle, EFUNC_STRIPBADWORDS_MESSAGE, _stripbadwords_message);
|
|
||||||
EfunctionAddPChar(modinfo->handle, EFUNC_STRIPBADWORDS_QUIT, _stripbadwords_quit);
|
|
||||||
EfunctionAddPChar(modinfo->handle, EFUNC_STRIPCOLORS, _StripColors);
|
EfunctionAddPChar(modinfo->handle, EFUNC_STRIPCOLORS, _StripColors);
|
||||||
EfunctionAddPChar(modinfo->handle, EFUNC_STRIPCONTROLCODES, _StripControlCodes);
|
EfunctionAddPChar(modinfo->handle, EFUNC_STRIPCONTROLCODES, _StripControlCodes);
|
||||||
EfunctionAdd(modinfo->handle, EFUNC_IS_SILENCED, _is_silenced);
|
EfunctionAdd(modinfo->handle, EFUNC_IS_SILENCED, _is_silenced);
|
||||||
@@ -123,7 +113,6 @@ static int check_dcc_soft(aClient *from, aClient *to, char *text);
|
|||||||
*/
|
*/
|
||||||
static int can_privmsg(aClient *cptr, aClient *sptr, aClient *acptr, int notice, char **text, char **cmd)
|
static int can_privmsg(aClient *cptr, aClient *sptr, aClient *acptr, int notice, char **text, char **cmd)
|
||||||
{
|
{
|
||||||
char *ctcp;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (IsVirus(sptr))
|
if (IsVirus(sptr))
|
||||||
@@ -137,15 +126,6 @@ int ret;
|
|||||||
acptr->name);
|
acptr->name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (IsNoCTCP(acptr) && !IsOper(sptr) && **text == 1 && acptr != sptr)
|
|
||||||
{
|
|
||||||
ctcp = *text + 1; /* &*text[1]; */
|
|
||||||
if (myncmp(ctcp, "ACTION ", 7) && myncmp(ctcp, "DCC ", 4))
|
|
||||||
{
|
|
||||||
sendto_one(sptr, err_str(ERR_NOCTCP), me.name, sptr->name, acptr->name);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (MyClient(sptr) && !strncasecmp(*text, "\001DCC", 4))
|
if (MyClient(sptr) && !strncasecmp(*text, "\001DCC", 4))
|
||||||
{
|
{
|
||||||
@@ -164,9 +144,6 @@ int ret;
|
|||||||
|
|
||||||
if (!is_silenced(sptr, acptr))
|
if (!is_silenced(sptr, acptr))
|
||||||
{
|
{
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
int blocked = 0;
|
|
||||||
#endif
|
|
||||||
Hook *tmphook;
|
Hook *tmphook;
|
||||||
|
|
||||||
if (!notice && MyConnect(sptr) &&
|
if (!notice && MyConnect(sptr) &&
|
||||||
@@ -175,20 +152,6 @@ int ret;
|
|||||||
me.name, sptr->name, acptr->name,
|
me.name, sptr->name, acptr->name,
|
||||||
acptr->user->away);
|
acptr->user->away);
|
||||||
|
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
if (MyClient(sptr) && !IsULine(acptr) && IsFilteringWords(acptr))
|
|
||||||
{
|
|
||||||
*text = stripbadwords_message(*text, &blocked);
|
|
||||||
if (blocked)
|
|
||||||
{
|
|
||||||
if (!notice && MyClient(sptr))
|
|
||||||
sendto_one(sptr, rpl_str(ERR_NOSWEAR),
|
|
||||||
me.name, sptr->name, acptr->name);
|
|
||||||
return CANPRIVMSG_CONTINUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (MyClient(sptr))
|
if (MyClient(sptr))
|
||||||
{
|
{
|
||||||
ret = dospamfilter(sptr, *text, (notice ? SPAMF_USERNOTICE : SPAMF_USERMSG), acptr->name, 0, NULL);
|
ret = dospamfilter(sptr, *text, (notice ? SPAMF_USERNOTICE : SPAMF_USERMSG), acptr->name, 0, NULL);
|
||||||
@@ -196,14 +159,16 @@ int ret;
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (tmphook = Hooks[HOOKTYPE_USERMSG]; tmphook; tmphook = tmphook->next) {
|
for (tmphook = Hooks[HOOKTYPE_PRE_USERMSG]; tmphook; tmphook = tmphook->next) {
|
||||||
*text = (*(tmphook->func.pcharfunc))(cptr, sptr, acptr, *text, notice);
|
*text = (*(tmphook->func.pcharfunc))(sptr, acptr, *text, notice);
|
||||||
if (!*text)
|
if (!*text)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!*text)
|
if (!*text)
|
||||||
return CANPRIVMSG_CONTINUE;
|
return CANPRIVMSG_CONTINUE;
|
||||||
|
|
||||||
|
RunHook4(HOOKTYPE_USERMSG, sptr, acptr, *text, notice);
|
||||||
|
|
||||||
return CANPRIVMSG_SEND;
|
return CANPRIVMSG_SEND;
|
||||||
} else {
|
} else {
|
||||||
/* Silenced */
|
/* Silenced */
|
||||||
@@ -230,7 +195,7 @@ DLLFUNC int m_message(aClient *cptr, aClient *sptr, int parc, char *parv[], int
|
|||||||
aClient *acptr, *srvptr;
|
aClient *acptr, *srvptr;
|
||||||
char *s;
|
char *s;
|
||||||
aChannel *chptr;
|
aChannel *chptr;
|
||||||
char *nick, *server, *p, *cmd, *ctcp, *p2, *pc, *text, *newcmd;
|
char *nick, *server, *p, *cmd, *p2, *pc, *text, *newcmd;
|
||||||
int cansend = 0;
|
int cansend = 0;
|
||||||
int prefix = 0;
|
int prefix = 0;
|
||||||
char pfixchan[CHANNELLEN + 4];
|
char pfixchan[CHANNELLEN + 4];
|
||||||
@@ -238,13 +203,14 @@ DLLFUNC int m_message(aClient *cptr, aClient *sptr, int parc, char *parv[], int
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Reasons why someone can't send to a channel
|
* Reasons why someone can't send to a channel
|
||||||
|
* Note: a few have been moved to modules now, but don't just blindly delete them!! as we use the array index ;p
|
||||||
*/
|
*/
|
||||||
static char *err_cantsend[] = {
|
static char *err_cantsend[] = {
|
||||||
"You need voice (+v)",
|
"You need voice (+v)",
|
||||||
"No external channel messages",
|
"No external channel messages",
|
||||||
"Color is not permitted in this channel",
|
"Color is not permitted in this channel <<NOLONGERUSED>>",
|
||||||
"You are banned",
|
"You are banned",
|
||||||
"CTCPs are not permitted in this channel",
|
"CTCPs are not permitted in this channel <<NOLONGERUSED>>",
|
||||||
"You must have a registered nick (+r) to talk on this channel",
|
"You must have a registered nick (+r) to talk on this channel",
|
||||||
"Swearing is not permitted in this channel",
|
"Swearing is not permitted in this channel",
|
||||||
"NOTICEs are not permitted in this channel",
|
"NOTICEs are not permitted in this channel",
|
||||||
@@ -432,48 +398,10 @@ DLLFUNC int m_message(aClient *cptr, aClient *sptr, int parc, char *parv[], int
|
|||||||
!IsULine(sptr) ? can_send(sptr, chptr, parv[2], notice) : 0;
|
!IsULine(sptr) ? can_send(sptr, chptr, parv[2], notice) : 0;
|
||||||
if (!cansend)
|
if (!cansend)
|
||||||
{
|
{
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
int blocked = 0;
|
|
||||||
#endif
|
|
||||||
Hook *tmphook;
|
Hook *tmphook;
|
||||||
|
|
||||||
if (chptr->mode.floodprot && chptr->mode.floodprot->l[FLD_TEXT])
|
|
||||||
if (check_for_chan_flood(cptr, sptr, chptr) == 1)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
sendanyways = (strchr(CHANCMDPFX,parv[2][0]) ? 1 : 0);
|
sendanyways = (strchr(CHANCMDPFX,parv[2][0]) ? 1 : 0);
|
||||||
text = parv[2];
|
text = parv[2];
|
||||||
if (MyClient(sptr) && (chptr->mode.mode & MODE_STRIP))
|
|
||||||
text = StripColors(parv[2]);
|
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
if (MyClient(sptr))
|
|
||||||
{
|
|
||||||
#ifdef STRIPBADWORDS_CHAN_ALWAYS
|
|
||||||
text = stripbadwords_channel(text,& blocked);
|
|
||||||
if (blocked)
|
|
||||||
{
|
|
||||||
if (!notice)
|
|
||||||
sendto_one(sptr, err_str(ERR_CANNOTSENDTOCHAN),
|
|
||||||
me.name, parv[0], chptr->chname,
|
|
||||||
err_cantsend[6], p2);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
if (chptr->mode.extmode & EXTMODE_STRIPBADWORDS)
|
|
||||||
{
|
|
||||||
text = stripbadwords_channel(text, &blocked);
|
|
||||||
if (blocked)
|
|
||||||
{
|
|
||||||
if (!notice)
|
|
||||||
sendto_one(sptr, err_str(ERR_CANNOTSENDTOCHAN),
|
|
||||||
me.name, parv[0], chptr->chname,
|
|
||||||
err_cantsend[6], p2);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (MyClient(sptr))
|
if (MyClient(sptr))
|
||||||
{
|
{
|
||||||
@@ -482,8 +410,8 @@ DLLFUNC int m_message(aClient *cptr, aClient *sptr, int parc, char *parv[], int
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (tmphook = Hooks[HOOKTYPE_CHANMSG]; tmphook; tmphook = tmphook->next) {
|
for (tmphook = Hooks[HOOKTYPE_PRE_CHANMSG]; tmphook; tmphook = tmphook->next) {
|
||||||
text = (*(tmphook->func.pcharfunc))(cptr, sptr, chptr, text, notice);
|
text = (*(tmphook->func.pcharfunc))(sptr, chptr, text, notice);
|
||||||
if (!text)
|
if (!text)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -497,21 +425,8 @@ DLLFUNC int m_message(aClient *cptr, aClient *sptr, int parc, char *parv[], int
|
|||||||
notice ? ":%s NOTICE %s :%s" : ":%s PRIVMSG %s :%s",
|
notice ? ":%s NOTICE %s :%s" : ":%s PRIVMSG %s :%s",
|
||||||
parv[0], nick, text);
|
parv[0], nick, text);
|
||||||
|
|
||||||
if (chptr->mode.floodprot && !is_skochanop(sptr, chptr) &&
|
|
||||||
!IsULine(sptr) && do_chanflood(chptr->mode.floodprot, FLD_MSG) &&
|
|
||||||
MyClient(sptr))
|
|
||||||
{
|
|
||||||
do_chanflood_action(chptr, FLD_MSG, "msg/notice");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (chptr->mode.floodprot && !is_skochanop(sptr, chptr) &&
|
|
||||||
(text[0] == '\001') && strncmp(text+1, "ACTION ", 7) &&
|
|
||||||
do_chanflood(chptr->mode.floodprot, FLD_CTCP) && MyClient(sptr))
|
|
||||||
{
|
|
||||||
do_chanflood_action(chptr, FLD_CTCP, "CTCP");
|
|
||||||
}
|
|
||||||
|
|
||||||
sendanyways = 0;
|
sendanyways = 0;
|
||||||
|
RunHook4(HOOKTYPE_CHANMSG, sptr, chptr, text, notice);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -888,277 +803,6 @@ int size_string;
|
|||||||
return 1; /* allowed */
|
return 1; /* allowed */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This was modified a bit in order to use newconf. The loading functions
|
|
||||||
* have been trashed and integrated into the config parser. The striping
|
|
||||||
* function now only uses REPLACEWORD if no word is specifically defined
|
|
||||||
* for the word found. Also the freeing function has been ditched. -- codemastr
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* our own strcasestr implementation because strcasestr is often not
|
|
||||||
* available or is not working correctly (??).
|
|
||||||
*/
|
|
||||||
char *our_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 */
|
|
||||||
}
|
|
||||||
inline int fast_badword_match(ConfigItem_badword *badword, char *line)
|
|
||||||
{
|
|
||||||
char *p;
|
|
||||||
int bwlen = strlen(badword->word);
|
|
||||||
if ((badword->type & BADW_TYPE_FAST_L) && (badword->type & BADW_TYPE_FAST_R))
|
|
||||||
return (our_strcasestr(line, badword->word) ? 1 : 0);
|
|
||||||
|
|
||||||
p = line;
|
|
||||||
while((p = our_strcasestr(p, badword->word)))
|
|
||||||
{
|
|
||||||
if (!(badword->type & BADW_TYPE_FAST_L))
|
|
||||||
{
|
|
||||||
if ((p != line) && !iswseperator(*(p - 1))) /* aaBLA but no *BLA */
|
|
||||||
goto next;
|
|
||||||
}
|
|
||||||
if (!(badword->type & BADW_TYPE_FAST_R))
|
|
||||||
{
|
|
||||||
if (!iswseperator(*(p + bwlen))) /* BLAaa but no BLA* */
|
|
||||||
goto next;
|
|
||||||
}
|
|
||||||
/* Looks like it matched */
|
|
||||||
return 1;
|
|
||||||
next:
|
|
||||||
p += bwlen;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
/* fast_badword_replace:
|
|
||||||
* a fast replace routine written by Syzop used for replacing badwords.
|
|
||||||
* searches in line for huntw and replaces it with replacew,
|
|
||||||
* buf is used for the result and max is sizeof(buf).
|
|
||||||
* (Internal assumptions: max > 0 AND max > strlen(line)+1)
|
|
||||||
*/
|
|
||||||
inline int fast_badword_replace(ConfigItem_badword *badword, char *line, char *buf, int max)
|
|
||||||
{
|
|
||||||
/* Some aliases ;P */
|
|
||||||
char *replacew = badword->replace ? badword->replace : REPLACEWORD;
|
|
||||||
char *pold = line, *pnew = buf; /* Pointers to old string and new string */
|
|
||||||
char *poldx = line;
|
|
||||||
int replacen = -1; /* Only calculated if needed. w00t! saves us a few nanosecs? lol */
|
|
||||||
int searchn = -1;
|
|
||||||
char *startw, *endw;
|
|
||||||
char *c_eol = buf + max - 1; /* Cached end of (new) line */
|
|
||||||
int run = 1;
|
|
||||||
int cleaned = 0;
|
|
||||||
|
|
||||||
Debug((DEBUG_NOTICE, "replacing %s -> %s in '%s'", badword->word, replacew, line));
|
|
||||||
|
|
||||||
while(run) {
|
|
||||||
pold = our_strcasestr(pold, badword->word);
|
|
||||||
if (!pold)
|
|
||||||
break;
|
|
||||||
if (replacen == -1)
|
|
||||||
replacen = strlen(replacew);
|
|
||||||
if (searchn == -1)
|
|
||||||
searchn = strlen(badword->word);
|
|
||||||
/* 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 (!(badword->type & BADW_TYPE_FAST_L) && (pold != startw)) {
|
|
||||||
/* not matched */
|
|
||||||
pold++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Hunt for end of word */
|
|
||||||
for (endw = pold; ((*endw != '\0') && (!iswseperator(*endw))); endw++);
|
|
||||||
|
|
||||||
if (!(badword->type & BADW_TYPE_FAST_R) && (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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Returns a string, which has been filtered by the words loaded via
|
|
||||||
* the loadbadwords() function. It's primary use is to filter swearing
|
|
||||||
* in both private and public messages
|
|
||||||
*/
|
|
||||||
|
|
||||||
char *stripbadwords(char *str, ConfigItem_badword *start_bw, int *blocked)
|
|
||||||
{
|
|
||||||
regmatch_t pmatch[MAX_MATCH];
|
|
||||||
static char cleanstr[4096];
|
|
||||||
char buf[4096];
|
|
||||||
char *ptr;
|
|
||||||
int matchlen, m, stringlen, cleaned;
|
|
||||||
ConfigItem_badword *this_word;
|
|
||||||
|
|
||||||
*blocked = 0;
|
|
||||||
|
|
||||||
if (!start_bw)
|
|
||||||
return str;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* work on a copy
|
|
||||||
*/
|
|
||||||
stringlen = strlcpy(cleanstr, StripControlCodes(str), sizeof cleanstr);
|
|
||||||
memset(&pmatch, 0, sizeof pmatch);
|
|
||||||
matchlen = 0;
|
|
||||||
buf[0] = '\0';
|
|
||||||
cleaned = 0;
|
|
||||||
|
|
||||||
for (this_word = start_bw; this_word; this_word = (ConfigItem_badword *)this_word->next)
|
|
||||||
{
|
|
||||||
if (this_word->type & BADW_TYPE_FAST)
|
|
||||||
{
|
|
||||||
if (this_word->action == BADWORD_BLOCK)
|
|
||||||
{
|
|
||||||
if (fast_badword_match(this_word, cleanstr))
|
|
||||||
{
|
|
||||||
*blocked = 1;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int n;
|
|
||||||
/* fast_badword_replace() does size checking so we can use 512 here instead of 4096 */
|
|
||||||
n = fast_badword_replace(this_word, cleanstr, buf, 512);
|
|
||||||
if (!cleaned && n)
|
|
||||||
cleaned = n;
|
|
||||||
strcpy(cleanstr, buf);
|
|
||||||
memset(buf, 0, sizeof(buf)); /* regexp likes this somehow */
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
if (this_word->type & BADW_TYPE_REGEX)
|
|
||||||
{
|
|
||||||
if (this_word->action == BADWORD_BLOCK)
|
|
||||||
{
|
|
||||||
if (!regexec(&this_word->expr, cleanstr, 0, NULL, 0))
|
|
||||||
{
|
|
||||||
*blocked = 1;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ptr = cleanstr; /* set pointer to start of string */
|
|
||||||
while (regexec(&this_word->expr, ptr, MAX_MATCH, pmatch,0) != REG_NOMATCH)
|
|
||||||
{
|
|
||||||
if (pmatch[0].rm_so == -1)
|
|
||||||
break;
|
|
||||||
m = pmatch[0].rm_eo - pmatch[0].rm_so;
|
|
||||||
if (m == 0)
|
|
||||||
break; /* anti-loop */
|
|
||||||
cleaned = 1;
|
|
||||||
matchlen += m;
|
|
||||||
strlncat(buf, ptr, sizeof buf, pmatch[0].rm_so);
|
|
||||||
if (this_word->replace)
|
|
||||||
strlcat(buf, this_word->replace, sizeof buf);
|
|
||||||
else
|
|
||||||
strlcat(buf, REPLACEWORD, sizeof buf);
|
|
||||||
ptr += pmatch[0].rm_eo; /* Set pointer after the match pos */
|
|
||||||
memset(&pmatch, 0, sizeof(pmatch));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* All the better to eat you with! */
|
|
||||||
strlcat(buf, ptr, sizeof buf);
|
|
||||||
memcpy(cleanstr, buf, sizeof cleanstr);
|
|
||||||
memset(buf, 0, sizeof(buf));
|
|
||||||
if (matchlen == stringlen)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cleanstr[511] = '\0'; /* cutoff, just to be sure */
|
|
||||||
|
|
||||||
return (cleaned) ? cleanstr : str;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
char *_stripbadwords_channel(char *str, int *blocked)
|
|
||||||
{
|
|
||||||
return stripbadwords(str, conf_badword_channel, blocked);
|
|
||||||
}
|
|
||||||
|
|
||||||
char *_stripbadwords_message(char *str, int *blocked)
|
|
||||||
{
|
|
||||||
return stripbadwords(str, conf_badword_message, blocked);
|
|
||||||
}
|
|
||||||
char *_stripbadwords_quit(char *str, int *blocked)
|
|
||||||
{
|
|
||||||
return stripbadwords(str, conf_badword_quit, blocked);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
char *_stripbadwords_channel(char *str, int *blocked)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
char *_stripbadwords_message(char *str, int *blocked)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
char *_stripbadwords_quit(char *str, int *blocked)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Taken from xchat by Peter Zelezny
|
/* Taken from xchat by Peter Zelezny
|
||||||
* changed very slightly by codemastr
|
* changed very slightly by codemastr
|
||||||
* RGB color stripping support added -- codemastr
|
* RGB color stripping support added -- codemastr
|
||||||
|
|||||||
@@ -39,9 +39,6 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#include "proto.h"
|
#include "proto.h"
|
||||||
#ifdef STRIPBADWORDS
|
|
||||||
#include "badwords.h"
|
|
||||||
#endif
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user