mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-10 19:19:02 -04:00
More of the same cleanup :P
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3573 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
parent
f6becbd4e6
commit
60f91c5c3c
@ -42,31 +42,31 @@ using namespace std;
|
||||
void cmd_kick::Handle (char **parameters, int pcnt, userrec *user)
|
||||
{
|
||||
char reason[MAXKICK];
|
||||
|
||||
chanrec* Ptr = FindChan(parameters[0]);
|
||||
chanrec* c = FindChan(parameters[0]);
|
||||
userrec* u = Find(parameters[1]);
|
||||
|
||||
if (!u || !Ptr)
|
||||
if (!u || !c)
|
||||
{
|
||||
WriteServ(user->fd,"401 %s %s :No such nick/channel",user->nick, u ? parameters[0] : parameters[1]);
|
||||
WriteServ(user->fd, "401 %s %s :No such nick/channel", user->nick, u ? parameters[0] : parameters[1]);
|
||||
return;
|
||||
}
|
||||
if ((IS_LOCAL(user)) && (!Ptr->HasUser(user)) && (!is_uline(user->server)))
|
||||
|
||||
if ((IS_LOCAL(user)) && (!c->HasUser(user)) && (!is_uline(user->server)))
|
||||
{
|
||||
WriteServ(user->fd,"442 %s %s :You're not on that channel!",user->nick, parameters[0]);
|
||||
WriteServ(user->fd, "442 %s %s :You're not on that channel!", user->nick, parameters[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
if (pcnt > 2)
|
||||
{
|
||||
strlcpy(reason,parameters[2],MAXKICK-1);
|
||||
kick_channel(user,u,Ptr,reason);
|
||||
strlcpy(reason, parameters[2], MAXKICK - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
strlcpy(reason,user->nick,MAXKICK-1);
|
||||
kick_channel(user,u,Ptr,reason);
|
||||
strlcpy(reason, user->nick, MAXKICK - 1);
|
||||
}
|
||||
|
||||
kick_channel(user, u, c, reason);
|
||||
}
|
||||
|
||||
|
||||
|
@ -50,52 +50,57 @@ void cmd_kill::Handle (char **parameters, int pcnt, userrec *user)
|
||||
{
|
||||
userrec *u = Find(parameters[0]);
|
||||
char killreason[MAXBUF];
|
||||
int MOD_RESULT = 0;
|
||||
|
||||
log(DEBUG,"kill: %s %s", parameters[0], parameters[1]);
|
||||
|
||||
log(DEBUG,"kill: %s %s",parameters[0],parameters[1]);
|
||||
if (u)
|
||||
{
|
||||
log(DEBUG,"into kill mechanism");
|
||||
int MOD_RESULT = 0;
|
||||
FOREACH_RESULT(I_OnKill,OnKill(user,u,parameters[1]));
|
||||
if (MOD_RESULT) {
|
||||
log(DEBUG,"A module prevented the kill with result %d",MOD_RESULT);
|
||||
log(DEBUG, "into kill mechanism");
|
||||
FOREACH_RESULT(I_OnKill, OnKill(user, u, parameters[1]));
|
||||
|
||||
if (MOD_RESULT)
|
||||
{
|
||||
log(DEBUG, "A module prevented the kill with result %d", MOD_RESULT);
|
||||
return;
|
||||
}
|
||||
|
||||
if (u->fd < 0)
|
||||
if (!IS_LOCAL(u))
|
||||
{
|
||||
// remote kill
|
||||
WriteOpers("*** Remote kill by %s: %s!%s@%s (%s)",user->nick,u->nick,u->ident,u->host,parameters[1]);
|
||||
snprintf(killreason,MAXBUF,"[%s] Killed (%s (%s))",Config->ServerName,user->nick,parameters[1]);
|
||||
WriteCommonExcept(u,"QUIT :%s",killreason);
|
||||
|
||||
FOREACH_MOD(I_OnRemoteKill,OnRemoteKill(user,u,killreason));
|
||||
WriteOpers("*** Remote kill by %s: %s!%s@%s (%s)", user->nick, u->nick, u->ident, u->host, parameters[1]);
|
||||
snprintf(killreason, MAXBUF,"[%s] Killed (%s (%s))", Config->ServerName, user->nick, parameters[1]);
|
||||
WriteCommonExcept(u, "QUIT :%s", killreason);
|
||||
FOREACH_MOD(I_OnRemoteKill, OnRemoteKill(user, u, killreason));
|
||||
|
||||
user_hash::iterator iter = clientlist.find(u->nick);
|
||||
|
||||
if (iter != clientlist.end())
|
||||
{
|
||||
log(DEBUG,"deleting user hash value %d",iter->second);
|
||||
log(DEBUG,"deleting user hash value %d", iter->second);
|
||||
clientlist.erase(iter);
|
||||
}
|
||||
|
||||
if (u->registered == 7)
|
||||
{
|
||||
purge_empty_chans(u);
|
||||
}
|
||||
|
||||
delete u;
|
||||
}
|
||||
else
|
||||
{
|
||||
// local kill
|
||||
log(DEFAULT,"LOCAL KILL: %s :%s!%s!%s (%s)", u->nick, Config->ServerName,user->dhost,user->nick,parameters[1]);
|
||||
WriteTo(user, u, "KILL %s :%s!%s!%s (%s)", u->nick, Config->ServerName,user->dhost,user->nick,parameters[1]);
|
||||
WriteOpers("*** Local Kill by %s: %s!%s@%s (%s)",user->nick,u->nick,u->ident,u->host,parameters[1]);
|
||||
snprintf(killreason,MAXBUF,"Killed (%s (%s))",user->nick,parameters[1]);
|
||||
kill_link(u,killreason);
|
||||
log(DEFAULT,"LOCAL KILL: %s :%s!%s!%s (%s)", u->nick, Config->ServerName, user->dhost, user->nick, parameters[1]);
|
||||
WriteTo(user, u, "KILL %s :%s!%s!%s (%s)", u->nick, Config->ServerName, user->dhost, user->nick, parameters[1]);
|
||||
WriteOpers("*** Local Kill by %s: %s!%s@%s (%s)", user->nick, u->nick, u->ident, u->host, parameters[1]);
|
||||
snprintf(killreason,MAXBUF,"Killed (%s (%s))", user->nick, parameters[1]);
|
||||
kill_link(u, killreason);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteServ(user->fd,"401 %s %s :No such nick/channel",user->nick, parameters[0]);
|
||||
WriteServ(user->fd, "401 %s %s :No such nick/channel", user->nick, parameters[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -68,8 +68,10 @@ void cmd_kline::Handle (char **parameters, int pcnt, userrec *user)
|
||||
{
|
||||
if (host_matches_everyone(parameters[0],user))
|
||||
return;
|
||||
|
||||
add_kline(duration(parameters[1]),user->nick,parameters[2],parameters[0]);
|
||||
FOREACH_MOD(I_OnAddKLine,OnAddKLine(duration(parameters[1]), user, parameters[2], parameters[0]));
|
||||
|
||||
if (!duration(parameters[1]))
|
||||
{
|
||||
WriteOpers("*** %s added permenant K-line for %s.",user->nick,parameters[0]);
|
||||
@ -78,6 +80,7 @@ void cmd_kline::Handle (char **parameters, int pcnt, userrec *user)
|
||||
{
|
||||
WriteOpers("*** %s added timed K-line for %s, expires in %d seconds.",user->nick,parameters[0],duration(parameters[1]));
|
||||
}
|
||||
|
||||
apply_lines(APPLY_KLINES);
|
||||
}
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user