libemailfunctions

email.h

Go to the documentation of this file.
00001 /*  -*- mode: C++; c-file-style: "gnu" -*-
00002 
00003     This file is part of kdepim.
00004     Copyright (c) 2004 KDEPIM developers
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License as published by the Free Software Foundation; either
00009     version 2 of the License, or (at your option) any later version.
00010 
00011     This library is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     Library General Public License for more details.
00015 
00016     You should have received a copy of the GNU Library General Public License
00017     along with this library; see the file COPYING.LIB.  If not, write to
00018     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019     Boston, MA 02110-1301, USA.
00020 */
00021 
00022 #ifndef EMAIL_H
00023 #define EMAIL_H
00024 
00025 #include <qstringlist.h>
00026 #include <qcstring.h>
00027 
00028 #include <kdepimmacros.h>
00029 
00039 namespace KPIM {
00040 
00044 enum EmailParseResult { AddressOk, AddressEmpty, UnexpectedEnd,
00045                         UnbalancedParens, MissingDomainPart,
00046                         UnclosedAngleAddr, UnopenedAngleAddr,
00047                         TooManyAts, UnexpectedComma,
00048                         TooFewAts, MissingLocalPart,
00049                         UnbalancedQuote, NoAddressSpec,
00050                         DisallowedChar, InvalidDisplayName };
00051 
00052 // Helper functions
00054 KDE_EXPORT QStringList splitEmailAddrList(const QString& aStr);
00055 
00075 KDE_EXPORT EmailParseResult splitAddress( const QCString & address,
00076                                QCString & displayName,
00077                                QCString & addrSpec,
00078                                QCString & comment );
00079 
00102 KDE_EXPORT EmailParseResult splitAddress( const QString & address,
00103                                QString & displayName,
00104                                QString & addrSpec,
00105                                QString & comment );
00106 
00116 KDE_EXPORT EmailParseResult isValidEmailAddress( const QString& aStr );
00117 
00125 KDE_EXPORT QString emailParseResultToString( EmailParseResult errorCode );
00126 
00137 KDE_EXPORT bool isValidSimpleEmailAddress( const QString& aStr );
00138 
00146 KDE_EXPORT QString simpleEmailAddressErrorMsg(); 
00147 
00155 KDE_EXPORT QCString getEmailAddress( const QCString & address );
00156 
00167 KDE_EXPORT QString getEmailAddress( const QString & address );
00168 
00176 KDE_EXPORT QCString getFirstEmailAddress( const QCString & addresses );
00177 
00188 KDE_EXPORT QString getFirstEmailAddress( const QString & addresses );
00189 
00198 KDE_EXPORT bool getNameAndMail(const QString& aStr, QString& name, QString& mail);
00199 
00205 KDE_EXPORT bool compareEmail( const QString& email1, const QString& email2,
00206                    bool matchName );
00207 
00220 KDE_EXPORT QString normalizedAddress( const QString & displayName,
00221                            const QString & addrSpec,
00222                            const QString & comment );
00223 
00229 KDE_EXPORT QString decodeIDN( const QString & addrSpec );
00230 
00237 KDE_EXPORT QString encodeIDN( const QString & addrSpec );
00238 
00245 KDE_EXPORT QString normalizeAddressesAndDecodeIDNs( const QString & addresses );
00246 
00250 KDE_EXPORT QString normalizeAddressesAndEncodeIDNs( const QString & str );
00251 
00255 KDE_EXPORT QString quoteNameIfNecessary( const QString& str );
00256 
00257 } // namespace
00258 
00259 #endif /* EMAIL_H */
00260