williamr@2
|
1 |
// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
2 |
// All rights reserved.
|
williamr@2
|
3 |
// This component and the accompanying materials are made available
|
williamr@2
|
4 |
// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
|
williamr@2
|
5 |
// which accompanies this distribution, and is available
|
williamr@2
|
6 |
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
|
williamr@2
|
7 |
//
|
williamr@2
|
8 |
// Initial Contributors:
|
williamr@2
|
9 |
// Nokia Corporation - initial contribution.
|
williamr@2
|
10 |
//
|
williamr@2
|
11 |
// Contributors:
|
williamr@2
|
12 |
//
|
williamr@2
|
13 |
// Description:
|
williamr@2
|
14 |
//
|
williamr@2
|
15 |
|
williamr@2
|
16 |
#if !defined (__MIUTPARS_H__)
|
williamr@2
|
17 |
#define __MIUTPARS_H__
|
williamr@2
|
18 |
|
williamr@2
|
19 |
#include <e32base.h>
|
williamr@2
|
20 |
|
williamr@2
|
21 |
// comment out line below to switch ON Internet message checking
|
williamr@2
|
22 |
//#define __NO_EMAIL_ADDRESS_CHECKING__
|
williamr@2
|
23 |
|
williamr@2
|
24 |
class TImMessageField
|
williamr@2
|
25 |
/** Parses email message header fields for valid Internet email addresses,
|
williamr@2
|
26 |
comments and aliases.
|
williamr@2
|
27 |
|
williamr@2
|
28 |
A comment is a string surrounded by parentheses, as defined in RFC822, 3.1.4.
|
williamr@2
|
29 |
|
williamr@2
|
30 |
An alias is defined as any substring which appears to the left of a legal email address:
|
williamr@2
|
31 |
for example, the string "this is an alias" in "this is an alias <an.email@address.com>".
|
williamr@2
|
32 |
|
williamr@2
|
33 |
For email addresses, the string being parsed:
|
williamr@2
|
34 |
1) must contain an @ character, surrounded by valid address characters;
|
williamr@2
|
35 |
2) may not contain more than one address or @ character;
|
williamr@2
|
36 |
3) may contain aliases and comments.
|
williamr@2
|
37 |
|
williamr@2
|
38 |
Note the following about the implementation of this class:
|
williamr@2
|
39 |
|
williamr@2
|
40 |
1. Functions that test subject lines, ValidSubjectLine(), and alias names, ValidAliasName(), were
|
williamr@2
|
41 |
initially written to test that the strings did not contain characters outside a limited
|
williamr@2
|
42 |
ASCII range. Unicode characters are now allowed, so these functions now always return true.
|
williamr@2
|
43 |
|
williamr@2
|
44 |
2. Of the four overloads of GetValidInternetEmailAddressFromString(), only the first has a meaningful
|
williamr@2
|
45 |
implementation.
|
williamr@2
|
46 |
|
williamr@2
|
47 |
@publishedAll
|
williamr@2
|
48 |
@released
|
williamr@2
|
49 |
*/
|
williamr@2
|
50 |
{
|
williamr@2
|
51 |
public:
|
williamr@2
|
52 |
IMPORT_C TBool ValidInternetEmailAddress(const TDesC16& aAddress);
|
williamr@2
|
53 |
IMPORT_C TBool ValidInternetEmailAddress(const TDesC16& aAddress, TInt& rFirstBadCharPos);
|
williamr@2
|
54 |
IMPORT_C TBool ValidInternetEmailAddress(const TDesC16& aAddress, TInt& rFirstChar, TInt& rLastChar);
|
williamr@2
|
55 |
IMPORT_C TBool ValidInternetEmailAddress(const TDesC16& aAddress, TInt& rFirstChar, TInt& rLastChar, TInt& rFirstBadCharPos);
|
williamr@2
|
56 |
|
williamr@2
|
57 |
IMPORT_C TBool ValidInternetEmailAddressChar(const TChar& aChar);
|
williamr@2
|
58 |
|
williamr@2
|
59 |
IMPORT_C TBool ValidSubjectLine(const TDesC16& aSubjectLine);
|
williamr@2
|
60 |
IMPORT_C TBool ValidSubjectLine(const TDesC16& aSubjectLine, TInt& rFirstBadCharPos);
|
williamr@2
|
61 |
|
williamr@2
|
62 |
IMPORT_C TBool ValidSubjectLineChar(const TChar& aChar);
|
williamr@2
|
63 |
|
williamr@2
|
64 |
IMPORT_C TBool ValidAliasName(const TDesC16& aAliasName);
|
williamr@2
|
65 |
IMPORT_C TBool ValidAliasName(const TDesC16& aAliasName, TInt& rFirstBadCharPos);
|
williamr@2
|
66 |
|
williamr@2
|
67 |
IMPORT_C TPtrC16 GetValidInternetEmailAddressFromString(const TDesC16& aAddress);
|
williamr@2
|
68 |
IMPORT_C TPtrC16 GetValidInternetEmailAddressFromString(const TDesC16& aAddress, TInt& rError);
|
williamr@2
|
69 |
IMPORT_C TPtrC16 GetValidInternetEmailAddressFromString(const TDesC16& aAddress, TInt& rFirstChar, TInt& rLastChar);
|
williamr@2
|
70 |
IMPORT_C TPtrC16 GetValidInternetEmailAddressFromString(const TDesC16& aAddress, TInt& rFirstChar, TInt& rLastChar, TInt& rError);
|
williamr@2
|
71 |
|
williamr@2
|
72 |
IMPORT_C TPtrC16 GetValidAlias(const TDesC16& aAddress);
|
williamr@2
|
73 |
IMPORT_C TPtrC16 GetValidAlias(const TDesC16& aAddress, TInt& rError);
|
williamr@2
|
74 |
|
williamr@2
|
75 |
IMPORT_C TPtrC16 GetValidComment(const TDesC16& aAddress);
|
williamr@2
|
76 |
IMPORT_C TPtrC16 GetValidComment(const TDesC16& aAddress, TInt& rError);
|
williamr@2
|
77 |
TBool TruncateAddressString(const TDesC16& aDesc, TInt aLimit, TInt& aLastChar);
|
williamr@2
|
78 |
private:
|
williamr@2
|
79 |
TBool isValidEmailAddress(const TDesC16& aAddress, TInt& rFirstChar, TInt& rLastChar);
|
williamr@2
|
80 |
TBool isLegalEmailAddress(const TDesC16& aAddress, TInt& rFirstChar, TInt& rLastChar);
|
williamr@2
|
81 |
TBool isSurroundedByRoundBrackets(const TDesC16& aAddress, TInt& rFirstChar, TInt& rLastChar);
|
williamr@2
|
82 |
TBool isSurroundedByAngledBrackets(const TDesC16& aAddress, TInt& rFirstChar, TInt& rLastChar, TInt aAtPos);
|
williamr@2
|
83 |
TBool isEnclosedSubString(const TDesC16& anAddress, const TChar& aLeftBracket, const TChar& aRightBracket,TInt& aLeftPos, TInt& aRightPos);
|
williamr@2
|
84 |
TBool isValidString(const TDesC16& anAddress, TInt& aFirstBadCharPos);
|
williamr@2
|
85 |
TBool isValidChar(const TChar& aChar);
|
williamr@2
|
86 |
TBool isValidEmailString(const TDesC16& anAddress, TInt& aFirstBadCharPos);
|
williamr@2
|
87 |
TBool isValidEmailChar(const TChar& aChar);
|
williamr@2
|
88 |
TBool LocateSubString(const TDesC16& anAddress, const TInt atPos, TInt& rFirstChar, TInt& rLastChar);
|
williamr@2
|
89 |
TBool hasAngledBrackets(const TDesC16& anAddress);
|
williamr@2
|
90 |
TBool isValid_ISO88591String(const TDesC16& aString,TInt& aPos);
|
williamr@2
|
91 |
TBool isValidRoutedEmailAddress(const TDesC16& anAddress);
|
williamr@2
|
92 |
TBool isValidDomainNameChar(const TChar& aChar);
|
williamr@2
|
93 |
TBool isValidMailboxChar(const TChar& aChar);
|
williamr@2
|
94 |
TBool isDotChar(const TChar& aChar);
|
williamr@2
|
95 |
};
|
williamr@2
|
96 |
|
williamr@2
|
97 |
|
williamr@2
|
98 |
#endif // !defined __MIUTPARS_H__
|