Enable use of cached whowas info for /IG* and /UNIG* commands
Previously these codepaths were dead because it was passing an argument like "+HOST" to check_whowas_nick_buffer() in place of the channel name, so it would never find anything. Now that function supports a NULL channel to mean "any channel", so we can use that. The actual code itself needed to be fixed as well, it's now similar to the way userhost_unban() is written.
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
[Changes 1.2.2]
|
[Changes 1.2.2]
|
||||||
|
|
||||||
|
* Enable use of cached whowas info for /IG* and /UNIG* commands. (caf)
|
||||||
|
|
||||||
* Add support for OpenSSL 1.1.0 to configure script. (caf)
|
* Add support for OpenSSL 1.1.0 to configure script. (caf)
|
||||||
|
|
||||||
* /UNBAN <nick> can use cached whowas info to unset bans. (caf)
|
* /UNBAN <nick> can use cached whowas info to unset bans. (caf)
|
||||||
|
|||||||
@@ -3830,42 +3830,46 @@ struct sockaddr_foobar *host;
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void userhost_ignore (UserhostItem *stuff, char *nick1, char *args)
|
void userhost_ignore (UserhostItem *uhi, char *nick1, char *args)
|
||||||
{
|
{
|
||||||
char *p, *arg;
|
char *p, *arg;
|
||||||
char *nick = NULL, *user = NULL, *host = NULL;
|
char *userhost_buf = NULL;
|
||||||
|
char *nick, *user, *host;
|
||||||
int old_window_display;
|
int old_window_display;
|
||||||
char ignorebuf[BIG_BUFFER_SIZE+1];
|
char ignorebuf[BIG_BUFFER_SIZE+1];
|
||||||
Ignore *igptr, *igtmp;
|
|
||||||
WhowasList *whowas;
|
WhowasList *whowas;
|
||||||
|
|
||||||
arg = next_arg(args, &args);
|
if (uhi && uhi->nick && strcmp(uhi->user, "<UNKNOWN>") && !my_stricmp(uhi->nick, nick1))
|
||||||
if (!stuff || !stuff->nick || !strcmp(stuff->user, "<UNKNOWN>") || my_stricmp(stuff->nick, nick1))
|
|
||||||
{
|
{
|
||||||
if ((whowas = check_whowas_nick_buffer(nick1, arg)))
|
nick = uhi->nick;
|
||||||
|
user = uhi->user;
|
||||||
|
host = uhi->host;
|
||||||
|
}
|
||||||
|
else if ((whowas = check_whowas_nick_buffer(nick1, NULL)))
|
||||||
{
|
{
|
||||||
bitchsay("Using WhoWas info for %s of %s ", arg, nick1);
|
|
||||||
user = host; host = strchr(host, '@'); *host++ = 0;
|
|
||||||
nick = whowas->nicklist->nick;
|
nick = whowas->nicklist->nick;
|
||||||
|
user = userhost_buf = m_strdup(whowas->nicklist->host);
|
||||||
|
host = strchr(user, '@');
|
||||||
|
*host++ = 0;
|
||||||
|
bitchsay("Using WhoWas info for (un)ignore of %s", nick1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
say("No match for user %s", nick1);
|
say("No match for user %s", nick1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
user = clear_server_flags(user);
|
||||||
else
|
|
||||||
{
|
arg = next_arg(args, &args);
|
||||||
user = clear_server_flags(stuff->user);
|
|
||||||
host = stuff->host; nick = stuff->nick;
|
|
||||||
}
|
|
||||||
if (!arg || !*arg || !my_stricmp(arg, "+HOST"))
|
if (!arg || !*arg || !my_stricmp(arg, "+HOST"))
|
||||||
sprintf(ignorebuf, "*!*@%s ALL -CRAP -PUBLIC", cluster(host));
|
sprintf(ignorebuf, "*!*@%s ALL -CRAP -PUBLIC", cluster(host));
|
||||||
else if (!my_stricmp(arg, "+USER"))
|
else if (!my_stricmp(arg, "+USER"))
|
||||||
sprintf(ignorebuf, "*%s@%s ALL -CRAP -PUBLIC", user, cluster(host));
|
sprintf(ignorebuf, "*%s@%s ALL -CRAP -PUBLIC", user, cluster(host));
|
||||||
else if (!my_stricmp(arg, "-USER") || !my_stricmp(arg, "-HOST"))
|
else if (!my_stricmp(arg, "-USER") || !my_stricmp(arg, "-HOST"))
|
||||||
{
|
{
|
||||||
|
Ignore *igptr, *igtmp;
|
||||||
int found = 0;
|
int found = 0;
|
||||||
|
|
||||||
if (!my_stricmp(arg, "-HOST"))
|
if (!my_stricmp(arg, "-HOST"))
|
||||||
sprintf(ignorebuf, "*!*@%s", cluster(host));
|
sprintf(ignorebuf, "*!*@%s", cluster(host));
|
||||||
else
|
else
|
||||||
@@ -3889,6 +3893,7 @@ void userhost_ignore (UserhostItem *stuff, char *nick1, char *args)
|
|||||||
}
|
}
|
||||||
if (!found)
|
if (!found)
|
||||||
bitchsay("No ignore matching %s found", nick);
|
bitchsay("No ignore matching %s found", nick);
|
||||||
|
new_free(&userhost_buf);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
old_window_display = window_display;
|
old_window_display = window_display;
|
||||||
@@ -3904,6 +3909,7 @@ void userhost_ignore (UserhostItem *stuff, char *nick1, char *args)
|
|||||||
if ((p = strchr(ignorebuf, ' ')))
|
if ((p = strchr(ignorebuf, ' ')))
|
||||||
*p = 0;
|
*p = 0;
|
||||||
say("Now ignoring ALL except CRAP and PUBLIC from %s", ignorebuf);
|
say("Now ignoring ALL except CRAP and PUBLIC from %s", ignorebuf);
|
||||||
|
new_free(&userhost_buf);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user