aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRadek Doulik <rodo@helixcode.com>2000-11-04 18:07:37 +0800
committerRadek Doulik <rodo@src.gnome.org>2000-11-04 18:07:37 +0800
commit1ca157384dd51c016c0631f2fa3ab8526ae5f12a (patch)
treed5e8fc6a63ad0e6a54d1d991f95ef21ad78c3885
parent338344b2e4b2e2844c30af556d99b5cef594faaa (diff)
downloadgsoc2013-evolution-1ca157384dd51c016c0631f2fa3ab8526ae5f12a.tar
gsoc2013-evolution-1ca157384dd51c016c0631f2fa3ab8526ae5f12a.tar.gz
gsoc2013-evolution-1ca157384dd51c016c0631f2fa3ab8526ae5f12a.tar.bz2
gsoc2013-evolution-1ca157384dd51c016c0631f2fa3ab8526ae5f12a.tar.lz
gsoc2013-evolution-1ca157384dd51c016c0631f2fa3ab8526ae5f12a.tar.xz
gsoc2013-evolution-1ca157384dd51c016c0631f2fa3ab8526ae5f12a.tar.zst
gsoc2013-evolution-1ca157384dd51c016c0631f2fa3ab8526ae5f12a.zip
new function, generates simple message/content id
2000-11-03 Radek Doulik <rodo@helixcode.com> * camel-mime-utils.c (header_msgid_generate): new function, generates simple message/content id svn path=/trunk/; revision=6389
-rw-r--r--camel/ChangeLog5
-rw-r--r--camel/camel-mime-utils.c13
-rw-r--r--camel/camel-mime-utils.h3
3 files changed, 21 insertions, 0 deletions
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 <rodo@helixcode.com>
+
+ * camel-mime-utils.c (header_msgid_generate): new function,
+ generates simple message/content id
+
2000-11-04 Not Zed <NotZed@HelixCode.com>
* 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 <fcntl.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include <unicode.h>
@@ -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);