From 1ca157384dd51c016c0631f2fa3ab8526ae5f12a Mon Sep 17 00:00:00 2001 From: Radek Doulik Date: Sat, 4 Nov 2000 10:07:37 +0000 Subject: new function, generates simple message/content id 2000-11-03 Radek Doulik * camel-mime-utils.c (header_msgid_generate): new function, generates simple message/content id svn path=/trunk/; revision=6389 --- camel/ChangeLog | 5 +++++ camel/camel-mime-utils.c | 13 +++++++++++++ camel/camel-mime-utils.h | 3 +++ 3 files changed, 21 insertions(+) (limited to 'camel') diff --git a/camel/ChangeLog b/camel/ChangeLog index cee5b9bf55..1c413b0ab0 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,8 @@ +2000-11-03 Radek Doulik + + * camel-mime-utils.c (header_msgid_generate): new function, + generates simple message/content id + 2000-11-04 Not Zed * camel-mime-part-utils.c diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c index 6ecec61670..d2df6cac76 100644 --- a/camel/camel-mime-utils.c +++ b/camel/camel-mime-utils.c @@ -30,6 +30,7 @@ #include #include #include +#include #include @@ -3055,3 +3056,15 @@ void run_test(void) } #endif /* BUILD_TABLE */ + +char * +header_msgid_generate (void) +{ + gchar host [256], domain [768]; + static gint count = 0; + + gethostname (host, sizeof (host)); + getdomainname (domain, sizeof (domain)); + + return g_strdup_printf ("%d.%d.%d.camel@%s.%s", (gint) time (NULL), getpid (), count++, host, domain); +} diff --git a/camel/camel-mime-utils.h b/camel/camel-mime-utils.h index dc865004ee..a1f8bb549d 100644 --- a/camel/camel-mime-utils.h +++ b/camel/camel-mime-utils.h @@ -154,6 +154,9 @@ char *header_format_date(time_t time, int offset); /* decode a message id */ char *header_msgid_decode(const char *in); +/* generate msg id */ +char *header_msgid_generate (void); + /* decode a References header */ struct _header_references *header_references_decode(const char *in); void header_references_list_clear(struct _header_references **list); -- cgit