Messagelib

messagecore/src/utils/util.cpp
1 /* SPDX-FileCopyrightText: 2020 Sandro KnauƟ <[email protected]>
2 
3  SPDX-License-Identifier: LGPL-2.0-or-later
4 */
5 
6 #include "util.h"
7 
8 #include <KIdentityManagement/IdentityManager>
9 
10 #include <KMime/Message>
11 
12 using namespace MessageCore;
13 
15 Util::identityForMessage(KMime::Message *msg, const KIdentityManagement::IdentityManager *const identMgr, uint folderIdentityId)
16 {
17  const auto &identity = identMgr->identityForAddress(msg->to()->asUnicodeString() + QLatin1String(", ") + msg->cc()->asUnicodeString());
18 
19  if (identity.isNull()) {
20  return identMgr->identityForUoidOrDefault(folderIdentityId);
21  }
22 
23  return identity;
24 }
QString asUnicodeString() const override
const Identity & identityForAddress(const QString &addresses) const
KMime::Headers::Cc * cc(bool create=true)
KMime::Headers::To * to(bool create=true)
const Identity & identityForUoidOrDefault(uint uoid) const
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Thu Dec 2 2021 23:06:10 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.