aboutsummaryrefslogtreecommitdiffstats
path: root/src/mbox-util.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2016-10-08 19:14:52 +0000
committerWerner Koch <[email protected]>2016-10-08 19:17:48 +0000
commit0ea2ff67900c243fff9f689658dcb23d1c0961cd (patch)
treedbac0b0c700bec5ce5bb31c070047af3f00d4abe /src/mbox-util.c
parentAdd missing includes. (diff)
downloadgpgme-0ea2ff67900c243fff9f689658dcb23d1c0961cd.tar.gz
gpgme-0ea2ff67900c243fff9f689658dcb23d1c0961cd.zip
core: New helper function gpgme_addrspec_from_uid.
* src/gpgme.h.in: Add gpgme_addrspec_from_uid. * src/gpgme.def, src/libgpgme.vers: Ditto. * src/mbox-util.c (gpgme_addrspec_from_uid): New. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'src/mbox-util.c')
-rw-r--r--src/mbox-util.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/mbox-util.c b/src/mbox-util.c
index 656b5d7b..81e929bd 100644
--- a/src/mbox-util.c
+++ b/src/mbox-util.c
@@ -255,3 +255,21 @@ _gpgme_mailbox_from_userid (const char *userid)
/* return 1; */
/* } */
+
+
+/*
+ * Exported public API
+ */
+
+
+/* Return the mail address ("addr-spec" as per RFC-5322) from a string
+ * which is assumed to be an user id ("address" in RFC-5322). All
+ * plain ASCII characters (those with bit 7 cleared) in the result
+ * are converted to lowercase. Caller must free the result using
+ * gpgme_free. Returns NULL if no valid address was found (in which
+ * case ERRNO is set to EINVAL) or for other errors. */
+char *
+gpgme_addrspec_from_uid (const char *uid)
+{
+ return _gpgme_mailbox_from_userid (uid);
+}