From 7493cbb6b96253da72eae375acc7b4d0d309122c Mon Sep 17 00:00:00 2001 From: brain Date: Fri, 18 Apr 2003 19:03:21 +0000 Subject: Added Mode handler structures and types Fixed crash when doing /who * when on no channels git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@174 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/InspIRCd.layout | 6 +++--- src/inspircd.cpp | 31 ++++++++++++++++++++----------- src/modules.cpp | 6 ++++++ 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/src/InspIRCd.layout b/src/InspIRCd.layout index 7820e4f7a..d220c38d2 100644 --- a/src/InspIRCd.layout +++ b/src/InspIRCd.layout @@ -13,9 +13,9 @@ LeftChar=1 [Editor_1] Open=1 Top=1 -CursorCol=25 -CursorRow=3672 -TopLine=3433 +CursorCol=1 +CursorRow=3902 +TopLine=3851 LeftChar=1 [Editor_2] diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 2eff65bfe..621ca21c5 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -2982,23 +2982,32 @@ void handle_quit(char **parameters, int pcnt, userrec *user) void handle_who(char **parameters, int pcnt, userrec *user) { - chanrec* Ptr; + chanrec* Ptr = null; /* theres more to do here, but for now just close the socket */ if (pcnt == 1) { if ((!strcmp(parameters[0],"0")) || (!strcmp(parameters[0],"*"))) { - Ptr = user->chans[0].channel; - printf(user->chans[0].channel->name); - for (user_hash::const_iterator i = clientlist.begin(); i != clientlist.end(); i++) + if (user->chans[0].channel) { - if ((common_channels(user,i->second)) && (isnick(i->second->nick))) + Ptr = user->chans[0].channel; + for (user_hash::const_iterator i = clientlist.begin(); i != clientlist.end(); i++) { - WriteServ(user->fd,"352 %s %s %s %s %s %s Hr@ :0 %s",user->nick, Ptr->name, i->second->ident, i->second->dhost, ServerName, i->second->nick, i->second->fullname); + if ((common_channels(user,i->second)) && (isnick(i->second->nick))) + { + WriteServ(user->fd,"352 %s %s %s %s %s %s Hr@ :0 %s",user->nick, Ptr->name, i->second->ident, i->second->dhost, ServerName, i->second->nick, i->second->fullname); + } } } - WriteServ(user->fd,"315 %s %s :End of /WHO list.",user->nick, Ptr->name); + if (Ptr) + { + WriteServ(user->fd,"315 %s %s :End of /WHO list.",user->nick, Ptr->name); + } + else + { + WriteServ(user->fd,"315 %s %s :End of /WHO list.",user->nick, user->nick); + } return; } if (parameters[0][0] = '#') @@ -3666,10 +3675,10 @@ void process_command(userrec *user, char* cmd) } strcpy(temp,cmd); - string temp = cmd; - FOREACH_MOD OnServerRaw(temp,true); - const char* cmd2 = temp.c_str(); - sprintf(cmd,"%s",cmd2); + string tmp = cmd; + FOREACH_MOD OnServerRaw(tmp,true); + const char* cmd2 = tmp.c_str(); + snprintf(cmd,512,"%s",cmd2); if (!strchr(cmd,' ')) { diff --git a/src/modules.cpp b/src/modules.cpp index bf13eb151..4452f0423 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -34,6 +34,7 @@ void Module::OnPacketTransmit(char *p) { } void Module::OnPacketReceive(char *p) { } void Module::OnRehash() { } void Module::OnServerRaw(string &raw, bool inbound) { } +bool Module::OnExtendedMode(char modechar, int type, bool mode_on, string_list ¶ms) { } Version Module::GetVersion() { return Version(1,0,0,0); } // server is a wrapper class that provides methods to all of the C-style @@ -160,6 +161,11 @@ ConfigReader::~ConfigReader() } +bool Server::AddExtendedMode(char modechar, int type, bool default_on, int params_when_on, int params_when_off) +{ +} + + ConfigReader::ConfigReader(string filename) : fname(filename) { }; string ConfigReader::ReadValue(string tag, string name, int index) -- cgit v1.2.3