From 3a5a489f2504cc3660288b6984436163946f313a Mon Sep 17 00:00:00 2001 From: Kevin Easton Date: Wed, 22 Feb 2017 23:03:17 +1100 Subject: [PATCH] Add option to check_whowas_nick_buffer() to scan all channels in whowas list Passing NULL channel lets you scan the full whowas list, which is useful for functions not tied to a channel like ignore. --- source/whowas.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source/whowas.c b/source/whowas.c index d9ca2d5..1fe1d9a 100644 --- a/source/whowas.c +++ b/source/whowas.c @@ -76,21 +76,23 @@ extern WhowasList *check_whowas_buffer(char *nick, char *userhost, char *channel return tmp; } - +/* Search the whowas buffer for a nick and channel combination. NULL channel matches any channel. */ WhowasList *check_whowas_nick_buffer(const char *nick, const char *channel) { WhowasList *tmp = NULL; for (tmp = next_userhost(&whowas_userlist_list, NULL); tmp; tmp = next_userhost(&whowas_userlist_list, tmp)) { - if (!my_stricmp(tmp->nicklist->nick, nick) && !my_stricmp(tmp->channel, channel)) + if (!my_stricmp(tmp->nicklist->nick, nick) && + (!channel || !my_stricmp(tmp->channel, channel))) { return tmp; } } for (tmp = next_userhost(&whowas_reg_list, NULL); tmp; tmp = next_userhost(&whowas_reg_list, tmp)) { - if (!my_stricmp(tmp->nicklist->nick, nick) && !my_stricmp(tmp->channel, channel)) + if (!my_stricmp(tmp->nicklist->nick, nick) && + (!channel || !my_stricmp(tmp->channel, channel))) { return tmp; }