namespace {
template<typename ContactRec>
- Recipient toRecip(const std::shared_ptr<ContactRec> &rec)
+ Recipient toRecip(const ContactRec &rec)
{
Recipient res;
- if (rec) {
- res.setDispName(rec->getDispName());
- res.setAddress(rec->getAddress());
+ res.setDispName(rec.getDispName());
+ res.setAddress(rec.getAddress());
- if (res.getDispName().empty())
- res.setDispName(res.getAddress());
- }
+ if (res.getDispName().empty())
+ res.setDispName(res.getAddress());
+
+ return res;
+ }
+ template<typename ContactRec>
+ Recipient toRecip(const std::shared_ptr<ContactRec> &rec)
+ {
+ Recipient res;
+ if (rec)
+ toRecip(*rec);
return res;
}
do {
auto &rec = list->get();
if (isValid(rec)) {
- results.emplace_back(Recipient(rec.getAddress(), rec.getDispName()));
+ results.push_back(toRecip(rec));
} else {
MSG_LOG("Skip invalid contact: ", rec.getAddress());
}