diff --git a/configure.ac b/configure.ac index 8941dc48..9f0c2cd4 100644 --- a/configure.ac +++ b/configure.ac @@ -182,7 +182,7 @@ AC_SUBST(XAPIAN_LIBS) # note that MU_STORE_SCHEMA_VERSION does not necessarily follow MU # versioning, as we hopefully don't have updates for each version; # also, this has nothing to do with Xapian's software version -AC_DEFINE(MU_STORE_SCHEMA_VERSION,["0.999"], ['Schema' version of the database]) +AC_DEFINE(MU_STORE_SCHEMA_VERSION,["1.3"], ['Schema' version of the database]) ############################################################################### ############################################################################### diff --git a/lib/mu-contacts.cc b/lib/mu-contacts.cc index 905123ea..0d736c69 100644 --- a/lib/mu-contacts.cc +++ b/lib/mu-contacts.cc @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -168,6 +169,15 @@ Contacts::serialize() const return s; } + +// for now, we only care about _not_ having newlines. +static void +wash (std::string& str) +{ + str.erase(std::remove(str.begin(), str.end(), '\n'), str.end()); +} + + void Contacts::add (ContactInfo&& ci) { @@ -183,12 +193,20 @@ Contacts::add (ContactInfo&& ci) ++ci2.freq; if (ci.last_seen > ci2.last_seen) { ci2.last_seen = ci.last_seen; + wash(ci.email); ci2.email = std::move(ci.email); - if (!ci.name.empty()) + if (!ci.name.empty()) { + wash(ci.name); ci2.name = std::move(ci.name); + } } - } else - priv_->contacts_.emplace( + } + + wash(ci.name); + wash(ci.email); + wash(ci.full_address); + + priv_->contacts_.emplace( ContactUMap::value_type(std::move(email), std::move(ci))); }