diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/InspIRCd.layout | 30 | ||||
-rw-r--r-- | src/inspircd.cpp | 65 | ||||
-rw-r--r-- | src/modules.cpp | 8 |
3 files changed, 88 insertions, 15 deletions
diff --git a/src/InspIRCd.layout b/src/InspIRCd.layout index aaa0daa11..efa8d0220 100644 --- a/src/InspIRCd.layout +++ b/src/InspIRCd.layout @@ -13,9 +13,9 @@ LeftChar=1 [Editor_1] Open=1 Top=1 -CursorCol=22 -CursorRow=5263 -TopLine=5236 +CursorCol=4 +CursorRow=830 +TopLine=776 LeftChar=1 [Editor_2] @@ -37,9 +37,9 @@ LeftChar=1 [Editor_4] Open=1 Top=0 -CursorCol=56 -CursorRow=118 -TopLine=91 +CursorCol=1 +CursorRow=140 +TopLine=123 LeftChar=1 [Editor_5] @@ -141,9 +141,9 @@ LeftChar=1 [Editor_17] Open=1 Top=0 -CursorCol=6 -CursorRow=86 -TopLine=34 +CursorCol=58 +CursorRow=78 +TopLine=49 LeftChar=1 [Editor_18] @@ -165,10 +165,10 @@ LeftChar=1 [Editor_20] Open=1 Top=0 -CursorCol=58 -CursorRow=171 -TopLine=148 -LeftChar=1 +CursorCol=7 +CursorRow=385 +TopLine=333 +LeftChar=3 [Editor_21] Open=1 @@ -204,8 +204,8 @@ LeftChar=1 [Editor_25] Open=1 Top=0 -CursorCol=4 -CursorRow=76 +CursorCol=6 +CursorRow=10 TopLine=1 LeftChar=1 [Editor_26] diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 26c952062..5f6cebe52 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -773,6 +773,68 @@ void WriteOpers(char* text, ...) } } +bool hasumode(userrec* user, char mode) +{ + if (user) + { + return (strchr(user->modes,mode)>0); + } + else return false; +} + +void WriteMode(const char* modes, int flags, const char* text, ...) +{ + if ((!text) || (!modes) || (!flags)) + { + log(DEFAULT,"*** BUG *** WriteMode was given an invalid parameter"); + return; + } + + char textbuffer[MAXBUF]; + va_list argsPtr; + va_start (argsPtr, text); + vsnprintf(textbuffer, MAXBUF, text, argsPtr); + va_end(argsPtr); + + for (user_hash::const_iterator i = clientlist.begin(); i != clientlist.end(); i++) + { + if (i->second) + { + bool send_to_user = false; + + if (flags == WM_AND) + { + send_to_user = true; + for (int n = 0; n < strlen(modes); n++) + { + if (!hasumode(i->second,modes[n])) + { + send_to_user = false; + break; + } + } + } + else if (flags == WM_OR) + { + send_to_user = false; + for (int n = 0; n < strlen(modes); n++) + { + if (hasumode(i->second,modes[n])) + { + send_to_user = true; + break; + } + } + } + + if (send_to_user) + { + WriteServ(i->second->fd,"NOTICE %s :%s",i->second->nick,textbuffer); + } + } + } +} + void WriteWallOps(userrec *source, char* text, ...) { if ((!text) || (!source)) @@ -3672,6 +3734,7 @@ void handle_info(char **parameters, int pcnt, userrec *user) WriteServ(user->fd,"371 %s :The Inspire IRCd Project Has been brought to you by the following people..",user->nick); WriteServ(user->fd,"371 %s :Craig Edwards, Craig McLure, and Others..",user->nick); WriteServ(user->fd,"371 %s :Will finish this later when i can be arsed :p",user->nick); + FOREACH_MOD OnInfo(user); WriteServ(user->fd,"374 %s :End of /INFO list",user->nick); } @@ -3717,6 +3780,7 @@ void handle_whois(char **parameters, int pcnt, userrec *user) { WriteServ(user->fd,"313 %s %s :is an IRC operator",user->nick, dest->nick); } + FOREACH_MOD OnWhois(user,dest); //WriteServ(user->fd,"310 %s %s :is available for help.",user->nick, dest->nick); WriteServ(user->fd,"317 %s %s %d %d :seconds idle, signon time",user->nick, dest->nick, abs((dest->idle_lastmsg)-time(NULL)), dest->signon); @@ -4382,6 +4446,7 @@ void handle_oper(char **parameters, int pcnt, userrec *user) { strcat(user->modes,"o"); } + FOREACH_MOD OnOper(user); return; } } diff --git a/src/modules.cpp b/src/modules.cpp index 8ff5874af..5bea5133f 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -117,6 +117,9 @@ void Module::OnServerRaw(std::string &raw, bool inbound) { } int Module::OnUserPreJoin(userrec* user, chanrec* chan, char* cname) { return 0; } bool Module::OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list ¶ms) { } Version Module::GetVersion() { return Version(1,0,0,0); } +void Module::OnOper(userrec* user) { }; +void Module::OnInfo(userrec* user) { }; +void Module::OnWhois(userrec* source, userrec* dest) { }; // server is a wrapper class that provides methods to all of the C-style // exports in the core @@ -135,6 +138,11 @@ void Server::SendOpers(std::string s) WriteOpers("%s",s.c_str()); } +void Server::SendToModeMask(std::string modes, int flags, std::string text) +{ + WriteMode(modes.c_str(),flags,"%s",text.c_str()); +} + void Server::Log(int level, std::string s) { log(level,"%s",s.c_str()); |