#define FREE(x) safe_free(x)
#define ISSPACE isspace
#define strfcpy(a,b,c) {if (c) {strncpy(a,b,c);a[c-1]=0;}}
-#define STRING 128
+#define LONG_STRING 1024
#include "rfc822.h"
#endif
"bad address spec"
};
-void rfc822_dequote_comment (char *s)
+static void rfc822_dequote_comment (char *s)
{
char *w = s;
char *comment, size_t *commentlen, size_t commentmax,
ADDRESS *addr)
{
- char token[STRING];
+ char token[LONG_STRING];
size_t tokenlen = 0;
SKIPWS (s);
char *comment, size_t *commentlen, size_t commentmax,
ADDRESS *addr)
{
- char token[STRING];
+ char token[LONG_STRING];
size_t tokenlen = 0;
s = parse_address (s, token, &tokenlen, sizeof (token) - 1, comment, commentlen, commentmax, addr);
{
int ws_pending, nl;
const char *begin, *ps;
- char comment[STRING], phrase[STRING];
+ char comment[LONG_STRING], phrase[LONG_STRING];
size_t phraselen = 0, commentlen = 0;
ADDRESS *cur, *last = NULL;
{
if (*pc == '"' || *pc == '\\')
{
- if (!buflen)
- goto done;
*pbuf++ = '\\';
buflen--;
}
}
/* this should be rfc822_cpy_adrlist */
-ADDRESS *rfc822_cpy_adr (ADDRESS *addr)
+ADDRESS *rfc822_cpy_adr (ADDRESS *addr, int prune)
{
ADDRESS *top = NULL, *last = NULL;
for (; addr; addr = addr->next)
{
+ if (prune && addr->group && (!addr->next || !addr->next->mailbox))
+ {
+ addr = addr->next;
+ continue;
+ }
if (last)
{
last->next = rfc822_cpy_adr_real (addr);
}
/* append list 'b' to list 'a' and return the last element in the new list */
-ADDRESS *rfc822_append (ADDRESS **a, ADDRESS *b)
+ADDRESS *rfc822_append (ADDRESS **a, ADDRESS *b, int prune)
{
ADDRESS *tmp = *a;
if (!b)
return tmp;
if (tmp)
- tmp->next = rfc822_cpy_adr (b);
+ tmp->next = rfc822_cpy_adr (b, prune);
else
- tmp = *a = rfc822_cpy_adr (b);
+ tmp = *a = rfc822_cpy_adr (b, prune);
while (tmp && tmp->next)
tmp = tmp->next;
return tmp;
* domain-literal = "[" *(dtext / quoted-pair) "]"
*/
- char* dom;
unsigned int l, i;
if (!msgid || !*msgid)
return -1;
if (msgid[0] != '<' || msgid[l-1] != '>')
return -1;
- if (!(dom = strrchr (msgid, '@')))
+ if (!(strrchr (msgid, '@')))
return -1;
/* TODO: complete parser */