summaryrefslogtreecommitdiff
path: root/src/irc/core
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2002-03-31 12:04:57 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2002-03-31 12:04:57 +0000
commitdc4b7456dcb1f6806b7a68188cb4f1db78bf75c3 (patch)
tree699a0d0043ceecbc5cf713223e18bd2186821d65 /src/irc/core
parent230735f18bf10d0aeb7918956c82cf1d6576e06e (diff)
downloadirssi-dc4b7456dcb1f6806b7a68188cb4f1db78bf75c3.zip
with 10 char usernames, ban "*234567890" instead of "*12345678*"
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2647 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/irc/core')
-rw-r--r--src/irc/core/bans.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/irc/core/bans.c b/src/irc/core/bans.c
index 159e56c9..4412efe7 100644
--- a/src/irc/core/bans.c
+++ b/src/irc/core/bans.c
@@ -45,6 +45,7 @@ char *ban_get_mask(IRC_CHANNEL_REC *channel, const char *nick, int ban_type)
{
NICK_REC *rec;
char *str, *user, *host;
+ int size;
g_return_val_if_fail(IS_IRC_CHANNEL(channel), NULL);
g_return_val_if_fail(nick != NULL, NULL);
@@ -59,17 +60,18 @@ char *ban_get_mask(IRC_CHANNEL_REC *channel, const char *nick, int ban_type)
/* there's a limit of 10 characters in user mask. so, banning
someone with user mask of 10 characters gives us "*1234567890",
- which is one too much.. so, replace the 10th character with '*' */
+ which is one too much.. so, remove the first character after "*"
+ so we'll get "*234567890" */
user = strchr(str, '!');
if (user == NULL) return str;
host = strchr(++user, '@');
if (host == NULL) return str;
- if ((int) (host-user) >= 10) {
+ size = (int) (host-user);
+ if (size >= 10) {
/* too long user mask */
- user[9] = '*';
- g_memmove(user+10, host, strlen(host)+1);
+ g_memmove(user+1, user+(size-9), strlen(user+(size-9))+1);
}
return str;
}