Classes | |
class | IdMapper |
class | NetworkStatus |
Enumerations | |
enum | EmailParseResult { AddressOk , AddressEmpty , UnexpectedEnd , UnbalancedParens , MissingDomainPart , UnclosedAngleAddr , UnopenedAngleAddr , TooManyAts , UnexpectedComma , TooFewAts , MissingLocalPart , UnbalancedQuote , NoAddressSpec , DisallowedChar , InvalidDisplayName } |
Functions | |
TDE_EXPORT TQStringList | splitEmailAddrList (const TQString &aStr) |
TDE_EXPORT EmailParseResult | splitAddress (const TQCString &address, TQCString &displayName, TQCString &addrSpec, TQCString &comment) |
TDE_EXPORT EmailParseResult | splitAddress (const TQString &address, TQString &displayName, TQString &addrSpec, TQString &comment) |
TDE_EXPORT EmailParseResult | isValidEmailAddress (const TQString &aStr) |
TDE_EXPORT TQString | emailParseResultToString (EmailParseResult errorCode) |
TDE_EXPORT bool | isValidSimpleEmailAddress (const TQString &aStr) |
TDE_EXPORT TQString | simpleEmailAddressErrorMsg () |
TDE_EXPORT TQCString | getEmailAddress (const TQCString &address) |
TDE_EXPORT TQString | getEmailAddress (const TQString &address) |
TDE_EXPORT TQCString | getFirstEmailAddress (const TQCString &addresses) |
TDE_EXPORT TQString | getFirstEmailAddress (const TQString &addresses) |
TDE_EXPORT bool | getNameAndMail (const TQString &aStr, TQString &name, TQString &mail) |
TDE_EXPORT bool | compareEmail (const TQString &email1, const TQString &email2, bool matchName) |
TDE_EXPORT TQString | normalizedAddress (const TQString &displayName, const TQString &addrSpec, const TQString &comment) |
TDE_EXPORT TQString | decodeIDN (const TQString &addrSpec) |
TDE_EXPORT TQString | encodeIDN (const TQString &addrSpec) |
TDE_EXPORT TQString | normalizeAddressesAndDecodeIDNs (const TQString &addresses) |
TDE_EXPORT TQString | normalizeAddressesAndEncodeIDNs (const TQString &str) |
TDE_EXPORT TQString | quoteNameIfNecessary (const TQString &str) |
Detailed Description
KPIM holds all kinds of functions specific to KDE PIM.
The KPIM namespace hides away functions, enums, and other things that are KDE PIM specific and that we don't want to have polluting the global namespace.
Enumeration Type Documentation
◆ EmailParseResult
Function Documentation
◆ compareEmail()
TDE_EXPORT bool KPIM::compareEmail | ( | const TQString & | email1, |
const TQString & | email2, | ||
bool | matchName | ||
) |
Compare two email addresses.
If matchName is false, it just checks the email address, and returns true if this matches. If matchName is true, both the name and the email must be the same.
◆ decodeIDN()
TDE_EXPORT TQString KPIM::decodeIDN | ( | const TQString & | addrSpec | ) |
Decodes the punycode domain part of the given addr-spec if it's an IDN.
- Parameters
-
addrSpec a pure 7-bit email address (addr-spec in RFC2822)
- Returns
- the email address with Unicode domain
◆ emailParseResultToString()
TQString KPIM::emailParseResultToString | ( | EmailParseResult | errorCode | ) |
◆ encodeIDN()
TDE_EXPORT TQString KPIM::encodeIDN | ( | const TQString & | addrSpec | ) |
Encodes the domain part of the given addr-spec in punycode if it's an IDN.
- Parameters
-
addrSpec a pure email address with Unicode domain
- Returns
- the email address with domain in punycode
◆ getEmailAddress() [1/2]
TDE_EXPORT TQCString KPIM::getEmailAddress | ( | const TQCString & | address | ) |
Returns the pure email address (addr-spec in RFC2822) of the given address (mailbox in RFC2822).
- Parameters
-
address an email address, e.g. "Joe User <joe.user@example.org>"
- Returns
- the addr-spec of address, i.e. joe.u in the example ser@ examp le.o rg
◆ getEmailAddress() [2/2]
TDE_EXPORT TQString KPIM::getEmailAddress | ( | const TQString & | address | ) |
This is an overloaded member function, provided for convenience.
It behaves essentially like the above function.
Returns the pure email address (addr-spec in RFC2822) of the given address (mailbox in RFC2822).
- Parameters
-
address an email address, e.g. "Joe User <joe.user@example.org>"
- Returns
- the addr-spec of address, i.e. joe.u in the example ser@ examp le.o rg
◆ getFirstEmailAddress() [1/2]
TDE_EXPORT TQCString KPIM::getFirstEmailAddress | ( | const TQCString & | addresses | ) |
Returns the pure email address (addr-spec in RFC2822) of the first email address of a list of addresses.
- Parameters
-
addresses an email address, e.g. "Joe User <joe.user@example.org>"
- Returns
- the addr-spec of addresses, i.e. joe.u in the example ser@ examp le.o rg
◆ getFirstEmailAddress() [2/2]
TDE_EXPORT TQString KPIM::getFirstEmailAddress | ( | const TQString & | addresses | ) |
This is an overloaded member function, provided for convenience.
It behaves essentially like the above function.
Returns the pure email address (addr-spec in RFC2822) of the first email address of a list of addresses.
- Parameters
-
addresses an email address, e.g. "Joe User <joe.user@example.org>"
- Returns
- the addr-spec of addresses, i.e. joe.u in the example ser@ examp le.o rg
◆ getNameAndMail()
TDE_EXPORT bool KPIM::getNameAndMail | ( | const TQString & | aStr, |
TQString & | name, | ||
TQString & | |||
) |
Return email address and name from string.
Examples: "Stefan Taferner <taferner@example.org>" returns "taferner@example.org" and "Stefan Taferner". "joe@example.com" returns "joe@example.com" and "". Note that this only returns the first address. Also note that the return value is TRUE if both the name and the mail are not empty: this does NOT tell you if mail contains a valid email address or just some rubbish.
◆ isValidEmailAddress()
KPIM::EmailParseResult KPIM::isValidEmailAddress | ( | const TQString & | aStr | ) |
Validates an email address in the form of "Joe User" joe@e. xamp le.or g
Returns AddressOk if no error was encountered. Otherwise an appropriate error code is returned.
- Parameters
-
aStr a single email address, example: Joe User (comment1) joe.u ser@ examp le.o rg
- Returns
- AddressOk if no error was encountered. Otherwise an appropriate error code is returned.
◆ isValidSimpleEmailAddress()
bool KPIM::isValidSimpleEmailAddress | ( | const TQString & | aStr | ) |
Validates an email address in the form of joe@e. xamp le.or g
Returns true if no error was encountered. This method should be used when the input field should not allow a "full" email address with comments and other special cases that normally are valid in an email address.
- Parameters
-
aStr a single email address, example: joe.u ser@ examp le.o rg
- Returns
- true if no error was encountered.
◆ normalizeAddressesAndDecodeIDNs()
TDE_EXPORT TQString KPIM::normalizeAddressesAndDecodeIDNs | ( | const TQString & | addresses | ) |
Normalizes all email addresses in the given list and decodes all IDNs.
- Parameters
-
addresses a list of email addresses with punycoded IDNs
- Returns
- the email addresses in normalized form with Unicode IDNs
◆ normalizeAddressesAndEncodeIDNs()
TDE_EXPORT TQString KPIM::normalizeAddressesAndEncodeIDNs | ( | const TQString & | str | ) |
Normalizes all email addresses in the given list and encodes all IDNs in punycode.
◆ normalizedAddress()
TDE_EXPORT TQString KPIM::normalizedAddress | ( | const TQString & | displayName, |
const TQString & | addrSpec, | ||
const TQString & | comment | ||
) |
Returns a normalized address built from the given parts.
The normalized address is of one the following forms:
- displayName (comment) <addrSpec>
- displayName <addrSpec>
- comment <addrSpec>
- addrSpec
- Parameters
-
displayName the display name of the address addrSpec the actual email address (addr-spec in RFC 2822) comment a comment
- Returns
- a normalized address built from the given parts
◆ quoteNameIfNecessary()
TDE_EXPORT TQString KPIM::quoteNameIfNecessary | ( | const TQString & | str | ) |
Add quote characters around the given string if it contains a character that makes that necessary, in an email name, such as ",".
◆ simpleEmailAddressErrorMsg()
TDE_EXPORT TQString KPIM::simpleEmailAddressErrorMsg | ( | ) |
Returns a i18n string to be used in msgboxes this allows for error messages to be the same across the board.
- Returns
- An i18n ready string for use in msgboxes.
◆ splitAddress() [1/2]
KPIM::EmailParseResult KPIM::splitAddress | ( | const TQCString & | address, |
TQCString & | displayName, | ||
TQCString & | addrSpec, | ||
TQCString & | comment | ||
) |
Splits the given address into display name, email address and comment.
Returns AddressOk if no error was encountered. Otherwise an appropriate error code is returned. In case of an error the values of displayName, addrSpec and comment are undefined.
- Parameters
-
address a single email address, example: Joe User (comment1) joe.u (comment2) ser@ examp le.o rg displayName only out: the display-name of the email address, i.e. "Joe User" in the example; in case of an error the return value is undefined addrSpec only out: the addr-spec, i.e. "joe.user@example.org" in the example; in case of an error the return value is undefined comment only out: the space-separated comments, i.e. "comment1 comment2" in the example; in case of an error the return value is undefined
- Returns
- AddressOk if no error was encountered. Otherwise an appropriate error code is returned.
◆ splitAddress() [2/2]
KPIM::EmailParseResult KPIM::splitAddress | ( | const TQString & | address, |
TQString & | displayName, | ||
TQString & | addrSpec, | ||
TQString & | comment | ||
) |
This is an overloaded member function, provided for convenience.
It behaves essentially like the above function.
Splits the given address into display name, email address and comment. Returns AddressOk if no error was encountered. Otherwise an appropriate error code is returned. In case of an error the values of displayName, addrSpec and comment are undefined.
- Parameters
-
address a single email address, example: Joe User (comment1) joe.u (comment2) ser@ examp le.o rg displayName only out: the display-name of the email address, i.e. "Joe User" in the example; in case of an error the return value is undefined addrSpec only out: the addr-spec, i.e. "joe.user@example.org" in the example; in case of an error the return value is undefined comment only out: the space-separated comments, i.e. "comment1 comment2" in the example; in case of an error the return value is undefined
- Returns
- AddressOk if no error was encountered. Otherwise an appropriate error code is returned.