KCodecs

kemailaddress.h
Go to the documentation of this file.
1 /*
2  SPDX-FileCopyrightText: 2004 Matt Douhan <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
16 #ifndef KCODECS_EMAILADDRESS_H
17 #define KCODECS_EMAILADDRESS_H
18 
19 #include <QUrl>
20 
21 #include <QStringList>
22 #include <QByteArray>
23 
24 #include <kcodecs_export.h>
25 
29 namespace KEmailAddress
30 {
31 
64  NoAddressSpec,
68 };
69 
76 KCODECS_EXPORT
78 
99 KCODECS_EXPORT
101  QByteArray &displayName,
102  QByteArray &addrSpec,
103  QByteArray &comment);
104 
128 KCODECS_EXPORT
129 EmailParseResult splitAddress(const QString &address,
130  QString &displayName,
131  QString &addrSpec,
132  QString &comment);
133 
144 KCODECS_EXPORT
146 
157 KCODECS_EXPORT
159  QString &badAddr);
160 
173 KCODECS_EXPORT
175 
192 KCODECS_EXPORT
193 bool isValidSimpleAddress(const QString &aStr);
194 
202 KCODECS_EXPORT
204 
219 KCODECS_EXPORT
221 
222 /*KF6 merge with above*/
223 
235 KCODECS_EXPORT
236 QByteArray extractEmailAddress(const QByteArray &address, QString &errorMessage);
237 
249 KCODECS_EXPORT
250 QString extractEmailAddress(const QString &address);
251 
263 KCODECS_EXPORT
264 QString extractEmailAddress(const QString &address, QString &errorMessage);
265 
275 /*KF6 merge with above*/
276 KCODECS_EXPORT
277 QByteArray firstEmailAddress(const QByteArray &addresses);
278 
290 KCODECS_EXPORT
291 QByteArray firstEmailAddress(const QByteArray &addresses, QString &errorMessage);
292 
304 KCODECS_EXPORT
305 QString firstEmailAddress(const QString &addresses);
306 
320 KCODECS_EXPORT
321 QString firstEmailAddress(const QString &addresses, QString &errorMessage);
322 
323 
342 KCODECS_EXPORT
343 bool extractEmailAddressAndName(const QString &aStr, QString &mail,
344  QString &name);
345 
357 KCODECS_EXPORT
358 bool compareEmail(const QString &email1, const QString &email2,
359  bool matchName);
360 
375 KCODECS_EXPORT
376 QString normalizedAddress(const QString &displayName,
377  const QString &addrSpec,
378  const QString &comment = QString());
379 
392 KCODECS_EXPORT
393 QString fromIdn(const QString &addrSpec);
394 
401 KCODECS_EXPORT
402 QString toIdn(const QString &addrSpec);
403 
410 KCODECS_EXPORT
412 
420 KCODECS_EXPORT
422 
433 KCODECS_EXPORT
435 
442 KCODECS_EXPORT
443 QUrl encodeMailtoUrl(const QString &mailbox);
444 
450 KCODECS_EXPORT
451 QString decodeMailtoUrl(const QUrl &mailtoUrl);
452 
453 } // namespace KEmailAddress
454 
455 #endif
KCODECS_EXPORT QUrl encodeMailtoUrl(const QString &mailbox)
Creates a valid mailto: URL from the given mailbox.
Comma not allowed here.
Definition: kemailaddress.h:60
KCODECS_EXPORT EmailParseResult isValidAddress(const QString &aStr)
Validates an email address in the form of "Joe User" [email protected]
KCODECS_EXPORT QString normalizeAddressesAndDecodeIdn(const QString &addresses)
Normalizes all email addresses in the given list and decodes all IDNs.
KCODECS_EXPORT EmailParseResult splitAddress(const QByteArray &address, QByteArray &displayName, QByteArray &addrSpec, QByteArray &comment)
Splits the given address into display name, email address and comment.
The address is empty.
Definition: kemailaddress.h:53
KCODECS_EXPORT bool isValidSimpleAddress(const QString &aStr)
Validates an email address in the form of [email protected]
Quotes (single or double) not matched.
Definition: kemailaddress.h:63
KCODECS_EXPORT QByteArray firstEmailAddress(const QByteArray &addresses)
Returns the pure email address (addr-spec in RFC2822) of the first email address of a list of address...
KCODECS_EXPORT bool extractEmailAddressAndName(const QString &aStr, QString &mail, QString &name)
Return email address and name from string.
KCODECS_EXPORT QString simpleEmailAddressErrorMsg()
Returns a i18n string to be used in msgboxes.
> with no preceding <
Definition: kemailaddress.h:58
No address specified, only domain.
Definition: kemailaddress.h:62
An invalid displayname detected in address.
Definition: kemailaddress.h:66
No domain in address.
Definition: kemailaddress.h:56
KCODECS_EXPORT QString normalizeAddressesAndEncodeIdn(const QString &str)
Normalizes all email addresses in the given list and encodes all IDNs in punycode.
KCODECS_EXPORT EmailParseResult isValidAddressList(const QString &aStr, QString &badAddr)
Validates a list of email addresses, and also allow aliases and distribution lists to be expanded bef...
KCODECS_EXPORT QString emailParseResultToString(EmailParseResult errorCode)
Translate the enum errorcodes from emailParseResult into i18n&#39;d strings that can be used for msg boxe...
Email is valid.
Definition: kemailaddress.h:52
An invalid character detected in address.
Definition: kemailaddress.h:65
KCODECS_EXPORT QString toIdn(const QString &addrSpec)
Encodes the domain part of the given addr-spec in punycode if it&#39;s an IDN.
More than one @ in address.
Definition: kemailaddress.h:59
KCODECS_EXPORT QByteArray extractEmailAddress(const QByteArray &address)
Returns the pure email address (addr-spec in RFC2822) of the given address (mailbox in RFC2822)...
KCODECS_EXPORT QStringList splitAddressList(const QString &aStr)
Split a comma separated list of email addresses.
KCODECS_EXPORT QString fromIdn(const QString &addrSpec)
Decodes the punycode domain part of the given addr-spec if it&#39;s an IDN.
Missing @ in address.
Definition: kemailaddress.h:61
KCODECS_EXPORT QString normalizedAddress(const QString &displayName, const QString &addrSpec, const QString &comment=QString())
Returns a normalized address built from the given parts.
KCODECS_EXPORT QString quoteNameIfNecessary(const QString &str)
Add quote characters around the given string if it contains a character that makes that necessary...
Something is unbalanced.
Definition: kemailaddress.h:54
EmailParseResult
Email validation result.
Definition: kemailaddress.h:51
KCODECS_EXPORT QString decodeMailtoUrl(const QUrl &mailtoUrl)
Extracts the mailbox out of the mailto: URL.
KCODECS_EXPORT bool compareEmail(const QString &email1, const QString &email2, bool matchName)
Compare two email addresses.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Fri Jun 5 2020 22:47:13 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.