diff options
| author | dane dane@31f1291d-b8d6-0310-a050-a5561fc1590b <dane dane@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2004-09-29 20:19:18 +0000 |
|---|---|---|
| committer | dane dane@31f1291d-b8d6-0310-a050-a5561fc1590b <dane dane@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2004-09-29 20:19:18 +0000 |
| commit | 676b8eaf7fcec02ad2583dc0bcc531942b65068e (patch) | |
| tree | d8405dc99f4b8a50935452374b7afc983dfde641 /src/users.c | |
| parent | b6f83ea4db94339449c05be946477b729e9b991a (diff) | |
BUILD : 1.7.5 (362) BUGS : 17 143 147 166 172 173 NOTES : Applied patch 927 provided by Trystan.
git-svn-id: svn://svn.anope.org/anope/trunk@362 31f1291d-b8d6-0310-a050-a5561fc1590b
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@233 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/users.c')
| -rw-r--r-- | src/users.c | 68 |
1 files changed, 63 insertions, 5 deletions
diff --git a/src/users.c b/src/users.c index a3b4fa8fe..bcbc56b69 100644 --- a/src/users.c +++ b/src/users.c @@ -383,6 +383,12 @@ User *do_nick(const char *source, char *nick, char *username, char *host, if (debug) alog("debug: new user: %s", nick); + if (ircd->nickip && ip) { + addr.s_addr = htonl(ip); + ntoa(addr, ipbuf, sizeof(ipbuf)); + } + + if (LogUsers) { /** * Ugly swap routine for Flop's bug :) @@ -398,11 +404,6 @@ User *do_nick(const char *source, char *nick, char *username, char *host, * End of ugly swap **/ - if (ircd->nickip) { - addr.s_addr = htonl(ip); - ntoa(addr, ipbuf, sizeof(ipbuf)); - } - if (ircd->nickvhost) { if (ircd->nickip) { alog("LOGUSERS: %s (%s@%s => %s) (%s) [%s] connected to the network (%s).", nick, username, host, vhost, realname, ipbuf, server); @@ -647,6 +648,24 @@ void do_umode(const char *source, int ac, char **av) anope_set_umode(user, ac - 1, &av[1]); } +/* Handle a UMODE2 command for a user. + * av[0] = modes + */ + +void do_umode2(const char *source, int ac, char **av) +{ + User *user; + + user = finduser(source); + if (!user) { + alog("user: MODE %s for nonexistent nick %s: %s", av[0], source, + merge_args(ac, av)); + return; + } + + anope_set_umode(user, ac - 1, &av[0]); +} + /*************************************************************************/ /* Handle a QUIT command. @@ -835,6 +854,45 @@ int match_usermask(const char *mask, User * user) return result; } + +/*************************************************************************/ + +/* simlar to match_usermask, except here we pass the host as the IP */ + +int match_userip(const char *mask, User * user, char *iphost) +{ + char *mask2 = sstrdup(mask); + char *nick, *username, *host; + int result; + + if (strchr(mask2, '!')) { + nick = strtok(mask2, "!"); + username = strtok(NULL, "@"); + } else { + nick = NULL; + username = strtok(mask2, "@"); + } + host = strtok(NULL, ""); + if (!username || !host) { + free(mask2); + return 0; + } + + if (nick) { + result = match_wild_nocase(nick, user->nick) + && match_wild_nocase(username, user->username) + && (match_wild_nocase(host, iphost) + || match_wild_nocase(host, user->vhost)); + } else { + result = match_wild_nocase(username, user->username) + && (match_wild_nocase(host, iphost) + || match_wild_nocase(host, user->vhost)); + } + + free(mask2); + return result; +} + /*************************************************************************/ /* Split a usermask up into its constitutent parts. Returned strings are |
