mirror of https://github.com/djcb/mu.git
message: implement rfc2047-encoding addresses
For address names with commas, quotes etc.
This commit is contained in:
parent
da8489d0f6
commit
4fc05261ce
|
@ -64,6 +64,23 @@ Mu::init_gmime(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::string
|
||||||
|
Mu::address_rfc2047(const Contact& contact)
|
||||||
|
{
|
||||||
|
init_gmime();
|
||||||
|
|
||||||
|
InternetAddress *addr =
|
||||||
|
internet_address_mailbox_new(contact.name.c_str(),
|
||||||
|
contact.email.c_str());
|
||||||
|
|
||||||
|
std::string encoded = to_string_gchar(
|
||||||
|
internet_address_to_string(addr, {}, true));
|
||||||
|
|
||||||
|
g_object_unref(addr);
|
||||||
|
|
||||||
|
return encoded;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MimeObject
|
* MimeObject
|
||||||
|
@ -602,8 +619,8 @@ MimeMultipartSigned::verify(const MimeCryptoContext& ctx, VerifyFlags vflags) co
|
||||||
std::vector<MimeSignature> sigs;
|
std::vector<MimeSignature> sigs;
|
||||||
for (auto i = 0;
|
for (auto i = 0;
|
||||||
i != g_mime_signature_list_length(siglist); ++i) {
|
i != g_mime_signature_list_length(siglist); ++i) {
|
||||||
GMimeSignature *sig = g_mime_signature_list_get_signature(siglist, i);
|
GMimeSignature *msig = g_mime_signature_list_get_signature(siglist, i);
|
||||||
sigs.emplace_back(MimeSignature(sig));
|
sigs.emplace_back(MimeSignature(msig));
|
||||||
}
|
}
|
||||||
g_object_unref(siglist);
|
g_object_unref(siglist);
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,16 @@ using MimeFormatOptions = deletable_unique_ptr<GMimeFormatOptions, g_mime_format
|
||||||
*/
|
*/
|
||||||
void init_gmime(void);
|
void init_gmime(void);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a RFC2047-compatible address for the given contact
|
||||||
|
*
|
||||||
|
* @param contact a contact
|
||||||
|
*
|
||||||
|
* @return an address string
|
||||||
|
*/
|
||||||
|
std::string address_rfc2047(const Contact& contact);
|
||||||
|
|
||||||
class Object {
|
class Object {
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -160,6 +170,10 @@ private:
|
||||||
mutable GObject *self_{};
|
mutable GObject *self_{};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Thin wrapper around a GMimeContentType
|
* Thin wrapper around a GMimeContentType
|
||||||
|
|
|
@ -322,7 +322,7 @@ each_contact(const Mu::Contact& ci, ECData& ecdata)
|
||||||
"\tlast-seen: %s\n",
|
"\tlast-seen: %s\n",
|
||||||
ci.email.c_str(),
|
ci.email.c_str(),
|
||||||
ci.name.empty() ? "<none>" : ci.name.c_str(),
|
ci.name.empty() ? "<none>" : ci.name.c_str(),
|
||||||
ci.display_name().c_str(),
|
ci.display_name(true).c_str(),
|
||||||
ci.personal ? "yes" : "no",
|
ci.personal ? "yes" : "no",
|
||||||
ci.frequency,
|
ci.frequency,
|
||||||
datebuf);
|
datebuf);
|
||||||
|
|
Loading…
Reference in New Issue