summaryrefslogtreecommitdiff
path: root/src/inspircd.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2003-04-18 19:03:21 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2003-04-18 19:03:21 +0000
commit7493cbb6b96253da72eae375acc7b4d0d309122c (patch)
tree88807526a885d1751b2fc29d97054e91e4fe4c2e /src/inspircd.cpp
parent799cda68778e3b2fc81a599d1b6d00813707dfa4 (diff)
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
Diffstat (limited to 'src/inspircd.cpp')
-rw-r--r--src/inspircd.cpp31
1 files changed, 20 insertions, 11 deletions
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,' '))
{