From 5b639d8e57e42922b51998085ffe368f4a9f9ff1 Mon Sep 17 00:00:00 2001 From: brain Date: Sat, 15 May 2004 12:08:56 +0000 Subject: Added +N via m_nonicks, restored some stuff from a firewall fuckup git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@813 e03df62e-2008-0410-955e-edbf42e46eb7 --- docs/helpop.conf.example | 10 +++- src/InspIRCd.dev | 52 +++++++++++++++++- src/InspIRCd.layout | 125 +++++++++++++++++++++++++++---------------- src/modules/m_blockcolor.cpp | 13 +++++ src/modules/m_knock.cpp | 4 +- src/modules/m_noctcp.cpp | 13 +++++ src/modules/m_nokicks.cpp | 15 +++++- src/modules/m_nonicks.cpp | 92 +++++++++++++++++++++++++++++++ src/modules/m_nonotice.cpp | 13 +++++ 9 files changed, 286 insertions(+), 51 deletions(-) create mode 100644 src/modules/m_nonicks.cpp diff --git a/docs/helpop.conf.example b/docs/helpop.conf.example index 3e129adeb..583108b23 100644 --- a/docs/helpop.conf.example +++ b/docs/helpop.conf.example @@ -280,7 +280,7 @@ line9="i Make the channel invite only, must /INVITE users" line10="k [key] Set the channel key (password) to [key]" line11="l [limit] Set the maximum possible users to [limit]" - line12="m Enable moderation. Only +vo can speak" + line12="m Enable moderation. Only +vo(h) can speak" line13="n Only users who are members of the channel may message it" line14="p Make channel private (hide from /LIST)" line15="s Make channel secret (can't be used at the same time as +p)" @@ -291,6 +291,12 @@ line20="C No CTCPs allowed to the channel" line21="c mIRC colour codes blocked on the channel" line22="K No /KNOCK allowed to channel (if knock module is loaded)" - line23="L [channel] If the channel is full, redirect users to [channel]"> + line23="L [channel] If the channel is full, redirect users to [channel]" + line24="N No nickchanges while on the channel" + line25="-------------" + line26="NOTE: A large number of these modes are dependent upon server-side modules" + line27="being loaded by a server/network administrator. The actual modes available" + line28="on your network may be very different to this list. Please consult your" + line29="help channel if you have any questions."> diff --git a/src/InspIRCd.dev b/src/InspIRCd.dev index 845b0de03..779b9174e 100644 --- a/src/InspIRCd.dev +++ b/src/InspIRCd.dev @@ -1,7 +1,7 @@ [Project] FileName=InspIRCd.dev Name=InspIRCd - The Inspire Internet Relay Chat Daemon -UnitCount=55 +UnitCount=60 Type=1 Ver=1 ObjFiles= @@ -595,3 +595,53 @@ Priority=1000 OverrideBuildCmd=0 BuildCmd= +[Unit56] +FileName=modules\m_nonotice.cpp +CompileCpp=1 +Folder=Modules/Server +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit57] +FileName=modules\m_knock.cpp +CompileCpp=1 +Folder=Modules/Server +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit58] +FileName=modules\m_noctcp.cpp +CompileCpp=1 +Folder=Modules/Server +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit59] +FileName=modules\m_blockcolor.cpp +CompileCpp=1 +Folder=Modules/Server +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit60] +FileName=modules\m_nonicks.cpp +CompileCpp=1 +Folder=Modules/Server +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/src/InspIRCd.layout b/src/InspIRCd.layout index 6cfb8dd38..5e48503f6 100644 --- a/src/InspIRCd.layout +++ b/src/InspIRCd.layout @@ -1,21 +1,21 @@ [Editors] -Focused=43 -Order=2,4,6,3,7,25,5,24,39,42,43,-1,1,46,0,49 +Focused=-1 +Order=2,4,6,3,7,25,5,24,39,42,43,1,46,0,49,-1 [Editor_0] Open=1 Top=0 CursorCol=39 CursorRow=78 -TopLine=35 +TopLine=26 LeftChar=1 [Editor_1] Open=1 Top=0 -CursorCol=1 -CursorRow=99 -TopLine=73 +CursorCol=36 +CursorRow=1450 +TopLine=1419 LeftChar=1 [Editor_2] @@ -23,7 +23,7 @@ Open=1 Top=0 CursorCol=21 CursorRow=489 -TopLine=437 +TopLine=428 LeftChar=1 [Editor_3] @@ -31,7 +31,7 @@ Open=1 Top=0 CursorCol=2 CursorRow=82 -TopLine=28 +TopLine=19 LeftChar=1 [Editor_4] @@ -55,7 +55,7 @@ Open=1 Top=0 CursorCol=1 CursorRow=117 -TopLine=94 +TopLine=87 LeftChar=1 [Editor_7] @@ -67,7 +67,7 @@ TopLine=1 LeftChar=1 [Editor_8] -Open=1 +Open=0 Top=0 CursorCol=50 CursorRow=31 @@ -75,7 +75,7 @@ TopLine=1 LeftChar=1 [Editor_9] -Open=1 +Open=0 Top=0 CursorCol=17 CursorRow=65 @@ -91,7 +91,7 @@ TopLine=70 LeftChar=1 [Editor_11] -Open=1 +Open=0 Top=0 CursorCol=39 CursorRow=6 @@ -115,7 +115,7 @@ TopLine=197 LeftChar=1 [Editor_14] -Open=1 +Open=0 Top=0 CursorCol=1 CursorRow=18 @@ -131,7 +131,7 @@ TopLine=41 LeftChar=1 [Editor_16] -Open=1 +Open=0 Top=0 CursorCol=1 CursorRow=45 @@ -141,13 +141,13 @@ LeftChar=1 [Editor_17] Open=1 Top=0 -CursorCol=46 +CursorCol=4 CursorRow=114 -TopLine=106 +TopLine=99 LeftChar=1 [Editor_18] -Open=1 +Open=0 Top=0 CursorCol=6 CursorRow=20 @@ -155,7 +155,7 @@ TopLine=1 LeftChar=1 [Editor_19] -Open=0 +Open=1 Top=0 CursorCol=21 CursorRow=7 @@ -165,13 +165,13 @@ LeftChar=1 [Editor_20] Open=1 Top=0 -CursorCol=25 -CursorRow=380 -TopLine=332 +CursorCol=64 +CursorRow=268 +TopLine=236 LeftChar=1 [Editor_21] -Open=1 +Open=0 Top=0 CursorCol=1 CursorRow=63 @@ -209,42 +209,42 @@ CursorRow=77 TopLine=77 LeftChar=1 [Editor_26] -Open=1 +Open=0 Top=0 CursorCol=2 CursorRow=73 TopLine=32 LeftChar=1 [Editor_27] -Open=1 +Open=0 Top=0 CursorCol=13 CursorRow=50 TopLine=6 LeftChar=1 [Editor_28] -Open=1 +Open=0 Top=0 CursorCol=87 CursorRow=20 TopLine=5 LeftChar=1 [Editor_29] -Open=1 +Open=0 Top=0 CursorCol=70 CursorRow=21 TopLine=1 LeftChar=1 [Editor_30] -Open=1 +Open=0 Top=0 CursorCol=1 CursorRow=34 TopLine=1 LeftChar=1 [Editor_31] -Open=1 +Open=0 Top=0 CursorCol=2 CursorRow=40 @@ -258,35 +258,35 @@ CursorRow=57 TopLine=28 LeftChar=1 [Editor_33] -Open=1 +Open=0 Top=0 CursorCol=23 CursorRow=36 TopLine=10 LeftChar=1 [Editor_34] -Open=1 +Open=0 Top=0 CursorCol=38 CursorRow=35 TopLine=8 LeftChar=1 [Editor_35] -Open=1 +Open=0 Top=0 CursorCol=2 CursorRow=51 TopLine=24 LeftChar=1 [Editor_36] -Open=1 +Open=0 Top=0 CursorCol=1 CursorRow=34 TopLine=1 LeftChar=1 [Editor_37] -Open=1 +Open=0 Top=0 CursorCol=13 CursorRow=160 @@ -307,7 +307,7 @@ CursorRow=165 TopLine=139 LeftChar=1 [Editor_40] -Open=1 +Open=0 Top=0 CursorCol=1 CursorRow=31 @@ -323,26 +323,26 @@ LeftChar=1 [Editor_42] Open=1 Top=0 -CursorCol=10 +CursorCol=3 CursorRow=1261 TopLine=1232 LeftChar=1 [Editor_43] Open=1 -Top=1 +Top=0 CursorCol=10 CursorRow=285 TopLine=249 LeftChar=1 [Editor_44] -Open=1 +Open=0 Top=0 CursorCol=64 CursorRow=64 TopLine=1 LeftChar=1 [Editor_45] -Open=1 +Open=0 Top=0 CursorCol=12 CursorRow=122 @@ -363,7 +363,7 @@ CursorRow=157 TopLine=4 LeftChar=1 [Editor_48] -Open=1 +Open=0 Top=0 CursorCol=11 CursorRow=82 @@ -384,14 +384,14 @@ CursorRow=211 TopLine=167 LeftChar=1 [Editor_51] -Open=1 +Open=0 Top=0 CursorCol=12 CursorRow=57 TopLine=19 LeftChar=1 [Editor_52] -Open=1 +Open=0 Top=0 CursorCol=2 CursorRow=39 @@ -400,14 +400,49 @@ LeftChar=1 [Editor_53] Open=1 Top=0 +CursorCol=13 +CursorRow=39 +TopLine=10 +LeftChar=1 +[Editor_54] +Open=1 +Top=0 CursorCol=1 -CursorRow=58 +CursorRow=21 TopLine=1 LeftChar=1 -[Editor_54] +[Editor_55] Open=1 Top=0 CursorCol=1 -CursorRow=29 -TopLine=14 +CursorRow=1 +TopLine=1 +LeftChar=1 +[Editor_56] +Open=1 +Top=0 +CursorCol=53 +CursorRow=7 +TopLine=1 +LeftChar=1 +[Editor_57] +Open=1 +Top=0 +CursorCol=1 +CursorRow=1 +TopLine=1 +LeftChar=1 +[Editor_58] +Open=1 +Top=0 +CursorCol=1 +CursorRow=1 +TopLine=1 +LeftChar=1 +[Editor_59] +Open=1 +Top=1 +CursorCol=2 +CursorRow=37 +TopLine=1 LeftChar=1 diff --git a/src/modules/m_blockcolor.cpp b/src/modules/m_blockcolor.cpp index 4d1a3500d..58ee4da8b 100644 --- a/src/modules/m_blockcolor.cpp +++ b/src/modules/m_blockcolor.cpp @@ -55,6 +55,19 @@ class ModuleBlockColor : public Module return 0; } + virtual int OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list ¶ms) + { + // check if this is our mode character... + if ((modechar == 'c') && (type == MT_CHANNEL)) + { + return 1; + } + else + { + return 0; + } + } + virtual ~ModuleBlockColor() { delete Srv; diff --git a/src/modules/m_knock.cpp b/src/modules/m_knock.cpp index 12ad69b13..2569214df 100644 --- a/src/modules/m_knock.cpp +++ b/src/modules/m_knock.cpp @@ -4,7 +4,7 @@ #include "channels.h" #include "modules.h" -/* $ModDesc: Provides support for unreal-style GLOBOPS and umode +g */ +/* $ModDesc: Provides support for /KNOCK and mode +K */ Server *Srv; @@ -26,7 +26,7 @@ void handle_knock(char **parameters, int pcnt, userrec *user) } if (c->inviteonly) { - WriteChannelWithServ(Srv->GetServerName().c_str(),c,user,"NOTICE %s :User %s is KNOCKing on %s (%s)",c->name,user->nick,c->name,line.c_str()); + WriteChannelWithServ((char*)Srv->GetServerName().c_str(),c,user,"NOTICE %s :User %s is KNOCKing on %s (%s)",c->name,user->nick,c->name,line.c_str()); WriteServ(user->fd,"NOTICE %s :KNOCKing on %s",user->nick,c->name); return; } diff --git a/src/modules/m_noctcp.cpp b/src/modules/m_noctcp.cpp index 1b1f56397..a5d472d45 100644 --- a/src/modules/m_noctcp.cpp +++ b/src/modules/m_noctcp.cpp @@ -58,6 +58,19 @@ class ModuleNoCTCP : public Module return 0; } + virtual int OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list ¶ms) + { + // check if this is our mode character... + if ((modechar == 'C') && (type == MT_CHANNEL)) + { + return 1; + } + else + { + return 0; + } + } + virtual ~ModuleNoCTCP() { delete Srv; diff --git a/src/modules/m_nokicks.cpp b/src/modules/m_nokicks.cpp index b90932e6c..582b3209a 100644 --- a/src/modules/m_nokicks.cpp +++ b/src/modules/m_nokicks.cpp @@ -17,7 +17,7 @@ class ModuleNoKicks : public Module Srv = new Server; Srv->AddExtendedMode('Q',MT_CHANNEL,false,0,0); } - + virtual int OnAccessCheck(userrec* source,userrec* dest,chanrec* channel,int access_type) { if (access_type == AC_KICK) @@ -40,6 +40,19 @@ class ModuleNoKicks : public Module return ACR_DEFAULT; } + virtual int OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list ¶ms) + { + // check if this is our mode character... + if ((modechar == 'Q') && (type == MT_CHANNEL)) + { + return 1; + } + else + { + return 0; + } + } + virtual ~ModuleNoKicks() { delete Srv; diff --git a/src/modules/m_nonicks.cpp b/src/modules/m_nonicks.cpp new file mode 100644 index 000000000..d46525152 --- /dev/null +++ b/src/modules/m_nonicks.cpp @@ -0,0 +1,92 @@ +#include +#include +#include "users.h" +#include "channels.h" +#include "modules.h" + +/* $ModDesc: Provides support for unreal-style GLOBOPS and umode +g */ + +Server *Srv; + +class ModuleNoNickChange : public Module +{ + public: + ModuleNoNickChange() + { + Srv = new Server; + + Srv->AddExtendedMode('N',MT_CHANNEL,false,0,0); + } + + virtual ~ModuleNoNickChange() + { + delete Srv; + } + + virtual Version GetVersion() + { + return Version(1,0,0,1); + } + + virtual int OnUserPreNick(userrec* user, std::string newnick) + { + if (!strcasecmp(user->server,Srv->GetServerName().c_str())) + { + for (int i =0; i != MAXCHANS; i++) + { + if (user->chans[i].channel != NULL) + { + chanrec* curr = user->chans[i].channel; + if (curr->IsCustomModeSet('N')) + { + // don't allow the nickchange, theyre on at least one channel with +N set + WriteServ(user->fd,"447 %s :Can't change nickname while on %s (+N is set)",user->nick,curr->name); + return 1; + } + } + } + } + return 0; + } + + virtual int OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list ¶ms) + { + // check if this is our mode character... + if ((modechar == 'N') && (type == MT_CHANNEL)) + { + return 1; + } + else + { + return 0; + } + } + +}; + +// stuff down here is the module-factory stuff. For basic modules you can ignore this. + +class ModuleNoNickChangeFactory : public ModuleFactory +{ + public: + ModuleNoNickChangeFactory() + { + } + + ~ModuleNoNickChangeFactory() + { + } + + virtual Module * CreateModule() + { + return new ModuleNoNickChange; + } + +}; + + +extern "C" void * init_module( void ) +{ + return new ModuleNoNickChangeFactory; +} + diff --git a/src/modules/m_nonotice.cpp b/src/modules/m_nonotice.cpp index 23c529bfc..f501cc307 100644 --- a/src/modules/m_nonotice.cpp +++ b/src/modules/m_nonotice.cpp @@ -38,6 +38,19 @@ class ModuleNoNotice : public Module } return 0; } + + virtual int OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list ¶ms) + { + // check if this is our mode character... + if ((modechar == 'T') && (type == MT_CHANNEL)) + { + return 1; + } + else + { + return 0; + } + } virtual ~ModuleNoNotice() { -- cgit v1.2.3