X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=sendlib.c;h=a77b6d05d7dc08b243b71cf49317e305daf08d8f;hp=8128089e7ce4131f0a544bb02743b82c5172b8f0;hb=ad29f4688c8a43e718f4cf25ab9337459fc472de;hpb=6833ce8bdca2d64e14485118f2a4417b7e1cb1b1 diff --git a/sendlib.c b/sendlib.c index 8128089..a77b6d0 100644 --- a/sendlib.c +++ b/sendlib.c @@ -40,6 +40,11 @@ #include #include #include +#include + +#ifdef USE_LIBESMTP +# include "mutt_libesmtp.h" +#endif /* USE_LIBESMTP */ #ifdef USE_NNTP #include @@ -190,9 +195,6 @@ static void encode_quoted (FGETCONV * fc, FILE *fout, int istext) linelen = 3; } -#ifdef USE_LIBESMTP -# include "mutt_libesmtp.h" -#endif /* USE_LIBESMTP */ if (c == '\n' && istext) { @@ -1738,8 +1740,19 @@ int mutt_write_rfc822_header (FILE *fp, ENVELOPE *env, BODY *attach, if (mode == 0 && !privacy && option (OPTXMAILER) && !has_agent) { + struct utsname un; + char * os; + if (OperatingSystem!=NULL) { + os = OperatingSystem; + } else { + if (uname(&un)==-1) { + os = "UNIX"; + } else { + os = un.sysname; + } + } /* Add a vanity header */ - fprintf (fp, "User-Agent: Mutt/%s\n", MUTT_VERSION); + fprintf (fp, "User-Agent: mutt-ng %s (%s)\n", MUTT_VERSION,os); } return (ferror (fp) == 0 ? 0 : -1); @@ -1809,9 +1822,9 @@ char *mutt_gen_msgid (void) if(!(fqdn = mutt_fqdn(0))) fqdn = NONULL(Hostname); - snprintf (buf, sizeof (buf), "<%d%02d%02d%02d%02d%02d.G%c%d@%s>", + snprintf (buf, sizeof (buf), "<%d%02d%02d%02d%02d%02d.G%c%u@%s>", tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, - tm->tm_min, tm->tm_sec, MsgIdPfx, getpid (), fqdn); + tm->tm_min, tm->tm_sec, MsgIdPfx, (unsigned int)getpid (), fqdn); MsgIdPfx = (MsgIdPfx == 'Z') ? 'A' : MsgIdPfx + 1; return (safe_strdup (buf)); } @@ -2363,40 +2376,42 @@ int mutt_bounce_message (FILE *fp, HEADER *h, ADDRESS *to) /* given a list of addresses, return a list of unique addresses */ ADDRESS *mutt_remove_duplicates (ADDRESS *addr) { - ADDRESS *top = NULL; + ADDRESS *top = addr; + ADDRESS **last = ⊤ ADDRESS *tmp; - - if ((top = addr) == NULL) - return (NULL); - addr = addr->next; - top->next = NULL; + int dup; + while (addr) { - tmp = top; - do { - if (addr->mailbox && tmp->mailbox && + for (tmp = top, dup = 0; tmp && tmp != addr; tmp = tmp->next) + { + if (tmp->mailbox && addr->mailbox && !ascii_strcasecmp (addr->mailbox, tmp->mailbox)) { - /* duplicate address, just ignore it */ - tmp = addr; - addr = addr->next; - tmp->next = NULL; - rfc822_free_address (&tmp); - } - else if (!tmp->next) - { - /* unique address. add it to the list */ - tmp->next = addr; - addr = addr->next; - tmp = tmp->next; - tmp->next = NULL; - tmp = NULL; /* so we exit the loop */ + dup = 1; + break; } - else - tmp = tmp->next; - } while (tmp); - } + } + + if (dup) + { + dprint (2, (debugfile, "mutt_remove_duplicates: Removing %s\n", + addr->mailbox)); + + *last = addr->next; + addr->next = NULL; + rfc822_free_address(&addr); + + addr = *last; + } + else + { + last = &addr->next; + addr = addr->next; + } + } + return (top); } @@ -2491,6 +2506,8 @@ int mutt_write_fcc (const char *path, HEADER *hdr, const char *msgid, int post, if (PgpSignAs && *PgpSignAs) fprintf (msg->fp, "<%s>", PgpSignAs); } + if (hdr->security & INLINE) + fputc ('I', msg->fp); fputc ('\n', msg->fp); } @@ -2509,6 +2526,8 @@ int mutt_write_fcc (const char *path, HEADER *hdr, const char *msgid, int post, if (SmimeDefaultKey && *SmimeDefaultKey) fprintf (msg->fp, "<%s>", SmimeDefaultKey); } + if (hdr->security & INLINE) + fputc ('I', msg->fp); fputc ('\n', msg->fp); }