if (bar) {
bar[0] = 0;
++bar;
- striplt(aaa);
- striplt(bar);
+ string_trim(aaa);
+ string_trim(bar);
if ( (!IsEmptyStr(aaa)) && (!strcasecmp(name, aaa)) ) {
syslog(LOG_DEBUG, "internet_addressing: global alias <%s> to <%s>", name, bar);
strcpy(name, bar);
safestrncpy(original_name, name, sizeof original_name);
// should these checks still be here, or maybe move them to split_recps() ?
- striplt(name);
+ string_trim(name);
remove_any_whitespace_to_the_left_or_right_of_at_symbol(name);
stripallbut(name, '<', '>');
for (i=0; i<num_addresses; ++i) {
char this_address[256];
extract_token(this_address, a, i, ',', sizeof this_address);
- striplt(this_address); // strip leading and trailing whitespace
+ string_trim(this_address); // strip leading and trailing whitespace
stripout(this_address, '(', ')'); // remove any portion in parentheses
stripallbut(this_address, '<', '>'); // if angle brackets are present, keep only what is inside them
if (!IsEmptyStr(this_address)) {
// Split an RFC822-style address into userid, host, and full name
-//
-// Note: This still handles obsolete address syntaxes such as user%node@node and ...node!user
-// We should probably remove that.
void process_rfc822_addr(const char *rfc822, char *user, char *node, char *name) {
int a;
strcpy(name, rfc822);
stripout(name, '<', '>');
- // strip anything to the left of a bang
- while ((!IsEmptyStr(name)) && (haschar(name, '!') > 0))
- strcpy(name, &name[1]);
-
- // and anything to the right of a @ or %
+ // and anything to the right of a @
for (a = 0; name[a] != '\0'; ++a) {
if (name[a] == '@') {
name[a] = 0;
break;
}
- if (name[a] == '%') {
- name[a] = 0;
- break;
- }
}
// but if there are parentheses, that changes the rules...
stripallbut(user, '<', '>');
}
- // strip anything to the left of a bang
- while ((!IsEmptyStr(user)) && (haschar(user, '!') > 0))
- strcpy(user, &user[1]);
-
- // and anything to the right of a @ or %
+ // and anything to the right of a @
for (a = 0; user[a] != '\0'; ++a) {
if (user[a] == '@') {
user[a] = 0;
break;
}
- if (user[a] == '%') {
- user[a] = 0;
- break;
- }
}
-
// extract node name
strcpy(node, rfc822);
}
// If no node specified, tack ours on instead
- if (
- (haschar(node, '@')==0)
- && (haschar(node, '%')==0)
- && (haschar(node, '!')==0)
- ) {
+ if (haschar(node, '@') == 0) {
strcpy(node, CtdlGetConfigStr("c_nodename"));
}
else {
-
// strip anything to the left of a @
- while ((!IsEmptyStr(node)) && (haschar(node, '@') > 0))
- strcpy(node, &node[1]);
-
- // strip anything to the left of a %
- while ((!IsEmptyStr(node)) && (haschar(node, '%') > 0))
- strcpy(node, &node[1]);
-
- // reduce multiple system bang paths to node!user
- while ((!IsEmptyStr(node)) && (haschar(node, '!') > 1))
+ while ((!IsEmptyStr(node)) && (haschar(node, '@') > 0)) {
strcpy(node, &node[1]);
-
- // now get rid of the user portion of a node!user string
- for (a = 0; node[a] != '\0'; ++a)
- if (node[a] == '!') {
- node[a] = 0;
- break;
- }
+ }
}
// strip leading and trailing spaces in all strings
- striplt(user);
- striplt(node);
- striplt(name);
+ string_trim(user);
+ string_trim(node);
+ string_trim(name);
// If we processed a string that had the address in angle brackets
// but no name outside the brackets, we now have an empty name. In
strcat(fieldbuf, " ");
cont = &fieldbuf[strlen(fieldbuf)];
ptr = cmemreadline(ptr, cont, SIZ-strlen(fieldbuf) );
- striplt(cont);
+ string_trim(cont);
}
strcpy(fieldbuf, &fieldbuf[strlen(fieldhdr)]);
- striplt(fieldbuf);
+ string_trim(fieldbuf);
return(fieldbuf);
}
int h;
extract_token(domain, addr, 1, '@', sizeof domain);
- striplt(domain);
+ string_trim(domain);
h = CtdlHostAlias(domain);
if (!CM_IsEmpty(msg, field)) {
for (j=0; j<num_tokens(msg->cm_fields[field], ','); ++j) {
extract_token(addr, msg->cm_fields[field], j, ',', sizeof addr);
- if (strstr(addr, "=?") != NULL)
+ if (strstr(addr, "=?") != NULL) {
utf8ify_rfc822_string(addr);
+ }
process_rfc822_addr(addr, user, node, name);
h = CtdlHostAlias(node);
if (h != hostalias_localhost) {
if (!IsEmptyStr(coll)) {
strcat(coll, ",");
}
- striplt(addr);
+ string_trim(addr);
strcat(coll, addr);
}
}