From 0ea2ff67900c243fff9f689658dcb23d1c0961cd Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Sat, 8 Oct 2016 21:14:52 +0200 Subject: 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 --- src/mbox-util.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/mbox-util.c') 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); +} -- cgit v1.2.3