/* 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 {
if (msg->cm_fields['I'] == NULL) {
return(0);
}
- if (strlen(msg->cm_fields['I']) == 0) {
+ if (IsEmptyStr(msg->cm_fields['I'])) {
return(0);
}
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",
snprintf(buf, sizeof buf, "[%s]", CC->room.QRname);
msg->cm_fields['U'] = strdup(buf);
sprintf(buf, "room_%s@%s", CC->room.QRname, config.c_fqdn);
- for (i=0; i<strlen(buf); ++i) {
+ for (i=0; !IsEmptyStr(&buf[i]); ++i) {
if (isspace(buf[i])) buf[i]='_';
buf[i] = tolower(buf[i]);
}
snprintf(msg->cm_fields['R'], 256,
"room_%s@%s", CC->room.QRname,
config.c_fqdn);
- for (i=0; i<strlen(msg->cm_fields['R']); ++i) {
+ for (i=0; !IsEmptyStr(&msg->cm_fields['R'][i]); ++i) {
if (isspace(msg->cm_fields['R'][i])) {
msg->cm_fields['R'][i] = '_';
}
snprintf(msg->cm_fields['F'], SIZ,
"room_%s@%s", CC->room.QRname,
config.c_fqdn);
- for (i=0; i<strlen(msg->cm_fields['F']); ++i) {
+ for (i=0; !IsEmptyStr(&msg->cm_fields['F'][i]); ++i) {
if (isspace(msg->cm_fields['F'][i])) {
msg->cm_fields['F'][i] = '_';
}
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 {
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;
/* If we wrote a digest, deliver it and then close it */
snprintf(buf, sizeof buf, "room_%s@%s",
CC->room.QRname, config.c_fqdn);
- for (i=0; i<strlen(buf); ++i) {
+ for (i=0; !IsEmptyStr(&buf[i]); ++i) {
buf[i] = tolower(buf[i]);
if (isspace(buf[i])) buf[i] = '_';
}
}
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");
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);
serialize_message(&sermsg, msg);
/* now send it */
- if (strlen(nexthop) == 0) {
+ if (IsEmptyStr(nexthop)) {
strcpy(nexthop, msg->cm_fields['D']);
}
snprintf(filename,
strcpy(nexthop, "");
i = is_valid_node(nexthop, NULL, d->d_name);
- if ( (i != 0) || (strlen(nexthop) > 0) ) {
+ if ( (i != 0) || !IsEmptyStr(nexthop) ) {
unlink(filename);
}
}
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,