Messagelib

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

KDE's Doxygen guidelines are available online.