summaryrefslogtreecommitdiff
path: root/src/irc/core/bans.c
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2000-05-04 10:32:42 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2000-05-04 10:32:42 +0000
commitd3dc9a1307adc40425bf162f1f867a39e535f501 (patch)
treed3c92a8e431391d679ae5341cb4e865f00449761 /src/irc/core/bans.c
parentbacfcb060c1b687f70db4d59797e1cbc8bfe0f62 (diff)
downloadirssi-d3dc9a1307adc40425bf162f1f867a39e535f501.zip
.. lots of changes ..
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@197 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/irc/core/bans.c')
-rw-r--r--src/irc/core/bans.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/irc/core/bans.c b/src/irc/core/bans.c
index 962c3c8d..4108f1bd 100644
--- a/src/irc/core/bans.c
+++ b/src/irc/core/bans.c
@@ -55,7 +55,7 @@ char *ban_get_mask(CHANNEL_REC *channel, const char *nick)
host = strchr(++user, '@');
if (host == NULL) return str;
- if ((int) (host-user) < 10) {
+ if ((int) (host-user) > 10) {
/* too long user mask */
user[9] = '*';
g_memmove(user+10, host, strlen(host)+1);
@@ -112,7 +112,7 @@ void ban_set_type(const char *type)
void ban_set(CHANNEL_REC *channel, const char *bans)
{
GString *str;
- char **ban, **banlist;
+ char **ban, **banlist, *realban;
g_return_if_fail(bans != NULL);
@@ -121,19 +121,20 @@ void ban_set(CHANNEL_REC *channel, const char *bans)
for (ban = banlist; *ban != NULL; ban++) {
if (strchr(*ban, '!') != NULL) {
/* explicit ban */
- g_string_sprintfa(str, " %s", *ban);
+ g_string_sprintfa(str, "%s ", *ban);
continue;
}
/* ban nick */
- *ban = ban_get_mask(channel, *ban);
- if (*ban != NULL) {
- g_string_sprintfa(str, " %s", *ban);
- g_free(*ban);
+ realban = ban_get_mask(channel, *ban);
+ if (realban != NULL) {
+ g_string_sprintfa(str, "%s ", realban);
+ g_free(realban);
}
}
g_strfreev(banlist);
+ g_string_truncate(str, str->len-1);
channel_set_singlemode(channel->server, channel->name, str->str, "+b");
g_string_free(str, TRUE);
}
@@ -169,7 +170,7 @@ static void command_set_ban(const char *data, IRC_SERVER_REC *server, WI_IRC_REC
if (server == NULL || !server->connected || !irc_server_check(server))
cmd_return_error(CMDERR_NOT_CONNECTED);
- params = cmd_get_params(data, 3 | PARAM_FLAG_OPTCHAN | PARAM_FLAG_GETREST,
+ params = cmd_get_params(data, 2 | PARAM_FLAG_OPTCHAN | PARAM_FLAG_GETREST,
item, &channel, &nicks);
if (!ischannel(*channel)) cmd_param_error(CMDERR_NOT_JOINED);
if (*nicks == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);