libemailfunctions

email.h

Go to the documentation of this file.
00001 /*  -*- mode: C++; c-file-style: "gnu" -*-
00002 
00003     This file is part of tdepim.
00004     Copyright (c) 2004 TDEPIM 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 <tqstringlist.h>
00026 #include <tqcstring.h>
00027 
00028 #include <tdepimmacros.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 TQStringList splitEmailAddrList(const TQString& aStr);
00055 
00075 KDE_EXPORT EmailParseResult splitAddress( const TQCString & address,
00076                                TQCString & displayName,
00077                                TQCString & addrSpec,
00078                                TQCString & comment );
00079 
00102 KDE_EXPORT EmailParseResult splitAddress( const TQString & address,
00103                                TQString & displayName,
00104                                TQString & addrSpec,
00105                                TQString & comment );
00106 
00116 KDE_EXPORT EmailParseResult isValidEmailAddress( const TQString& aStr );
00117 
00125 KDE_EXPORT TQString emailParseResultToString( EmailParseResult errorCode );
00126 
00137 KDE_EXPORT bool isValidSimpleEmailAddress( const TQString& aStr );
00138 
00146 KDE_EXPORT TQString simpleEmailAddressErrorMsg(); 
00147 
00155 KDE_EXPORT TQCString getEmailAddress( const TQCString & address );
00156 
00167 KDE_EXPORT TQString getEmailAddress( const TQString & address );
00168 
00176 KDE_EXPORT TQCString getFirstEmailAddress( const TQCString & addresses );
00177 
00188 KDE_EXPORT TQString getFirstEmailAddress( const TQString & addresses );
00189 
00198 KDE_EXPORT bool getNameAndMail(const TQString& aStr, TQString& name, TQString& mail);
00199 
00205 KDE_EXPORT bool compareEmail( const TQString& email1, const TQString& email2,
00206                    bool matchName );
00207 
00220 KDE_EXPORT TQString normalizedAddress( const TQString & displayName,
00221                            const TQString & addrSpec,
00222                            const TQString & comment );
00223 
00229 KDE_EXPORT TQString decodeIDN( const TQString & addrSpec );
00230 
00237 KDE_EXPORT TQString encodeIDN( const TQString & addrSpec );
00238 
00245 KDE_EXPORT TQString normalizeAddressesAndDecodeIDNs( const TQString & addresses );
00246 
00250 KDE_EXPORT TQString normalizeAddressesAndEncodeIDNs( const TQString & str );
00251 
00255 KDE_EXPORT TQString quoteNameIfNecessary( const TQString& str );
00256 
00257 } // namespace
00258 
00259 #endif /* EMAIL_H */
00260