From 2c79e8e1cc34e40f3be7d2f5fff523a5f3529fc2 Mon Sep 17 00:00:00 2001 From: michael Date: Mon, 22 Dec 2014 18:34:34 +0000 Subject: [PATCH] - Use EmptyString() instead of this strlen() mess git-svn-id: svn://svn.ircd-hybrid.org/svnroot/hopm/trunk@5077 82007160-df01-0410-b94d-b575c5fd34c7 --- src/dnsbl.c | 3 ++- src/irc.c | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/dnsbl.c b/src/dnsbl.c index 8a36a0c..a8b1b69 100644 --- a/src/dnsbl.c +++ b/src/dnsbl.c @@ -45,6 +45,7 @@ along with this program; if not, write to the Free Software #include "list.h" #include "log.h" #include "malloc.h" +#include "match.h" #include "scan.h" #include "irc.h" #include "stats.h" @@ -240,7 +241,7 @@ void dnsbl_report(struct scan_struct *ss) if(ss->ip == NULL) return; - if(strlen(OpmItem->dnsbl_to) == 0 || strlen(OpmItem->dnsbl_from) == 0 || strlen(OpmItem->sendmail) == 0) + if (EmptyString(OpmItem->dnsbl_to) || EmptyString(OpmItem->dnsbl_from) || EmptyString(OpmItem->sendmail)) return; diff --git a/src/irc.c b/src/irc.c index b95fd61..cc32cd4 100644 --- a/src/irc.c +++ b/src/irc.c @@ -272,7 +272,7 @@ static void irc_init(void) } /* Bind */ - if (strlen(IRCItem->vhost) > 0) + if (!EmptyString(IRCItem->vhost)) { int bindret = 0; if (!inet_pton(AF_INET, IRCItem->vhost, &(IRC_LOCAL.in4.s_addr))) @@ -430,7 +430,7 @@ static void irc_connect(void) irc_send("NICK %s", IRCItem->nick); - if(strlen(IRCItem->password) > 0) + if (!EmptyString(IRCItem->password)) irc_send("PASS %s", IRCItem->password); irc_send("USER %s %s %s :%s", @@ -804,7 +804,7 @@ static void m_perform(char **parv, unsigned int parc, char *msg, struct UserInfo log_printf("IRC -> Connected to %s:%d", IRCItem->server, IRCItem->port); /* Identify to nickserv if needed */ - if(strlen(IRCItem->nickserv)) + if (!EmptyString(IRCItem->nickserv)) irc_send("%s", IRCItem->nickserv); /* Oper */ @@ -825,10 +825,10 @@ static void m_perform(char **parv, unsigned int parc, char *msg, struct UserInfo { channel = (struct ChannelConf *) node->data; - if(strlen(channel->name) == 0) + if (EmptyString(channel->name)) continue; - if(strlen(channel->key) > 0) + if (!EmptyString(channel->key)) irc_send("JOIN %s %s", channel->name, channel->key); else irc_send("JOIN %s", channel->name); @@ -1117,7 +1117,7 @@ static void m_cannot_join(char **parv, unsigned int parc, char *msg, if((channel = get_channel(parv[3])) == NULL) return; - if(strlen(channel->invite) == 0) + if (EmptyString(channel->invite)) return; irc_send("%s", channel->invite); -- 2.30.2