• Skip to content
  • Skip to link menu
KDE 4.3 API Reference
  • KDE API Reference
  • KDE-PIM Libraries
  • Sitemap
  • Contact Us
 

kpimutils

Email Extraction Functions


Functions

bool KPIMUtils::compareEmail (const QString &email1, const QString &email2, bool matchName)
QString KPIMUtils::extractEmailAddress (const QString &address)
QByteArray KPIMUtils::extractEmailAddress (const QByteArray &address)
bool KPIMUtils::extractEmailAddressAndName (const QString &aStr, QString &mail, QString &name)
QString KPIMUtils::firstEmailAddress (const QString &addresses)
QByteArray KPIMUtils::firstEmailAddress (const QByteArray &addresses)
QString KPIMUtils::normalizedAddress (const QString &displayName, const QString &addrSpec, const QString &comment)
QString KPIMUtils::quoteNameIfNecessary (const QString &str)

Function Documentation

bool KPIMUtils::compareEmail ( const QString &  email1,
const QString &  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.

Parameters:
email1 the first email address to use for comparison
email2 the second email address to use for comparison
matchName if set to true email address and displayname must match
Returns:
true if the comparison matches true in all other cases

Definition at line 881 of file email.cpp.

QString KPIMUtils::extractEmailAddress ( const QString &  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.user@example.org in the example

Definition at line 656 of file email.cpp.

QByteArray KPIMUtils::extractEmailAddress ( const QByteArray &  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.user@example.org in the example

Definition at line 637 of file email.cpp.

bool KPIMUtils::extractEmailAddressAndName ( const QString &  aStr,
QString &  mail,
QString &  name 
)

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.

Parameters:
aStr an email address, e.g "Joe User <joe.user@example.org>"
name only out: returns the displayname, "Joe User" in the example
mail only out: returns the email address "joe.user@example.org" in the example
Returns:
true if both name and email address are not empty

Definition at line 687 of file email.cpp.

QString KPIMUtils::firstEmailAddress ( const QString &  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.user@example.org in the example

Definition at line 681 of file email.cpp.

QByteArray KPIMUtils::firstEmailAddress ( const QByteArray &  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.user@example.org in the example

Definition at line 662 of file email.cpp.

QString KPIMUtils::normalizedAddress ( const QString &  displayName,
const QString &  addrSpec,
const QString &  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

Definition at line 894 of file email.cpp.

QString KPIMUtils::quoteNameIfNecessary ( const QString &  str  ) 

Add quote characters around the given string if it contains a character that makes that necessary, in an email name, such as ",".

Parameters:
str a string that may need quoting
Returns:
the string quoted if necessary

Definition at line 1050 of file email.cpp.

kpimutils

Skip menu "kpimutils"
  • Main Page
  • Modules
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members

KDE-PIM Libraries

Skip menu "KDE-PIM Libraries"
  • akonadi
  • kabc
  • kblog
  • kcal
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  • kldap
  • kmime
  • kpimidentities
  • kpimtextedit
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.5.8
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal