21 |
#include <pwd.h> |
#include <pwd.h> |
22 |
#include <sys/types.h> |
#include <sys/types.h> |
23 |
#include <sys/stat.h> |
#include <sys/stat.h> |
24 |
|
#include <sys/time.h> |
25 |
#include <stdarg.h> |
#include <stdarg.h> |
26 |
#include <unistd.h> |
#include <unistd.h> |
27 |
#include <errno.h> |
#include <errno.h> |
734 |
return mh_expand_name (draftfolder, "draft", 0); |
return mh_expand_name (draftfolder, "draft", 0); |
735 |
} |
} |
736 |
|
|
737 |
|
char * |
738 |
|
mh_create_message_id (int m) |
739 |
|
{ |
740 |
|
char date[4+2+2+2+2+2+1]; |
741 |
|
time_t t = time (NULL); |
742 |
|
struct tm *tm = localtime (&t); |
743 |
|
char *host; |
744 |
|
char *p; |
745 |
|
|
746 |
|
strftime (date, sizeof date, "%Y%m%d%H%M%S", tm); |
747 |
|
mu_get_host_name (&host); |
748 |
|
|
749 |
|
if (m) |
750 |
|
{ |
751 |
|
struct timeval tv; |
752 |
|
gettimeofday (&tv, NULL); |
753 |
|
asprintf (&p, "<%s.%lu.%lu@%s>", |
754 |
|
date, |
755 |
|
(unsigned long) tv.tv_usec, |
756 |
|
(unsigned long) getpid (), |
757 |
|
host); |
758 |
|
} |
759 |
|
else |
760 |
|
asprintf (&p, "<%s.%lu@%s>", date, (unsigned long) getpid (), host); |
761 |
|
free (host); |
762 |
|
return p; |
763 |
|
} |