mirror of https://github.com/djcb/mu.git
update contacts-cache users for MessageContact
Since contacts-cache now uses MessageContact, update its users
This commit is contained in:
parent
4b9814be25
commit
7822d2633e
|
@ -522,7 +522,7 @@ Server::Private::contacts_handler(const Parameters& params)
|
||||||
|
|
||||||
auto rank{0};
|
auto rank{0};
|
||||||
Sexp::List contacts;
|
Sexp::List contacts;
|
||||||
store().contacts_cache().for_each([&](const ContactInfo& ci) {
|
store().contacts_cache().for_each([&](const MessageContact& ci) {
|
||||||
rank++;
|
rank++;
|
||||||
|
|
||||||
/* since the last time we got some contacts */
|
/* since the last time we got some contacts */
|
||||||
|
@ -532,11 +532,12 @@ Server::Private::contacts_handler(const Parameters& params)
|
||||||
if (personal && !ci.personal)
|
if (personal && !ci.personal)
|
||||||
return;
|
return;
|
||||||
/* only include newer-than-x contacts */
|
/* only include newer-than-x contacts */
|
||||||
if (after > ci.last_seen)
|
if (after > ci.message_date)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Sexp::List contact;
|
Sexp::List contact;
|
||||||
contact.add_prop(":address", Sexp::make_string(ci.full_address));
|
contact.add_prop(":address",
|
||||||
|
Sexp::make_string(ci.display_name()));
|
||||||
contact.add_prop(":rank", Sexp::make_number(rank));
|
contact.add_prop(":rank", Sexp::make_number(rank));
|
||||||
|
|
||||||
contacts.add(Sexp::make_list(std::move(contact)));
|
contacts.add(Sexp::make_list(std::move(contact)));
|
||||||
|
|
|
@ -1007,12 +1007,7 @@ add_contacts_terms_values(Xapian::Document& doc, MuMsg *msg,
|
||||||
termgen.index_text_without_positions(contact.email, 1, pfx);
|
termgen.index_text_without_positions(contact.email, 1, pfx);
|
||||||
|
|
||||||
/* and add to the contact store.*/
|
/* and add to the contact store.*/
|
||||||
contacts_cache.add(ContactInfo{
|
contacts_cache.add(std::move(contact));
|
||||||
contact.display_name(),
|
|
||||||
contact.email,
|
|
||||||
contact.name,
|
|
||||||
contacts_cache.is_personal(contact.email),
|
|
||||||
contact.message_date});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -276,7 +276,7 @@ struct ECData {
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
each_contact(const Mu::ContactInfo& ci, ECData& ecdata)
|
each_contact(const Mu::MessageContact& ci, ECData& ecdata)
|
||||||
{
|
{
|
||||||
if (ecdata.personal && ci.personal)
|
if (ecdata.personal && ci.personal)
|
||||||
return;
|
return;
|
||||||
|
@ -308,7 +308,7 @@ each_contact(const Mu::ContactInfo& ci, ECData& ecdata)
|
||||||
ci.name.c_str(),
|
ci.name.c_str(),
|
||||||
ci.email.c_str());
|
ci.email.c_str());
|
||||||
break;
|
break;
|
||||||
case MU_CONFIG_FORMAT_BBDB: each_contact_bbdb(ci.email, ci.name, ci.last_seen); break;
|
case MU_CONFIG_FORMAT_BBDB: each_contact_bbdb(ci.email, ci.name, ci.message_date); break;
|
||||||
case MU_CONFIG_FORMAT_CSV:
|
case MU_CONFIG_FORMAT_CSV:
|
||||||
mu_util_print_encoded("%s,%s\n",
|
mu_util_print_encoded("%s,%s\n",
|
||||||
ci.name.empty() ? "" : Mu::quote(ci.name).c_str(),
|
ci.name.empty() ? "" : Mu::quote(ci.name).c_str(),
|
||||||
|
@ -316,14 +316,14 @@ each_contact(const Mu::ContactInfo& ci, ECData& ecdata)
|
||||||
break;
|
break;
|
||||||
case MU_CONFIG_FORMAT_DEBUG: {
|
case MU_CONFIG_FORMAT_DEBUG: {
|
||||||
char datebuf[32];
|
char datebuf[32];
|
||||||
strftime(datebuf, sizeof(datebuf), "%F %T", gmtime(&ci.last_seen));
|
strftime(datebuf, sizeof(datebuf), "%F %T", gmtime(&ci.message_date));
|
||||||
g_print("%s\n\tname: %s\n\t%s\n\tpersonal: %s\n\tfreq: %zu\n"
|
g_print("%s\n\tname: %s\n\t%s\n\tpersonal: %s\n\tfreq: %zu\n"
|
||||||
"\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.full_address.c_str(),
|
ci.display_name().c_str(),
|
||||||
ci.personal ? "yes" : "no",
|
ci.personal ? "yes" : "no",
|
||||||
ci.freq,
|
ci.frequency,
|
||||||
datebuf);
|
datebuf);
|
||||||
} break;
|
} break;
|
||||||
default: print_plain(ci.email, ci.name, ecdata.color);
|
default: print_plain(ci.email, ci.name, ecdata.color);
|
||||||
|
|
Loading…
Reference in New Issue