* more whitch-hunt on strlen with isemptystr replacement.
authorWilfried Göesgens <willi@citadel.org>
Thu, 9 Aug 2007 17:48:01 +0000 (17:48 +0000)
committerWilfried Göesgens <willi@citadel.org>
Thu, 9 Aug 2007 17:48:01 +0000 (17:48 +0000)
22 files changed:
citadel/.cvsignore [deleted file]
citadel/modules/autocompletion/serv_autocompletion.c
citadel/modules/calendar/serv_calendar.c
citadel/modules/chat/serv_chat.c
citadel/modules/funambol/serv_funambol.c
citadel/modules/imap/imap_acl.c
citadel/modules/imap/imap_fetch.c
citadel/modules/imap/imap_list.c
citadel/modules/imap/imap_misc.c
citadel/modules/imap/imap_tools.c
citadel/modules/imap/serv_imap.c
citadel/modules/inetcfg/serv_inetcfg.c
citadel/modules/ldap/serv_ldap.c
citadel/modules/listsub/serv_listsub.c
citadel/modules/managesieve/serv_managesieve.c
citadel/modules/network/serv_network.c
citadel/modules/notes/serv_notes.c
citadel/modules/rwho/serv_rwho.c
citadel/modules/sieve/serv_sieve.c
citadel/modules/smtp/serv_smtp.c
citadel/modules/vandelay/serv_vandelay.c
citadel/modules/vcard/serv_vcard.c

diff --git a/citadel/.cvsignore b/citadel/.cvsignore
deleted file mode 100644 (file)
index 6977412..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-*.diff
-*.patch
-*.d
-*.lo
-*.mo
-*.ro
-*.socket
-.AppleDouble
-.libs
-Makefile
-aclocal.m4
-aidepost
-autom4te.cache
-autom4te-2.53.cache
-base64
-chkpwd
-citadel
-citadel.config
-citadel.control
-citadel.log
-citlogin
-citmail
-citserver
-citserver.log
-config.cache
-config.h.in
-config.log
-config.status
-configure
-data
-icq
-import
-libcitserver.la
-libtool
-mailinglist
-migratenet
-msgform
-netconfigs
-netmailer
-netpoll
-netproc
-netsetup
-parsedate.c
-proxy
-qpdecode
-rcit
-readlog
-sendcommand
-setup
-so_locations
-stats
-stress
-sysdep.h
-sysdep.h.in
-sysoputil
-useradmin
-userlist
-weekly
-whobbs
-ltmain.sh
-configure.lineno
-config.sub
-config.guess
-openldap-data
-keys
-bio
-bitbucket
-citadel-easyinstall.sum
-files
-gmon.out
-images
-info
-network
-network/spoolin
-network/spoolout
-network/systems
-userpics
-citadel.pid
index 5d593e897864accbf65dbb986ddb25bd2ff7f846..5aaedd8cbfa875caed9616f9941759bca84c8959 100644 (file)
@@ -176,7 +176,7 @@ void cmd_auto(char *argbuf) {
                
        if (CtdlAccessCheck(ac_logged_in)) return;
        extract_token(search_string, argbuf, 0, '|', sizeof search_string);
-       if (strlen(search_string) == 0) {
+       if (IsEmptyStr(search_string)) {
                cprintf("%d You supplied an empty partial.\n",
                        ERROR + ILLEGAL_VALUE);
                return;
index de35044412af7d29c44c283cb159b2e309bc9464..619194cf0e28c676339f559074bb0045a9c0591e 100644 (file)
@@ -1955,14 +1955,14 @@ int ical_obj_beforesave(struct CtdlMessage *msg)
                0
        );
 
-       if (strlen(imm.uid) > 0) {
+       if (!IsEmptyStr(imm.uid)) {
                if (msg->cm_fields['E'] != NULL) {
                        free(msg->cm_fields['E']);
                }
                msg->cm_fields['E'] = strdup(imm.uid);
                lprintf(CTDL_DEBUG, "Saving calendar UID <%s>\n", msg->cm_fields['E']);
        }
-       if (strlen(imm.subject) > 0) {
+       if (!IsEmptyStr(imm.subject)) {
                if (msg->cm_fields['U'] != NULL) {
                        free(msg->cm_fields['U']);
                }
index a34f7efc390ce2f2032ccc15918657942a8a7307..fff6640fe55f9156af8f546238e2c0202ec48adf 100644 (file)
@@ -184,7 +184,7 @@ void do_chat_listing(int allflag)
 
                GenerateRoomDisplay(roomname, ccptr, CC);
                if ((CC->user.axlevel < 6)
-                  && (strlen(ccptr->fake_roomname)>0)) {
+                  && (!IsEmptyStr(ccptr->fake_roomname))) {
                        strcpy(roomname, ccptr->fake_roomname);
                }
 
@@ -204,7 +204,7 @@ void do_chat_listing(int allflag)
 
                        GenerateRoomDisplay(roomname, ccptr, CC);
                        if ((CC->user.axlevel < 6)
-                       && (strlen(ccptr->fake_roomname)>0)) {
+                       && (!IsEmptyStr(ccptr->fake_roomname))) {
                                strcpy(roomname, ccptr->fake_roomname);
                        }
 
@@ -282,7 +282,7 @@ void cmd_chat(char *argbuf)
                }
 
                /* if we have a complete line, do send processing */
-               if (strlen(cmdbuf) > 0)
+               if (!IsEmptyStr(cmdbuf))
                        if (cmdbuf[strlen(cmdbuf) - 1] == 10) {
                                cmdbuf[strlen(cmdbuf) - 1] = 0;
                                time(&CC->lastcmd);
@@ -644,7 +644,7 @@ int send_instant_message(char *lun, char *x_user, char *x_msg)
                msgnum = CtdlSubmitMsg(logmsg, NULL, PAGELOGROOM);
 
                /* Now save a copy in the global log room, if configured */
-               if (strlen(config.c_logpages) > 0) {
+               if (!IsEmptyStr(config.c_logpages)) {
                        create_room(config.c_logpages, 3, "", 0, 1, 1, VIEW_BBS);
                        CtdlSaveMsgPointerInRoom(config.c_logpages, msgnum, 0, NULL);
                }
@@ -722,7 +722,7 @@ void cmd_sexp(char *argbuf)
                      strcmp(x_msg, "000")) {
                        x_big_msgbuf = realloc(x_big_msgbuf,
                               strlen(x_big_msgbuf) + strlen(x_msg) + 4);
-                       if (strlen(x_big_msgbuf) > 0)
+                       if (!IsEmptyStr(x_big_msgbuf))
                           if (x_big_msgbuf[strlen(x_big_msgbuf)] != '\n')
                                strcat(x_big_msgbuf, "\n");
                        strcat(x_big_msgbuf, x_msg);
@@ -735,7 +735,7 @@ void cmd_sexp(char *argbuf)
                message_sent = PerformXmsgHooks(lun, x_user, x_msg);
 
                if (message_sent > 0) {
-                       if (strlen(x_msg) > 0)
+                       if (!IsEmptyStr(x_msg))
                                cprintf("%d Message sent", CIT_OK);
                        else
                                cprintf("%d Ok to send message", CIT_OK);
index 561be098664567f7c88a7d2eb3364b23573836cd..827bdb7172901eb320259e80c0b2acd5de998089 100644 (file)
@@ -112,7 +112,7 @@ void notify_funambol(long msgnum, void *userdata) {
                goto nuke;
        }
        /* Are we allowed to push? */
-       if ( strlen(config.c_funambol_host) == 0) {
+       if (IsEmptyStr(config.c_funambol_host)) {
                goto nuke;
        } else {
                lprintf(CTDL_INFO, "Push enabled\n");
index 1632532db3675e21f73983dc17a03295fad1b946..369afce88e896a53d7d693075bcdb6ae73150c0d 100644 (file)
@@ -176,9 +176,9 @@ void imap_getacl(int num_parms, char *parms[]) {
                cdb_free(cdbus);
 
                CtdlRoomAccess(&CC->room, &temp, &ra, NULL);
-               if (strlen(temp.fullname) > 0) {
+               if (!IsEmptyStr(temp.fullname)) {
                        imap_acl_flags(rights, ra);
-                       if (strlen(rights) > 0) {
+                       if (!IsEmptyStr(rights)) {
                                cprintf(" ");
                                imap_strout(temp.fullname);
                                cprintf(" %s", rights);
index 66d5b44addce658164315f1c2e25e011b42760c0..5c40d57a57810564060cfe3aea2c9495855ac9fa 100644 (file)
@@ -204,7 +204,7 @@ void imap_fetch_rfc822(long msgnum, char *whichfmt) {
                        ptr = memreadline(ptr, buf, sizeof buf);
                        if (*ptr != 0) {
                                striplt(buf);
-                               if (strlen(buf) == 0) {
+                               if (IsEmptyStr(buf)) {
                                        headers_size = ptr - IMAP->cached_rfc822_data;
                                }
                        }
@@ -273,16 +273,16 @@ void imap_load_part(char *name, char *filename, char *partnum, char *disp,
 
        if (!strcasecmp(desired_section, mbuf2)) {
                cprintf("Content-type: %s", cbtype);
-               if (strlen(cbcharset) > 0)
+               if (!IsEmptyStr(cbcharset))
                        cprintf("; charset=\"%s\"", cbcharset);
-               if (strlen(name) > 0)
+               if (!IsEmptyStr(name))
                        cprintf("; name=\"%s\"", name);
                cprintf("\r\n");
-               if (strlen(encoding) > 0)
+               if (!IsEmptyStr(encoding))
                        cprintf("Content-Transfer-Encoding: %s\r\n", encoding);
-               if (strlen(encoding) > 0) {
+               if (!IsEmptyStr(encoding)) {
                        cprintf("Content-Disposition: %s", disp);
-                       if (strlen(filename) > 0) {
+                       if (!IsEmptyStr(filename)) {
                                cprintf("; filename=\"%s\"", filename);
                        }
                        cprintf("\r\n");
@@ -362,7 +362,7 @@ void imap_output_envelope_addr(char *addr) {
                return;
        }
 
-       if (strlen(addr) == 0) {
+       if (IsEmptyStr(addr)) {
                cprintf("NIL ");
                return;
        }
@@ -548,7 +548,7 @@ void imap_strip_headers(char *section) {
                        strcat(boiled_headers, "\r\n");
                }
 
-               if (strlen(buf) == 0) done_headers = 1;
+               if (IsEmptyStr(buf)) done_headers = 1;
                if (buf[0]=='\r') done_headers = 1;
                if (buf[0]=='\n') done_headers = 1;
        }
@@ -582,7 +582,7 @@ void imap_fetch_body(long msgnum, char *item, int is_peek) {
        if (strchr(section, '[') != NULL) {
                stripallbut(section, '[', ']');
        }
-       lprintf(CTDL_DEBUG, "Section is: %s%s\n", section, ((strlen(section)==0) ? "(empty)" : "") );
+       lprintf(CTDL_DEBUG, "Section is: %s%s\n", section, ((IsEmptyStr(section)0) ? "(empty)" : "") );
        if (!strncasecmp(section, "HEADER", 6)) {
                need_body = 0;
        }
@@ -617,7 +617,7 @@ void imap_fetch_body(long msgnum, char *item, int is_peek) {
                is_partial = 1;
        }
        if (is_partial == 0) strcpy(partial, "");
-       /* if (strlen(partial) > 0) lprintf(CTDL_DEBUG, "Partial is %s\n", partial); */
+       /* if (!IsEmptyStr(partial)) lprintf(CTDL_DEBUG, "Partial is %s\n", partial); */
 
        if (IMAP->cached_body == NULL) {
                CC->redirect_buffer = malloc(SIZ);
@@ -761,7 +761,7 @@ void imap_fetch_bodystructure_part(
        char cbmaintype[128];
        char cbsubtype[128];
 
-       if (cbtype != NULL) if (strlen(cbtype)>0) have_cbtype = 1;
+       if (cbtype != NULL) if (!IsEmptyStr(cbtype)) have_cbtype = 1;
        if (have_cbtype) {
                extract_token(cbmaintype, cbtype, 0, '/', sizeof cbmaintype);
                extract_token(cbsubtype, cbtype, 1, '/', sizeof cbsubtype);
@@ -780,7 +780,7 @@ void imap_fetch_bodystructure_part(
        if (cbcharset == NULL) {
                cprintf("(\"CHARSET\" \"US-ASCII\"");
        }
-       else if (strlen(cbcharset) == 0) {
+       else if (IsEmptyStr(cbcharset)) {
                cprintf("(\"CHARSET\" \"US-ASCII\"");
        }
        else {
@@ -788,7 +788,7 @@ void imap_fetch_bodystructure_part(
                imap_strout(cbcharset);
        }
 
-       if (name != NULL) if (strlen(name)>0) {
+       if (name != NULL) if (!IsEmptyStr(name)) {
                cprintf(" \"NAME\" ");
                imap_strout(name);
        }
@@ -798,7 +798,7 @@ void imap_fetch_bodystructure_part(
        cprintf("NIL ");        /* Body ID */
        cprintf("NIL ");        /* Body description */
 
-       if (encoding != NULL) if (strlen(encoding) > 0)  have_encoding = 1;
+       if (encoding != NULL) if (!IsEmptyStr(encoding))  have_encoding = 1;
        if (have_encoding) {
                imap_strout(encoding);
        }
@@ -838,13 +838,13 @@ void imap_fetch_bodystructure_part(
        if (disp == NULL) {
                cprintf("NIL");
        }
-       else if (strlen(disp) == 0) {
+       else if (IsEmptyStr(disp)) {
                cprintf("NIL");
        }
        else {
                cprintf("(");
                imap_strout(disp);
-               if (filename != NULL) if (strlen(filename)>0) {
+               if (filename != NULL) if (!IsEmptyStr(filename)) {
                        cprintf(" (\"FILENAME\" ");
                        imap_strout(filename);
                        cprintf(")");
@@ -903,7 +903,7 @@ void imap_fetch_bodystructure (long msgnum, char *item,
                ptr = rfc822;
                while (ptr = memreadline(ptr, buf, sizeof buf), *ptr != 0) {
                        ++lines;
-                       if ((strlen(buf) == 0) && (rfc822_body == NULL)) {
+                       if ((IsEmptyStr(buf)) && (rfc822_body == NULL)) {
                                rfc822_body = ptr;
                        }
                }
index 57bb65864dbfbdc3e4b4ba072e7fb0929d8385d5..e7b52710eee88ae5aaec167fb41e18c265d456c3 100644 (file)
@@ -139,7 +139,7 @@ void imap_listroom(struct ctdlroom *qrbuf, void *data)
         * We'll fix this later when we have time.
         */
        if (return_children) {
-               if (strlen(return_options) > 0) {
+               if (!IsEmptyStr(return_options)) {
                        strcat(return_options, " ");
                }
                strcat(return_options, "\\HasChildren");
@@ -395,7 +395,7 @@ void imap_list(int num_parms, char *parms[])
         * hierarchy delimiter and the root name of the name given in the
         * reference parameter.
         */
-       if ( (strlen(patterns[0]) == 0) && (extended_list_in_use == 0) ) {
+       if ( (IsEmptyStr(patterns[0])) && (extended_list_in_use == 0) ) {
                cprintf("* %s (\\Noselect) \"/\" \"\"\r\n", verb);
        }
 
index 350f9ad108d32c9cb3a23a16e5f6d18bf70b7f72..54babbf205018ef25149e0228e7107a1a4103df0 100644 (file)
@@ -283,7 +283,7 @@ void imap_do_append_flags(long new_msgnum, char *new_message_flags) {
        int i;
 
        if (new_message_flags == NULL) return;
-       if (strlen(new_message_flags) == 0) return;
+       if (IsEmptyStr(new_message_flags)) return;
 
        safestrncpy(flags, new_message_flags, sizeof flags);
 
index c12755015dcd17fdacef7350c52c7cb803423903..4298610f1b19353e06fb86ecd3f99707ab8accff 100644 (file)
@@ -626,7 +626,7 @@ int imap_is_message_set(char *buf)
 
        if (buf == NULL)
                return (0);     /* stupidity checks */
-       if (strlen(buf) == 0)
+       if (IsEmptyStr(buf))
                return (0);
 
        if (!strcasecmp(buf, "ALL"))
index a391e91ac28291089538a78ee0c5f2891a48def3..46b2053978c2c1fde4a9efccdf8d04f07b2ef478 100644 (file)
@@ -587,7 +587,7 @@ void imap_auth_plain(char *cmd)
 
        IMAP->authstate = imap_as_normal;
 
-       if (strlen(ident) > 0) {
+       if (!IsEmptyStr(ident)) {
                result = CtdlLoginExistingUser(user, ident);
        }
        else {
index eaab32d370102438debb031c02257f72813cc933..90f4431fd2613701274b810a661fa27673424359 100644 (file)
@@ -62,7 +62,7 @@ void inetcfg_setTo(struct CtdlMessage *msg) {
                do {
                        extract_token(buf, conf, 0, '\n', sizeof buf);
                        strcpy(conf, &conf[strlen(buf)+1]);
-               } while ( (strlen(conf)>0) && (strlen(buf)>0) );
+               } while ( (!IsEmptyStr(conf)) && (!IsEmptyStr(buf)) );
 
                if (inetcfg != NULL) free(inetcfg);
                inetcfg = conf;
index b79be37bd9625b6a3d83783066195418628b2507..41c57f9d9f5dc315cbc763efb587e45db56df3d7 100644 (file)
@@ -468,7 +468,7 @@ void ctdl_vcard_to_ldap(struct CtdlMessage *msg, int op) {
                 */
                if ( (!strcasecmp(v->prop[i].name, "fburl"))
                   ||(!strncasecmp(v->prop[i].name, "fburl;", 6)) ) {
-                       if ( (strlen(calFBURL) == 0)
+                       if ( (IsEmptyStr(calFBURL))
                           || (!strncasecmp(v->prop[i].name, "fburl;pref", 10)) ) {
                                safestrncpy(calFBURL, v->prop[i].value, sizeof calFBURL);
                        }
@@ -488,8 +488,8 @@ void ctdl_vcard_to_ldap(struct CtdlMessage *msg, int op) {
        attrs[num_attrs-1]->mod_values[1]       = NULL;
 
        /* "givenname" (first name) based on info in vCard */
-       if (strlen(givenname) == 0) strcpy(givenname, "_");
-       if (strlen(sn) == 0) strcpy(sn, "_");
+       if (IsEmptyStr(givenname)) strcpy(givenname, "_");
+       if (IsEmptyStr(sn)) strcpy(sn, "_");
        attrs = realloc(attrs, (sizeof(LDAPMod *) * ++num_attrs) );
        attrs[num_attrs-1] = malloc(sizeof(LDAPMod));
        memset(attrs[num_attrs-1], 0, sizeof(LDAPMod));
@@ -524,7 +524,7 @@ void ctdl_vcard_to_ldap(struct CtdlMessage *msg, int op) {
        }
 
        /* Add a "calFBURL" attribute if a calendar free/busy URL exists */
-       if (strlen(calFBURL) > 0) {
+       if (!IsEmptyStr(calFBURL)) {
                attrs = realloc(attrs, (sizeof(LDAPMod *) * ++num_attrs) );
                attrs[num_attrs-1] = malloc(sizeof(LDAPMod));
                memset(attrs[num_attrs-1], 0, sizeof(LDAPMod));
@@ -597,7 +597,7 @@ CTDL_MODULE_INIT(ldap)
 #ifdef HAVE_LDAP
        CtdlRegisterCleanupHook(serv_ldap_cleanup);
 
-       if (strlen(config.c_ldap_host) > 0) {
+       if (!IsEmptyStr(config.c_ldap_host)) {
                CtdlConnectToLdap();
        }
 
index 6a03745338bea066b721904cc8edaffac9550b23..8b1db778896e7f6efd5dceb5c6d5025aba1e6e0d 100644 (file)
@@ -450,7 +450,7 @@ void do_confirm(char *room, char *token) {
         * make another pass at the file, stripping out lines referring to
         * that address.
         */
-       if (strlen(address_to_unsubscribe) > 0) {
+       if (!IsEmptyStr(address_to_unsubscribe)) {
                holdbuf = malloc(SIZ);
                begin_critical_section(S_NETCONFIGS);
                ncfp = fopen(filename, "r+");
@@ -506,7 +506,12 @@ void do_confirm(char *room, char *token) {
         */
        if (success) {
                cprintf("%d %d operation(s) confirmed.\n", CIT_OK, success);
-               lprintf(CTDL_NOTICE, "Mailing list: %s %ssubscribed to %s with token %s\n", email, (strlen(address_to_unsubscribe) > 0) ? "un" : "", room, token);
+               lprintf(CTDL_NOTICE, 
+                       "Mailing list: %s %ssubscribed to %s with token %s\n", 
+                       email, 
+                       (!IsEmptyStr(address_to_unsubscribe)) ? "un" : "", 
+                       room, 
+                       token);
        }
        else {
                cprintf("%d Invalid token.\n", ERROR + ILLEGAL_VALUE);
index 56c28a327485cff7c0370a7b95b3e7953b49d56b..121cad908c19f4a434feba284fe8952a6d0dde14 100644 (file)
@@ -155,12 +155,12 @@ long GetSizeToken(char * token)
        char *cursor = token;
        char *number;
 
-       while ((*cursor != '\0') && 
+       while (!IsEmptyStr(cursor) && 
               (*cursor != '{'))
        {
                cursor++;
        }
-       if (*cursor == '\0'
+       if (IsEmptyStr(cursor)
                return -1;
        number = cursor + 1;
        while ((*cursor != '\0') && 
@@ -172,7 +172,7 @@ long GetSizeToken(char * token)
        if (cursor[-1] == '+')
                cursor--;
 
-       if (*cursor == '\0'
+       if (IsEmptyStr(cursor)
                return -1;
        
        return atol(number);
index 1c8260b9b47497db60f36846499d87d6b284e541..8885e5d812360db07701ea09186de91735f830e5 100644 (file)
@@ -141,8 +141,9 @@ struct FilterList *load_filter_list(void) {
                /* Cowardly refuse to add an any/any/any entry that would
                 * end up filtering every single message.
                 */
-               if (strlen(nptr->fl_user) + strlen(nptr->fl_room)
-                  + strlen(nptr->fl_node) == 0) {
+               if (IsEmptyStr(nptr->fl_user) && 
+                   IsEmptyStr(nptr->fl_room) &&
+                   IsEmptyStr(nptr->fl_node)) {
                        free(nptr);
                }
                else {
@@ -183,7 +184,7 @@ int network_usetable(struct CtdlMessage *msg) {
        if (msg->cm_fields['I'] == NULL) {
                return(0);
        }
-       if (strlen(msg->cm_fields['I']) == 0) {
+       if (IsEmptyStr(msg->cm_fields['I'])) {
                return(0);
        }
 
@@ -257,7 +258,7 @@ void write_network_map(void) {
                        for (nmptr = the_netmap; nmptr != NULL; nmptr = nmptr->next) {
                                serialized_map = realloc(serialized_map,
                                                        (strlen(serialized_map)+SIZ) );
-                               if (strlen(nmptr->nodename) > 0) {
+                               if (!IsEmptyStr(nmptr->nodename)) {
                                        snprintf(&serialized_map[strlen(serialized_map)],
                                                SIZ,
                                                "%s|%ld|%s\n",
@@ -793,7 +794,7 @@ void network_spool_msg(long msgnum, void *userdata) {
                                if (msg->cm_fields['C'] != NULL) {
                                        free(msg->cm_fields['C']);
                                }
-                               if (strlen(mptr->remote_roomname) > 0) {
+                               if (!IsEmptyStr(mptr->remote_roomname)) {
                                        msg->cm_fields['C'] = strdup(mptr->remote_roomname);
                                }
                                else {
@@ -919,7 +920,7 @@ void network_spoolout_room(char *room_to_spool) {
                        extract_token(roomname, buf, 2, '|', sizeof roomname);
                        strcpy(nexthop, "xxx");
                        if (is_valid_node(nexthop, NULL, nodename) == 0) {
-                               if (strlen(nexthop) == 0) {
+                               if (IsEmptyStr(nexthop)) {
                                        mptr = (struct maplist *)
                                                malloc(sizeof(struct maplist));
                                        mptr->next = sc.ignet_push_shares;
@@ -1029,7 +1030,7 @@ void network_spoolout_room(char *room_to_spool) {
                        }
                        fprintf(fp, "ignet_push_share|%s",
                                sc.ignet_push_shares->remote_nodename);
-                       if (strlen(sc.ignet_push_shares->remote_roomname) > 0) {
+                       if (!IsEmptyStr(sc.ignet_push_shares->remote_roomname)) {
                                fprintf(fp, "|%s", sc.ignet_push_shares->remote_roomname);
                        }
                        fprintf(fp, "\n");
@@ -1307,7 +1308,7 @@ void network_bounce(struct CtdlMessage *msg, char *reason) {
        else {
                strcpy(force_room, "");
        }
-       if ( (valid == NULL) && (strlen(force_room) == 0) ) {
+       if ( (valid == NULL) && IsEmptyStr(force_room) ) {
                strcpy(force_room, config.c_aideroom);
        }
        CtdlSubmitMsg(msg, valid, force_room);
@@ -1392,7 +1393,7 @@ void network_process_buffer(char *buffer, long size) {
                                serialize_message(&sermsg, msg);
 
                                /* now send it */
-                               if (strlen(nexthop) == 0) {
+                               if (IsEmptyStr(nexthop)) {
                                        strcpy(nexthop, msg->cm_fields['D']);
                                }
                                snprintf(filename, 
@@ -1629,7 +1630,7 @@ void network_purge_spoolout(void) {
                strcpy(nexthop, "");
                i = is_valid_node(nexthop, NULL, d->d_name);
        
-               if ( (i != 0) || (strlen(nexthop) > 0) ) {
+               if ( (i != 0) || !IsEmptyStr(nexthop) ) {
                        unlink(filename);
                }
        }
@@ -1865,8 +1866,8 @@ void network_poll_other_citadel_nodes(int full_poll) {
                extract_token(secret, linebuf, 1, '|', sizeof secret);
                extract_token(host, linebuf, 2, '|', sizeof host);
                extract_token(port, linebuf, 3, '|', sizeof port);
-               if ( (strlen(node) > 0) && (strlen(secret) > 0
-                  && (strlen(host) > 0) && strlen(port) > 0) {
+               if ( !IsEmptyStr(node) && !IsEmptyStr(secret
+                  && !IsEmptyStr(host) && !IsEmptyStr(port)) {
                        poll = full_poll;
                        if (poll == 0) {
                                snprintf(spoolfile, 
index 47e968b03bd22cfc8ba6b00947e2edda66a9742a..374cb57eba25b7cc5a25005011898b8706bfe237 100644 (file)
@@ -83,7 +83,7 @@ int serv_notes_beforesave(struct CtdlMessage *msg)
                        }
 
                        lprintf(9, "UUID of note is: %s\n", uuid);
-                       if (strlen(uuid) > 0) {
+                       if (!IsEmptyStr(uuid)) {
 
                                if (msg->cm_fields['E'] != NULL) {
                                        free(msg->cm_fields['E']);
index 553049c9b3bf61da5140f91605f5851066f0f548..d8a1285babaf72f612b672d2896d3fe81a161e36 100644 (file)
@@ -166,7 +166,7 @@ void cmd_rchg(char *argbuf)
 
        extract_token(newroomname, argbuf, 0, '|', sizeof newroomname);
        newroomname[ROOMNAMELEN-1] = 0;
-       if (strlen(newroomname) > 0) {
+       if (!IsEmptyStr(newroomname)) {
                safestrncpy(CC->fake_roomname, newroomname,
                        sizeof(CC->fake_roomname) );
        }
@@ -184,7 +184,7 @@ void cmd_hchg(char *argbuf)
        char newhostname[64];
 
        extract_token(newhostname, argbuf, 0, '|', sizeof newhostname);
-       if (strlen(newhostname) > 0) {
+       if (!IsEmptyStr(newhostname)) {
                safestrncpy(CC->fake_hostname, newhostname,
                        sizeof(CC->fake_hostname) );
        }
@@ -207,7 +207,7 @@ void cmd_uchg(char *argbuf)
 
        if (CtdlAccessCheck(ac_aide)) return;
 
-       if (strlen(newusername) > 0) {
+       if (!IsEmptyStr(newusername)) {
                CC->cs_flags &= ~CS_STEALTH;
                memset(CC->fake_username, 0, 32);
                if (strncasecmp(newusername, CC->curr_user,
index 508f8d2188ce71ecf06889f181de4704f235b7db..cc6d8b17299fb1160cb603717286bc468f3d74d2 100644 (file)
@@ -230,7 +230,7 @@ int ctdl_reject(sieve2_context_t *s, void *my)
        lprintf(CTDL_DEBUG, "Action is REJECT\n");
 
        /* If we don't know who sent the message, do a DISCARD instead. */
-       if (strlen(cs->sender) == 0) {
+       if (IsEmptyStr(cs->sender)) {
                lprintf(CTDL_INFO, "Unknown sender.  Doing DISCARD instead of REJECT.\n");
                return ctdl_discard(s, my);
        }
@@ -969,7 +969,7 @@ int msiv_setactive(struct sdm_userdata *u, char *script_name) {
 
        /* First see if the supplied value is ok */
 
-       if (strlen(script_name) == 0) {
+       if (IsEmptyStr(script_name)) {
                ok = 1;
        }
        else {
@@ -1108,7 +1108,7 @@ void cmd_msiv(char *argbuf) {
 
        if (!strcasecmp(subcmd, "putscript")) {
                extract_token(script_name, argbuf, 1, '|', sizeof script_name);
-               if (strlen(script_name) > 0) {
+               if (!IsEmptyStr(script_name)) {
                        cprintf("%d Transmit script now\n", SEND_LISTING);
                        script_content = CtdlReadMessageBody("000", config.c_maxmsglen, NULL, 0);
                        msiv_putscript(&u, script_name, script_content);
index a08d6be059e1890025e0f19255716f2f3f167705..304344694bdc16b4e96604453f4993d12293f821 100644 (file)
@@ -359,7 +359,7 @@ void smtp_try_plain(char *encoded_authstring) {
 
        SMTP->command_state = smtp_command;
 
-       if (strlen(ident) > 0) {
+       if (!IsEmptyStr(ident)) {
                result = CtdlLoginExistingUser(user, ident);
        }
        else {
@@ -490,7 +490,7 @@ void smtp_mail(char *argbuf) {
        char node[SIZ];
        char name[SIZ];
 
-       if (strlen(SMTP->from) != 0) {
+       if (!IsEmptyStr(SMTP->from)) {
                cprintf("503 5.1.0 Only one sender permitted\r\n");
                return;
        }
@@ -512,7 +512,7 @@ void smtp_mail(char *argbuf) {
         * address so we don't have to contend with the empty string causing
         * other code to fail when it's expecting something there.
         */
-       if (strlen(SMTP->from) == 0) {
+       if (IsEmptyStr(SMTP->from)) {
                strcpy(SMTP->from, "someone@somewhere.org");
        }
 
@@ -557,7 +557,7 @@ void smtp_rcpt(char *argbuf) {
        char message_to_spammer[SIZ];
        struct recptypes *valid = NULL;
 
-       if (strlen(SMTP->from) == 0) {
+       if (IsEmptyStr(SMTP->from)) {
                cprintf("503 5.5.1 Need MAIL before RCPT\r\n");
                return;
        }
@@ -622,7 +622,7 @@ void smtp_rcpt(char *argbuf) {
        }
 
        cprintf("250 2.1.5 RCPT ok <%s>\r\n", recp);
-       if (strlen(SMTP->recipients) > 0) {
+       if (!IsEmptyStr(SMTP->recipients)) {
                strcat(SMTP->recipients, ",");
        }
        strcat(SMTP->recipients, recp);
@@ -648,7 +648,7 @@ void smtp_data(void) {
        int i;
        char result[SIZ];
 
-       if (strlen(SMTP->from) == 0) {
+       if (IsEmptyStr(SMTP->from)) {
                cprintf("503 5.5.1 Need MAIL command first.\r\n");
                return;
        }
@@ -991,7 +991,7 @@ void smtp_try(const char *key, const char *addr, int *status,
                        scan_done = 1;
                }
        } while (scan_done == 0);
-       if (strlen(mailfrom)==0) strcpy(mailfrom, "someone@somewhere.org");
+       if (IsEmptyStr(mailfrom)) strcpy(mailfrom, "someone@somewhere.org");
        stripallbut(mailfrom, '<', '>');
 
        /* Figure out what mail exchanger host we have to connect to */
@@ -1105,7 +1105,7 @@ void smtp_try(const char *key, const char *addr, int *status,
        }
 
        /* Do an AUTH command if necessary */
-       if (strlen(mx_user) > 0) {
+       if (!IsEmptyStr(mx_user)) {
                char encoded[1024];
                sprintf(buf, "%s%c%s%c%s", mx_user, '\0', mx_user, '\0', mx_pass);
                CtdlEncodeBase64(encoded, buf, strlen(mx_user) + strlen(mx_user) + strlen(mx_pass) + 2);
@@ -1428,7 +1428,7 @@ void smtp_do_bounce(char *instr) {
 
                /* First try the user who sent the message */
                lprintf(CTDL_DEBUG, "bounce to user? <%s>\n", bounceto);
-               if (strlen(bounceto) == 0) {
+               if (IsEmptyStr(bounceto)) {
                        lprintf(CTDL_ERR, "No bounce address specified\n");
                        bounce_msgid = (-1L);
                }
index b1c3630c0cdf9a3facc2a41d4c6db96e536e01ea..8380cec4d017b995c2d2b337a8d826d2fcd2b0a6 100644 (file)
@@ -199,7 +199,7 @@ void artv_export_visits(void) {
                cprintf("%ld\n", vbuf.v_roomgen);
                cprintf("%ld\n", vbuf.v_usernum);
 
-               if (strlen(vbuf.v_seen) > 0) {
+               if (!IsEmptyStr(vbuf.v_seen)) {
                        cprintf("%s\n", vbuf.v_seen);
                }
                else {
index 06b06371871da1eeaae74635dc32e53c17030f36..311b73dfeb347df9e3cfa1ae24608cf78071def1 100644 (file)
@@ -111,7 +111,7 @@ void vcard_extract_internet_addresses(struct CtdlMessage *msg,
                if (s != NULL) {
                        addr = strdup(s);
                        striplt(addr);
-                       if (strlen(addr) > 0) {
+                       if (!IsEmptyStr(addr)) {
                                if (callback != NULL) {
                                        callback(addr, citadel_address);
                                }
@@ -225,7 +225,7 @@ void extract_inet_email_addrs(char *emailaddrbuf, size_t emailaddrbuf_len,
        while (s = vcard_get_prop(v, "email;internet", 0, instance++, 0),  s != NULL) {
                addr = strdup(s);
                striplt(addr);
-               if (strlen(addr) > 0) {
+               if (!IsEmptyStr(addr)) {
                        if ( (IsDirectory(addr, 1)) || 
                             (!local_addrs_only) ) {
                                ++saved_instance;
@@ -923,7 +923,7 @@ void cmd_gvsn(char *argbuf)
 
        cprintf("%d valid screen names:\n", LISTING_FOLLOWS);
        cprintf("%s\n", CC->user.fullname);
-       if ( (strlen(CC->cs_inet_fn) > 0) && (strcasecmp(CC->user.fullname, CC->cs_inet_fn)) ) {
+       if ( (!IsEmptyStr(CC->cs_inet_fn)) && (strcasecmp(CC->user.fullname, CC->cs_inet_fn)) ) {
                cprintf("%s\n", CC->cs_inet_fn);
        }
        cprintf("000\n");
@@ -942,10 +942,10 @@ void cmd_gvea(char *argbuf)
        if (CtdlAccessCheck(ac_logged_in)) return;
 
        cprintf("%d valid email addresses:\n", LISTING_FOLLOWS);
-       if (strlen(CC->cs_inet_email) > 0) {
+       if (!IsEmptyStr(CC->cs_inet_email)) {
                cprintf("%s\n", CC->cs_inet_email);
        }
-       if (strlen(CC->cs_inet_other_emails) > 0) {
+       if (!IsEmptyStr(CC->cs_inet_other_emails)) {
                num_secondary_emails = num_tokens(CC->cs_inet_other_emails, '|');
                for (i=0; i<num_secondary_emails; ++i) {
                        extract_token(buf, CC->cs_inet_other_emails,i,'|',sizeof CC->cs_inet_other_emails);
@@ -1245,7 +1245,7 @@ void store_this_ha(struct addresses_to_be_filed *aptr) {
        CtdlForEachMessage(MSGS_ALL, 0, NULL, "^[Tt][Ee][Xx][Tt]/.*[Vv][Cc][Aa][Rr][Dd]$", NULL,
                strip_addresses_already_have, aptr->collected_addresses);
 
-       if (strlen(aptr->collected_addresses) > 0)
+       if (!IsEmptyStr(aptr->collected_addresses))
           for (i=0; i<num_tokens(aptr->collected_addresses, ','); ++i) {
 
                /* Make a vCard out of each address */