Messagelib
messagefactoryng.cpp
51static KMime::Types::Mailbox::List stripMyAddressesFromAddressList(const KMime::Types::Mailbox::List &list,
66MessageFactoryNG::MessageFactoryNG(const KMime::Message::Ptr &origMsg, Akonadi::Item::Id id, const Akonadi::Collection &col, QObject *parent)
81static KMime::Types::Mailbox::List authorMailboxes(const KMime::Message::Ptr &msg, const KMime::Types::Mailbox::List &mailingLists)
136 static const QRegularExpression rx{QStringLiteral("<\\s*mailto\\s*:([^@>]+@[^>]+)>"), QRegularExpression::CaseInsensitiveOption};
236 if (toList.isEmpty() || !mIdentityManager->thatIsMe(KMime::Types::Mailbox::listToUnicodeString(authors))) {
269 msg->subject()->fromUnicodeString(MessageCore::StringUtil::replySubject(mOrigMsg.data()), "utf-8");
345 msg->subject()->fromUnicodeString(MessageCore::StringUtil::forwardSubject(mOrigMsg.data()), "utf-8");
347 connect(job, &MessageFactoryForwardJob::forwardDone, this, &MessageFactoryNG::slotCreateForwardDone);
357QPair<KMime::Message::Ptr, QList<KMime::Content *>> MessageFactoryNG::createAttachedForward(const Akonadi::Item::List &items)
373 msg->subject()->fromUnicodeString(MessageCore::StringUtil::forwardSubject(firstMsg.data()), "utf-8");
386 MessageComposer::Util::addLinkInformation(msg, item.id(), Akonadi::MessageStatus::statusForwarded());
391 return QPair<KMime::Message::Ptr, QList<KMime::Content *>>(msg, QList<KMime::Content *>() << attachments);
394KMime::Content *MessageFactoryNG::createForwardAttachmentMessage(const KMime::Message::Ptr &fwdMsg)
410 cd->fromUnicodeString(fwdMsg->from()->asUnicodeString() + QLatin1StringView(": ") + subject, "utf-8");
414 MessageComposer::Util::addLinkInformation(fwdMsg, 0, Akonadi::MessageStatus::statusForwarded());
447MessageFactoryNG::createRedirect(const QString &toStr, const QString &ccStr, const QString &bccStr, int transportId, const QString &fcc, int identity)
467 const KIdentityManagementCore::Identity &ident = mIdentityManager->identityForUoidOrDefault(id);
471 QString::fromLocal8Bit("%1 (by way of %2 <%3>)").arg(mOrigMsg->from()->asUnicodeString(), ident.fullName(), ident.primaryEmailAddress());
474 const QString strFrom = QString::fromLocal8Bit("%1 <%2>").arg(ident.fullName(), ident.primaryEmailAddress());
481 const QString newDate = QLocale::c().toString(dt, QStringLiteral("ddd, ")) + dt.toString(Qt::RFC2822Date);
495 header->fromUnicodeString(MessageCore::StringUtil::generateMessageId(msg->sender()->asUnicodeString(), msgIdSuffix), "utf-8");
608 QString finalRecipient = mIdentityManager->identityForUoidOrDefault(identityUoid(mOrigMsg)).fullEmailAddr();
695QPair<KMime::Message::Ptr, KMime::Content *> MessageFactoryNG::createForwardDigestMIME(const Akonadi::Item::List &items)
707 digest->contentDescription()->fromUnicodeString(QStringLiteral("Digest of %1 messages.").arg(items.count()), "utf8");
728 part->contentDescription()->fromUnicodeString(fMsg->contentDescription()->asUnicodeString(), "utf8");
732 MessageComposer::Util::addLinkInformation(msg, item.id(), Akonadi::MessageStatus::statusForwarded());
814 qCDebug(MESSAGECOMPOSER_LOG) << "KEmailAddress::splitAddressList(receiptTo):" << KEmailAddress::splitAddressList(receiptTo).join(QLatin1Char('\n'));
836 KMime::Types::AddrSpecList returnPathList = MessageHelper::extractAddrSpecs(msg, "Return-Path");
837 const QString returnPath = returnPathList.isEmpty() ? QString() : returnPathList.front().localPart + QChar::fromLatin1('@') + returnPathList.front().domain;
859 KMime::Types::AddrSpecList returnPathList = MessageHelper::extractAddrSpecs(msg, QStringLiteral("Return-Path").toLatin1());
860 const QString returnPath = returnPathList.isEmpty() ? QString() : returnPathList.front().localPart + QChar::fromLatin1('@') + returnPathList.front().domain;
901QString MessageFactoryNG::replaceHeadersInString(const KMime::Message::Ptr &msg, const QString &s)
904 static QRegularExpression rx{QStringLiteral("\\$\\{([a-z0-9-]+)\\}"), QRegularExpression::CaseInsensitiveOption};
906 const QString sDate = KMime::DateFormatter::formatDate(KMime::DateFormatter::Localized, msg->date()->dateTime());
907 qCDebug(MESSAGECOMPOSER_LOG) << "creating mdn date:" << msg->date()->dateTime().toSecsSinceEpoch() << sDate;
qint64 Id
qint64 Id
static const MessageStatus statusReplied()
static const MessageStatus statusForwarded()
const Identity & identityForUoidOrDefault(uint uoid) const
bool thatIsMe(const QString &addressList) const
QString fullEmailAddr() const
uint uoid() const
static QString formatDate(DateFormatter::FormatType ftype, const QDateTime &t, const QString &data=QString(), bool shortFormat=true)
Localized
void fromUnicodeString(const QString &s, const QByteArray &b) override
QSharedPointer< Message > Ptr
static QList< Mailbox > listFrom7BitString(const QByteArray &s)
static QString listToUnicodeString(const QList< Mailbox > &mailboxes)
void createReplyAsync()
Create a new message that is a reply to this message, filling all required header fields with the pro...
Definition messagefactoryng.cpp:119
static bool MDNRequested(const KMime::Message::Ptr &msg)
When creating MDNs, the user needs to be asked for confirmation in specific cases according to RFC 22...
Definition messagefactoryng.cpp:785
void setIdentityManager(KIdentityManagementCore::IdentityManager *ident)
Set the identity manager to be used when creating messages.
Definition messagefactoryng.cpp:745
static bool MDNMDNUnknownOption(const KMime::Message::Ptr &msg)
If the MDN headers contain options that KMail can't parse.
Definition messagefactoryng.cpp:865
void setFolderIdentity(uint folderIdentityId)
Set the identity that is set for the folder in which the given message is.
Definition messagefactoryng.cpp:775
void setTemplate(const QString &templ)
Set the template to be used when creating the reply.
Definition messagefactoryng.cpp:765
KMime::Message::Ptr createMDN(KMime::MDN::ActionMode a, KMime::MDN::DispositionType d, KMime::MDN::SendingMode s, int mdnQuoteOriginal=0, const QList< KMime::MDN::DispositionModifier > &m=QList< KMime::MDN::DispositionModifier >())
Create a new message that is a MDN for this message, filling all required fields with proper values.
Definition messagefactoryng.cpp:589
QPair< KMime::Message::Ptr, KMime::Content * > createForwardDigestMIME(const Akonadi::Item::List &items)
Create a new forwarded MIME digest.
Definition messagefactoryng.cpp:695
void setQuote(bool quote)
Whether to quote the original message in the reply.
Definition messagefactoryng.cpp:760
KMime::Message::Ptr createRedirect(const QString &toStr, const QString &ccStr=QString(), const QString &bccStr=QString(), int transportId=-1, const QString &fcc=QString(), int identity=-1)
Create a new message that is a redirect to this message, filling all required header fields with the ...
Definition messagefactoryng.cpp:447
static bool MDNReturnPathEmpty(const KMime::Message::Ptr &msg)
If sending an MDN requires confirmation due to discrepancy between MDN header and Return-Path header.
Definition messagefactoryng.cpp:819
QPair< KMime::Message::Ptr, QList< KMime::Content * > > createAttachedForward(const Akonadi::Item::List &items=Akonadi::Item::List())
Create a forward from the given list of messages, attaching each message to be forwarded to the new f...
Definition messagefactoryng.cpp:357
KMime::Message::Ptr createDeliveryReceipt()
Create a new message that is a delivery receipt of this message, filling required header fields with ...
Definition messagefactoryng.cpp:559
void setSelection(const QString &selection)
Set the selection to be used to base the reply on.
Definition messagefactoryng.cpp:755
void setMailingListAddresses(const KMime::Types::Mailbox::List &listAddresses)
Set extra mailinglist addresses to send the created message to.
Definition messagefactoryng.cpp:770
static bool MDNConfirmMultipleRecipients(const KMime::Message::Ptr &msg)
If sending an MDN requires confirmation due to multiple addresses.
Definition messagefactoryng.cpp:799
void createForwardAsync()
Create a new message that is a forward of this message, filling all required header fields with the p...
Definition messagefactoryng.cpp:296
void putRepliesInSameFolder(Akonadi::Item::Id parentColId=-1)
Whether or not to put the reply to a message in the same folder as the message itself.
Definition messagefactoryng.cpp:780
void setReplyStrategy(MessageComposer::ReplyStrategy replyStrategy)
Set the reply strategy to use.
Definition messagefactoryng.cpp:750
KCODECS_EXPORT QStringList splitAddressList(const QString &aStr)
QString i18n(const char *text, const TYPE &arg...)
KCOREADDONS_EXPORT Result match(QStringView pattern, QStringView str)
Simple interface that both EncryptJob and SignEncryptJob implement so the composer can extract some e...
Definition attachmentcontrollerbase.h:27
QByteArray headerAsSendableString(const KMime::Message::Ptr &originalMessage)
Return the message header with the headers that should not be sent stripped off.
Definition stringutil.cpp:394
void removePrivateHeaderFields(const KMime::Message::Ptr &message, bool cleanUpHeader)
Removes all private header fields (e.g.
Definition stringutil.cpp:354
QByteArray asSendableString(const KMime::Message::Ptr &originalMessage)
Returns the message contents with the headers that should not be sent stripped off.
Definition stringutil.cpp:383
QString replySubject(KMime::Message *msg)
Return this mails subject, formatted for "reply" mails.
Definition stringutil.cpp:748
QString generateMessageId(const QString &address, const QString &suffix)
Generates the Message-Id.
Definition stringutil.cpp:300
QString forwardSubject(KMime::Message *msg)
Return this mails subject, formatted for "forward" mails.
Definition stringutil.cpp:740
void initHeader(const KMime::Message::Ptr &message, const KIdentityManagementCore::IdentityManager *identMan, uint id)
Initialize header fields.
Definition messagehelper.cpp:23
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...
Definition messagehelper.cpp:149
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...
Definition messagehelper.cpp:34
QChar fromLatin1(char c)
QDateTime currentDateTime()
qsizetype count() const const
T & first()
void reserve(qsizetype size)
QLocale c()
QString toString(QDate date, FormatType format) const const
Q_EMITQ_EMIT
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
T qobject_cast(QObject *object)
Types
CaseInsensitiveOption
QString arg(Args &&... args) const const
QString fromLatin1(QByteArrayView str)
QString fromLocal8Bit(QByteArrayView str)
bool isEmpty() const const
QString number(double n, char format, int precision)
QString & remove(QChar ch, Qt::CaseSensitivity cs)
QString & replace(QChar before, QChar after, Qt::CaseSensitivity cs)
QByteArray toUtf8() const const
QString join(QChar separator) const const
bool operator==(const QGraphicsApiFilter &reference, const QGraphicsApiFilter &sample)
CaseSensitive
WaitCursor
RFC2822Date
QTextStream & left(QTextStream &stream)
QTextStream & right(QTextStream &stream)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:12:43 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:12:43 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.