Remove useless check for !nick from userhostbase callbacks

The userhostbase callback is always called with non-null nick.  Checking for
this is just noise which also sometimes results in odd compiler warnings.
This commit is contained in:
Kevin Easton
2015-06-24 23:20:53 +10:00
parent 05cf540a99
commit 28bd7a66b6
8 changed files with 53 additions and 57 deletions

View File

@@ -305,21 +305,19 @@ void userhost_unban(UserhostItem *stuff, char *nick1, char *args)
char *channel, *ip_str = NULL, *host = NULL;
int count = 0, old_server = from_server;
if (!stuff || !stuff->nick || !nick1 || !strcmp(stuff->user, "<UNKNOWN>") || my_stricmp(stuff->nick, nick1))
if (!stuff || !stuff->nick || !strcmp(stuff->user, "<UNKNOWN>") || my_stricmp(stuff->nick, nick1))
{
if (nick1 && (whowas = check_whowas_nick_buffer(nick1, args, 0)))
if ((whowas = check_whowas_nick_buffer(nick1, args, 0)))
{
malloc_sprintf(&host, "%s!%s", whowas->nicklist->nick, whowas->nicklist->host);
bitchsay("Using WhoWas info for unban of %s ", nick1);
n = whowas->nicklist;
}
else if (nick1)
else
{
bitchsay("No match for the unban of %s on %s", nick1, args);
return;
}
if (!nick1)
return;
}
else
malloc_sprintf(&host, "%s!%s@%s",stuff->nick, stuff->user, stuff->host);
@@ -371,9 +369,9 @@ void userhost_ban(UserhostItem *stuff, char *nick1, char *args)
fuck = !my_stricmp("FUCK", args);
set_ignore = !my_stricmp("BKI", args);
if (!stuff || !stuff->nick || !nick1 || !strcmp(stuff->user, "<UNKNOWN>") || my_stricmp(stuff->nick, nick1))
if (!stuff || !stuff->nick || !strcmp(stuff->user, "<UNKNOWN>") || my_stricmp(stuff->nick, nick1))
{
if (nick1 && channel && (whowas = check_whowas_nick_buffer(nick1, channel, 0)))
if (channel && (whowas = check_whowas_nick_buffer(nick1, channel, 0)))
{
nick = whowas->nicklist->nick;
user = m_strdup(clear_server_flags(whowas->nicklist->host));
@@ -382,7 +380,7 @@ void userhost_ban(UserhostItem *stuff, char *nick1, char *args)
bitchsay("Using WhoWas info for ban of %s ", nick1);
n = whowas->nicklist;
}
else if (nick1)
else
{
bitchsay("No match for the %s of %s on %s", fuck ? "Fuck":"Ban", nick1, channel);
return;
@@ -406,7 +404,7 @@ void userhost_ban(UserhostItem *stuff, char *nick1, char *args)
c = lookup_channel(channel, from_server, 0);
if (c && !n)
n = find_nicklist_in_channellist(nick, c, 0);
send_to_server("MODE %s %s %s %s", channel, on_chan ? ob : b, on_chan?nick:empty_string, ban_it(nick, user, host, (n && n->ip)?n->ip:NULL));
send_to_server("MODE %s %s %s %s", channel, on_chan ? ob : b, on_chan?nick:empty_string, ban_it(nick, user, host, n ? n->ip : NULL));
if (fuck)
{
malloc_sprintf(&str, "%s!*%s@%s %s 3 Auto-Shit", nick, user, host, channel);

View File

@@ -241,7 +241,7 @@ int i;
void userhost_clink(UserhostItem *stuff, char *nick, char *args)
{
if (!stuff || !stuff->nick || !nick || !strcmp(stuff->user, "<UNKNOWN>") || my_stricmp(stuff->nick, nick))
if (!stuff || !stuff->nick || !strcmp(stuff->user, "<UNKNOWN>") || my_stricmp(stuff->nick, nick))
{
bitchsay("No information for %s found", nick);
return;
@@ -886,16 +886,15 @@ char buffer[IRCD_BUFFER_SIZE+1];
void invite_dcc_chat(UserhostItem *stuff, char *nick, char *args)
{
char *id;
int idx = -1;
id = next_arg(args, &args);
idx = atol(id);
if (!stuff || !stuff->nick || !nick || !strcmp(stuff->user, "<UNKNOWN>") || my_stricmp(stuff->nick, nick))
{
char *id = next_arg(args, &args);
int idx = atol(id);
if (!stuff || !stuff->nick || !strcmp(stuff->user, "<UNKNOWN>") || my_stricmp(stuff->nick, nick))
{
if (check_dcc_socket(idx))
dcc_printf(idx, "No such for user %s\n", nick);
return;
}
dcc_printf(idx, "No such for user %s\n", nick);
return;
}
dcc_chat(NULL, nick);
send_to_server("NOTICE %s :You've been invited to a TwilightZone", nick);
send_to_server("NOTICE %s :Please type .chat in dcc chat to start", nick);

View File

@@ -870,7 +870,7 @@ BUILT_IN_COMMAND(dcc_stat_comm)
void handle_dcc_chat(UserhostItem *stuff, char *nick, char *args)
{
if (!stuff || !stuff->nick || !nick || !strcmp(stuff->user, "<UNKNOWN>") || !strcmp(stuff->host, "<UNKNOWN>"))
if (!stuff || !stuff->nick || !strcmp(stuff->user, "<UNKNOWN>") || !strcmp(stuff->host, "<UNKNOWN>"))
{
bitchsay("No such nick %s", nick);
return;

View File

@@ -458,9 +458,10 @@ DCC_List *find_dcc_pending(char *nick, char *desc, char *othername, int type, in
void add_userhost_to_chat(UserhostItem *stuff, char *nick, char *args)
{
SocketList *Client = NULL;
DCC_int *n = NULL;
if (!stuff || !nick || !stuff->nick || !stuff->user || !stuff->host || !strcmp(stuff->user, "<UNKNOWN>"))
SocketList *Client = NULL;
DCC_int *n = NULL;
if (!stuff || !stuff->nick || !stuff->user || !stuff->host || !strcmp(stuff->user, "<UNKNOWN>"))
return;
if ((Client = find_dcc(nick, "chat", NULL, DCC_CHAT, 0, -1, -1)))
n = (DCC_int *)get_socketinfo(Client->is_read);

View File

@@ -3078,17 +3078,16 @@ void userhost_nsl(UserhostItem *stuff, char *nick, char *args)
{
char *nsl = NULL;
if (!stuff || !stuff->nick || !nick || !strcmp(stuff->user, "<UNKNOWN>") || my_stricmp(stuff->nick, nick))
if (!stuff || !stuff->nick || !strcmp(stuff->user, "<UNKNOWN>") || my_stricmp(stuff->nick, nick))
{
say("No information for %s", nick);
return;
}
if(args)
if (args)
{
nsl = LOCAL_COPY(args);
next_arg(nsl, &nsl);
next_arg(args, &nsl);
}
nsl = do_nslookup(stuff->host, stuff->nick, stuff->user, NULL, from_server, NULL, (nsl && *nsl) ? nsl : NULL);
do_nslookup(stuff->host, stuff->nick, stuff->user, NULL, from_server, NULL, (nsl && *nsl) ? nsl : NULL);
}
#endif
@@ -3738,7 +3737,8 @@ void start_finger (UserhostItem *stuff, char *nick, char *args)
{
char *finger_userhost = NULL;
char *str;
if (!stuff || !stuff->nick || !nick || !strcmp(stuff->user, "<UNKNOWN>") || my_stricmp(stuff->nick, nick))
if (!stuff || !stuff->nick || !strcmp(stuff->user, "<UNKNOWN>") || my_stricmp(stuff->nick, nick))
{
say("No information for %s", nick);
return;
@@ -3819,16 +3819,15 @@ static int scan(char *remote_host, int low_port, int high_port, struct sockaddr_
void userhost_scanport(UserhostItem *stuff, char *nick, char *args)
{
char *t;
int low_port = 0,
high_port = 0;
struct sockaddr_foobar *host; /* gee, and what's this one for? */
char *t;
int low_port = 0, high_port = 0;
struct sockaddr_foobar *host; /* gee, and what's this one for? */
if (!stuff || !stuff->nick || !nick || !strcmp(stuff->user, "<UNKNOWN>") || my_stricmp(stuff->nick, nick))
{
bitchsay("No such nick [%s] found", nick);
return;
}
if (!stuff || !stuff->nick || !strcmp(stuff->user, "<UNKNOWN>") || my_stricmp(stuff->nick, nick))
{
bitchsay("No such nick [%s] found", nick);
return;
}
next_arg(args, &args);
t = next_arg(args, &args);
low_port = atol(t);
@@ -3892,9 +3891,9 @@ void userhost_ignore (UserhostItem *stuff, char *nick1, char *args)
WhowasList *whowas;
arg = next_arg(args, &args);
if (!stuff || !stuff->nick || !nick1 || !strcmp(stuff->user, "<UNKNOWN>") || my_stricmp(stuff->nick, nick1))
if (!stuff || !stuff->nick || !strcmp(stuff->user, "<UNKNOWN>") || my_stricmp(stuff->nick, nick1))
{
if ((whowas = check_whowas_nick_buffer(nick1, arg, 0)))
if ((whowas = check_whowas_nick_buffer(nick1, arg, 0)))
{
bitchsay("Using WhoWas info for %s of %s ", arg, nick1);
user = host; host = strchr(host, '@'); *host++ = 0;

View File

@@ -863,8 +863,9 @@ extern int use_nat_address;
void get_nat_address(UserhostItem *stuff, char *nick, char *args)
{
char *h;
if (!stuff || !stuff->nick || !nick || !strcmp(stuff->user, "<UNKNOWN"))
char *h;
if (!stuff || !stuff->nick || !strcmp(stuff->user, "<UNKNOWN"))
return;
if (isdigit((unsigned char)*stuff->host))
h = stuff->host;

View File

@@ -490,9 +490,9 @@ static int norm = 0,
return ret;
}
void whohas_nick (UserhostItem *stuff, char *nick, char *args)
void whohas_nick(UserhostItem *stuff, char *nick, char *args)
{
if (!stuff || !stuff->nick || !nick || !strcmp(stuff->user, "<UNKNOWN>"))
if (!stuff || !stuff->nick || !strcmp(stuff->user, "<UNKNOWN>"))
return;
put_it("%s", convert_output_format("$G Your nick %R[%n$0%R]%n is owned by %W$1@$2", "%s %s %s", nick, stuff->user, stuff->host));
return;

View File

@@ -214,12 +214,11 @@ void prepare_addshit(UserhostItem *stuff, char *nick, char *args)
char listbuf[BIG_BUFFER_SIZE+1];
int thetype = 0, shit = 0;
if (!stuff || !stuff->nick || !nick || !strcmp(stuff->user, "<UNKNOWN>") || my_stricmp(stuff->nick, nick))
{
bitchsay("No such nick [%s] found", nick);
return;
}
if (!stuff || !stuff->nick || !strcmp(stuff->user, "<UNKNOWN>") || my_stricmp(stuff->nick, nick))
{
bitchsay("No such nick [%s] found", nick);
return;
}
thetype = my_atol(args);
next_arg(args, &args);
@@ -271,24 +270,23 @@ int count = 0;
void prepare_adduser(UserhostItem *stuff, char *nick, char *args)
{
int thetype = 0;
unsigned long flags = 0;
int thetype = 0;
unsigned long flags = 0;
int ppp = 0;
UserList *uptr = NULL;
char *channels = NULL,
char *channels = NULL,
*passwd = NULL,
*p = NULL,
*uh,
*e_host,
*host;
if (!stuff || !stuff->nick || !nick || !strcmp(stuff->user, "<UNKNOWN>") || my_stricmp(stuff->nick, nick))
{
if (!stuff || !stuff->nick || !strcmp(stuff->user, "<UNKNOWN>") || my_stricmp(stuff->nick, nick))
{
bitchsay("No such nick [%s] found", nick);
return;
}
}
thetype = my_atol(args);
next_arg(args, &args);