summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2006-03-09 00:39:13 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2006-03-09 00:39:13 +0000
commit60f91c5c3c313115dc4e92af9d728c493d8bc6aa (patch)
tree616f6768f108142bca9823b75a16b1109e8d7db0 /src
parentf6becbd4e6c07e2e316dc2b52a0616e42102b8f0 (diff)
More of the same cleanup :P
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3573 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/cmd_kick.cpp20
-rw-r--r--src/cmd_kill.cpp43
-rw-r--r--src/cmd_kline.cpp3
3 files changed, 37 insertions, 29 deletions
diff --git a/src/cmd_kick.cpp b/src/cmd_kick.cpp
index 8732dd7cf..9aaa96d1f 100644
--- a/src/cmd_kick.cpp
+++ b/src/cmd_kick.cpp
@@ -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);
}
diff --git a/src/cmd_kill.cpp b/src/cmd_kill.cpp
index 1ce7d8f5a..ac3f3686d 100644
--- a/src/cmd_kill.cpp
+++ b/src/cmd_kill.cpp
@@ -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]);
}
}
diff --git a/src/cmd_kline.cpp b/src/cmd_kline.cpp
index 370c3a45f..9c840b469 100644
--- a/src/cmd_kline.cpp
+++ b/src/cmd_kline.cpp
@@ -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