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
This commit is contained in:
brain 2003-04-18 19:03:21 +00:00
parent 799cda6877
commit 7493cbb6b9
3 changed files with 29 additions and 14 deletions

View File

@ -13,9 +13,9 @@ LeftChar=1
[Editor_1] [Editor_1]
Open=1 Open=1
Top=1 Top=1
CursorCol=25 CursorCol=1
CursorRow=3672 CursorRow=3902
TopLine=3433 TopLine=3851
LeftChar=1 LeftChar=1
[Editor_2] [Editor_2]

View File

@ -2982,23 +2982,32 @@ void handle_quit(char **parameters, int pcnt, userrec *user)
void handle_who(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 */ /* theres more to do here, but for now just close the socket */
if (pcnt == 1) if (pcnt == 1)
{ {
if ((!strcmp(parameters[0],"0")) || (!strcmp(parameters[0],"*"))) if ((!strcmp(parameters[0],"0")) || (!strcmp(parameters[0],"*")))
{ {
Ptr = user->chans[0].channel; if (user->chans[0].channel)
printf(user->chans[0].channel->name);
for (user_hash::const_iterator i = clientlist.begin(); i != clientlist.end(); i++)
{ {
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; return;
} }
if (parameters[0][0] = '#') if (parameters[0][0] = '#')
@ -3666,10 +3675,10 @@ void process_command(userrec *user, char* cmd)
} }
strcpy(temp,cmd); strcpy(temp,cmd);
string temp = cmd; string tmp = cmd;
FOREACH_MOD OnServerRaw(temp,true); FOREACH_MOD OnServerRaw(tmp,true);
const char* cmd2 = temp.c_str(); const char* cmd2 = tmp.c_str();
sprintf(cmd,"%s",cmd2); snprintf(cmd,512,"%s",cmd2);
if (!strchr(cmd,' ')) if (!strchr(cmd,' '))
{ {

View File

@ -34,6 +34,7 @@ void Module::OnPacketTransmit(char *p) { }
void Module::OnPacketReceive(char *p) { } void Module::OnPacketReceive(char *p) { }
void Module::OnRehash() { } void Module::OnRehash() { }
void Module::OnServerRaw(string &raw, bool inbound) { } void Module::OnServerRaw(string &raw, bool inbound) { }
bool Module::OnExtendedMode(char modechar, int type, bool mode_on, string_list &params) { }
Version Module::GetVersion() { return Version(1,0,0,0); } Version Module::GetVersion() { return Version(1,0,0,0); }
// server is a wrapper class that provides methods to all of the C-style // 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) { }; ConfigReader::ConfigReader(string filename) : fname(filename) { };
string ConfigReader::ReadValue(string tag, string name, int index) string ConfigReader::ReadValue(string tag, string name, int index)