libemailfunctions

email.h
Go to the documentation of this file.
1 /* -*- mode: C++; c-file-style: "gnu" -*-
2 
3  This file is part of kdepim.
4  Copyright (c) 2004 KDEPIM developers
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 */
21 
22 #ifndef EMAIL_H
23 #define EMAIL_H
24 
25 #include <tqstringlist.h>
26 #include <tqcstring.h>
27 
28 #include <kdepimmacros.h>
29 
39 namespace KPIM {
40 
44 enum EmailParseResult { AddressOk, AddressEmpty, UnexpectedEnd,
45  UnbalancedParens, MissingDomainPart,
46  UnclosedAngleAddr, UnopenedAngleAddr,
47  TooManyAts, UnexpectedComma,
48  TooFewAts, MissingLocalPart,
49  UnbalancedQuote, NoAddressSpec,
50  DisallowedChar, InvalidDisplayName };
51 
52 // Helper functions
54 KDE_EXPORT TQStringList splitEmailAddrList(const TQString& aStr);
55 
75 KDE_EXPORT EmailParseResult splitAddress( const TQCString & address,
76  TQCString & displayName,
77  TQCString & addrSpec,
78  TQCString & comment );
79 
102 KDE_EXPORT EmailParseResult splitAddress( const TQString & address,
103  TQString & displayName,
104  TQString & addrSpec,
105  TQString & comment );
106 
116 KDE_EXPORT EmailParseResult isValidEmailAddress( const TQString& aStr );
117 
125 KDE_EXPORT TQString emailParseResultToString( EmailParseResult errorCode );
126 
137 KDE_EXPORT bool isValidSimpleEmailAddress( const TQString& aStr );
138 
146 KDE_EXPORT TQString simpleEmailAddressErrorMsg();
147 
155 KDE_EXPORT TQCString getEmailAddress( const TQCString & address );
156 
167 KDE_EXPORT TQString getEmailAddress( const TQString & address );
168 
176 KDE_EXPORT TQCString getFirstEmailAddress( const TQCString & addresses );
177 
188 KDE_EXPORT TQString getFirstEmailAddress( const TQString & addresses );
189 
198 KDE_EXPORT bool getNameAndMail(const TQString& aStr, TQString& name, TQString& mail);
199 
205 KDE_EXPORT bool compareEmail( const TQString& email1, const TQString& email2,
206  bool matchName );
207 
220 KDE_EXPORT TQString normalizedAddress( const TQString & displayName,
221  const TQString & addrSpec,
222  const TQString & comment );
223 
229 KDE_EXPORT TQString decodeIDN( const TQString & addrSpec );
230 
237 KDE_EXPORT TQString encodeIDN( const TQString & addrSpec );
238 
245 KDE_EXPORT TQString normalizeAddressesAndDecodeIDNs( const TQString & addresses );
246 
250 KDE_EXPORT TQString normalizeAddressesAndEncodeIDNs( const TQString & str );
251 
255 KDE_EXPORT TQString quoteNameIfNecessary( const TQString& str );
256 
257 } // namespace
258 
259 #endif /* EMAIL_H */
260