diff options
author | trystan trystan@31f1291d-b8d6-0310-a050-a5561fc1590b <trystan trystan@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2004-12-02 06:06:47 +0000 |
---|---|---|
committer | trystan trystan@31f1291d-b8d6-0310-a050-a5561fc1590b <trystan trystan@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2004-12-02 06:06:47 +0000 |
commit | f18d506cad80b9ed28f02ee33f35332320f3ea04 (patch) | |
tree | 2d9d0cd5a48e4677dfefa114aca17e3f28926a79 /src/actions.c | |
parent | 541f11e4b80cbb2cc76da34fb2e1659b5e8b0090 (diff) |
BUILD : 1.7.6 (468) BUGS : N/A NOTES : 1. fixes del_session() warning when LimitSessions is disabled 2. actions.c is doxygen ready, along with code clean up 3. sessions.c cleaned up and moved some items around 4. ChanServ AKICK (pointed to freed memory) 5. servers.c is doxygen ready, along with some code clean up
git-svn-id: svn://svn.anope.org/anope/trunk@468 31f1291d-b8d6-0310-a050-a5561fc1590b
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@322 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/actions.c')
-rw-r--r-- | src/actions.c | 91 |
1 files changed, 64 insertions, 27 deletions
diff --git a/src/actions.c b/src/actions.c index c97eb9930..e7f8eac6a 100644 --- a/src/actions.c +++ b/src/actions.c @@ -16,46 +16,52 @@ /*************************************************************************/ -/* Note a bad password attempt for the given user. If they've used up - * their limit, toss them off. +/** + * Note a bad password attempt for the given user. If they've used up + * their limit, toss them off. + * @param u the User to check + * @return void */ - void bad_password(User * u) { time_t now = time(NULL); - if (!u) { + if (!u || !BadPassLimit) { return; } - if (!BadPassLimit) - return; - if (BadPassTimeout > 0 && u->invalid_pw_time > 0 && u->invalid_pw_time < now - BadPassTimeout) u->invalid_pw_count = 0; u->invalid_pw_count++; u->invalid_pw_time = now; - if (u->invalid_pw_count >= BadPassLimit) + if (u->invalid_pw_count >= BadPassLimit) { kill_user(NULL, u->nick, "Too many invalid passwords"); + } } /*************************************************************************/ -/* Remove a user from the IRC network. `source' is the nick which should - * generate the kill, or NULL for a server-generated kill. +/** + * Remove a user from the IRC network. + * @param source is the nick which should generate the kill, or NULL for a server-generated kill. + * @param user to remove + * @param reason for the kill + * @return void */ - void kill_user(char *source, char *user, char *reason) { char buf[BUFSIZE]; - if (!user || !*user) + if (!user || !*user) { return; - if (!source || !*source) + } + if (!source || !*source) { source = ServerName; - if (!reason) + } + if (!reason) { reason = ""; + } snprintf(buf, sizeof(buf), "%s (%s)", source, reason); @@ -68,31 +74,35 @@ void kill_user(char *source, char *user, char *reason) /*************************************************************************/ +/** + * Check and enforce SQlines + * @param mask of the sqline + * @param reason for the sqline + * @return void + */ void sqline(char *mask, char *reason) { + int i; + Channel *c, *next; + char *av[3]; + struct c_userlist *cu, *cunext; + if (ircd->chansqline) { if (*mask == '#') { - int i; - Channel *c, *next; - - char *av[3]; - struct c_userlist *cu, *cunext; - anope_cmd_sqline(mask, reason); for (i = 0; i < 1024; i++) { for (c = chanlist[i]; c; c = next) { next = c->next; - if (!match_wild_nocase(mask, c->name)) + if (!match_wild_nocase(mask, c->name)) { continue; - + } for (cu = c->users; cu; cu = cunext) { cunext = cu->next; - - if (is_oper(cu->user)) + if (is_oper(cu->user)) { continue; - + } av[0] = c->name; av[1] = cu->user->nick; av[2] = reason; @@ -112,6 +122,12 @@ void sqline(char *mask, char *reason) /*************************************************************************/ +/** + * Unban the nick from a channel + * @param ci channel info for the channel + * @param nick to remove the ban for + * @return void + */ void common_unban(ChannelInfo * ci, char *nick) { int count, i; @@ -119,11 +135,13 @@ void common_unban(ChannelInfo * ci, char *nick) User *u; char *host; - if (!ci || !ci->c || !nick) + if (!ci || !ci->c || !nick) { return; + } - if (!(u = finduser(nick))) + if (!(u = finduser(nick))) { return; + } host = host_resolve(u->host); @@ -157,6 +175,13 @@ void common_unban(ChannelInfo * ci, char *nick) /*************************************************************************/ +/** + * Prepare to set SVSMODE and update internal user modes + * @param u user to apply modes to + * @param modes the modes to set on the user + * @param arg the arguments for the user modes + * @return void + */ void common_svsmode(User * u, char *modes, char *arg) { int ac = 1; @@ -174,6 +199,12 @@ void common_svsmode(User * u, char *modes, char *arg) /*************************************************************************/ +/** + * Get the vhost for the user, if set else return the host, on ircds without + * vhost this returns the host + * @param u user to get the vhost for + * @return vhost + */ char *common_get_vhost(User * u) { if (!u) { @@ -192,6 +223,12 @@ char *common_get_vhost(User * u) /*************************************************************************/ +/** + * Get the vident for the user, if set else return the ident, on ircds without + * vident this returns the ident + * @param u user to get info the vident for + * @return vident + */ char *common_get_vident(User * u) { if (!u) { |