summaryrefslogtreecommitdiff
path: root/mailbox
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2007-06-28 08:04:00 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2007-06-28 08:04:00 +0000
commit8fe94a41e02078c7a7973189934b810f8a4dbacd (patch)
treee82226dec54ad05317e7db7f8818a70fa2ba78a3 /mailbox
parent1e32b2a35e78211b006f9c4efa20ab74b0087ac5 (diff)
downloadmailutils-8fe94a41e02078c7a7973189934b810f8a4dbacd.tar.gz
mailutils-8fe94a41e02078c7a7973189934b810f8a4dbacd.tar.bz2
(mu_rfc2822_msg_id): New function
Diffstat (limited to 'mailbox')
-rw-r--r--mailbox/mutil.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/mailbox/mutil.c b/mailbox/mutil.c
index 149c8671c..ac56a60d8 100644
--- a/mailbox/mutil.c
+++ b/mailbox/mutil.c
@@ -1023,6 +1023,35 @@ mu_rfc2822_references (mu_message_t msg, char **pstr)
return MU_ERR_FAILURE;
}
+int
+mu_rfc2822_msg_id (int subpart, char **pval)
+{
+ char date[4+2+2+2+2+2+1];
+ time_t t = time (NULL);
+ struct tm *tm = localtime (&t);
+ char *host;
+ char *p;
+
+ mu_strftime (date, sizeof date, "%Y%m%d%H%M%S", tm);
+ mu_get_host_name (&host);
+
+ if (subpart)
+ {
+ struct timeval tv;
+ gettimeofday (&tv, NULL);
+ asprintf (&p, "<%s.%lu.%d@%s>",
+ date,
+ (unsigned long) getpid (),
+ subpart,
+ host);
+ }
+ else
+ asprintf (&p, "<%s.%lu@%s>", date, (unsigned long) getpid (), host);
+ free (host);
+ *pval = p;
+ return 0;
+}
+
#define DATEBUFSIZE 128
#define COMMENT "Your message of "

Return to:

Send suggestions and report system problems to the System administrator.