Messagelib

messagehelper.h
1/*
2 SPDX-FileCopyrightText: 2009 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.net
3 SPDX-FileCopyrightText: 2009 Andras Mantia <andras@kdab.net>
4
5 SPDX-License-Identifier: GPL-2.0-or-later
6*/
7
8#pragma once
9
10#include "messagecomposer_export.h"
11
12#include <Akonadi/Item>
13#include <KMime/Headers>
14#include <KMime/Message>
15
16namespace KIdentityManagementCore
17{
18class IdentityManager;
19}
20
21namespace KMime
22{
23class Message;
24}
25
26/**
27 * Contains random helper methods when dealing with messages.
28 * TODO: cleanup and organize, along with similar methods in messageviewer.
29 */
30namespace MessageHelper
31{
32/** Initialize header fields. Should be called on new messages
33 if they are not set manually. E.g. before composing. Calling
34 of setAutomaticFields(), see below, is still required. */
35void MESSAGECOMPOSER_EXPORT initHeader(const KMime::Message::Ptr &message, const KIdentityManagementCore::IdentityManager *identMan, uint id = 0);
36
37/** Set the from, to, cc, bcc, encryption etc headers as specified in the
38 * given identity. */
39void applyIdentity(const KMime::Message::Ptr &message, const KIdentityManagementCore::IdentityManager *identMan, uint id);
40
41/** Initialize headers fields according to the identity and the transport
42 header of the given original message */
44 const KMime::Message::Ptr &orgiMsg,
46 uint id,
47 bool idHeaders = true);
48
49MESSAGECOMPOSER_EXPORT KMime::Types::AddrSpecList extractAddrSpecs(const KMime::Message::Ptr &msg, const QByteArray &header);
50
51/** Set fields that are either automatically set (Message-id)
52 or that do not change from one message to another (MIME-Version).
53 Call this method before sending *after* all changes to the message
54 are done because this method does things different if there are
55 attachments / multiple body parts. */
56void setAutomaticFields(const KMime::Message::Ptr &msg, bool isMultipart = false);
57}
Contains random helper methods when dealing with messages.
void applyIdentity(const KMime::Message::Ptr &message, const KIdentityManagementCore::IdentityManager *identMan, uint id)
Set the from, to, cc, bcc, encryption etc headers as specified in the given identity.
void initHeader(const KMime::Message::Ptr &message, const KIdentityManagementCore::IdentityManager *identMan, uint id)
Initialize header fields.
void setAutomaticFields(const KMime::Message::Ptr &msg, bool aIsMulti)
Set fields that are either automatically set (Message-id) or that do not change from one message to a...
void initFromMessage(const KMime::Message::Ptr &msg, const KMime::Message::Ptr &origMsg, KIdentityManagementCore::IdentityManager *identMan, uint id, bool idHeaders)
Initialize headers fields according to the identity and the transport header of the given original me...
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:33:25 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.