Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes
CAliasData Class Reference
Collaboration diagram for CAliasData:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 CAliasData ()
 ~CAliasData ()
PRBool Process (const char *pLine, PRInt32 len)

Public Attributes

nsCString m_nickName
nsCString m_realName
nsCString m_email

Detailed Description

Definition at line 72 of file nsEudoraAddress.cpp.


Constructor & Destructor Documentation

CAliasData::CAliasData ( ) [inline]

Definition at line 74 of file nsEudoraAddress.cpp.

{}

Definition at line 75 of file nsEudoraAddress.cpp.

{}

Member Function Documentation

PRBool CAliasData::Process ( const char *  pLine,
PRInt32  len 
)

Definition at line 446 of file nsEudoraAddress.cpp.

{
       // Extract any comments first!
       nsCString     str;
       
       const char *pStart = pLine;
       PRInt32              tCnt = 0;
       PRInt32              cnt = 0;
       PRInt32              max = len;
       PRBool        endCollect = PR_FALSE;
       
       while (max) {
              if (*pLine == '"') {
                     if (tCnt && !endCollect) {
                            str.Trim( kWhitespace);
                            if (!str.IsEmpty())
                                   str.Append( " ", 1);
                            str.Append( pStart, tCnt);
                     }
                     cnt = nsEudoraAddress::CountQuote( pLine, max);
                     if ((cnt > 2) && m_realName.IsEmpty()) {
                            m_realName.Append( pLine + 1, cnt - 2);
                     }
                     pLine += cnt;
                     max -= cnt;
                     pStart = pLine;
                     tCnt = 0;
              }
              else if (*pLine == '<') {
                     if (tCnt && !endCollect) {
                            str.Trim( kWhitespace);
                            if (!str.IsEmpty())
                                   str.Append( " ", 1);
                            str.Append( pStart, tCnt);
                     }
                     cnt = nsEudoraAddress::CountAngle( pLine, max);
                     if ((cnt > 2) && m_email.IsEmpty()) {
                            m_email.Append( pLine + 1, cnt - 2);
                     }
                     pLine += cnt;
                     max -= cnt;
                     pStart = pLine;
                     tCnt = 0;
                     endCollect = PR_TRUE;
              }
              else if (*pLine == '(') {
                     if (tCnt && !endCollect) {
                            str.Trim( kWhitespace);
                            if (!str.IsEmpty())
                                   str.Append( " ", 1);
                            str.Append( pStart, tCnt);
                     }
                     cnt = nsEudoraAddress::CountComment( pLine, max);
                     if (cnt > 2) {
                            if (!m_realName.IsEmpty() && m_nickName.IsEmpty())
                                   m_nickName = m_realName;
                            m_realName.Truncate();
                            m_realName.Append( pLine + 1, cnt - 2);
                     }
                     pLine += cnt;
                     max -= cnt;
                     pStart = pLine;
                     tCnt = 0;
              }
              else {
                     tCnt++;
                     pLine++;
                     max--;
              }
       }
       
       if (tCnt) {
              str.Trim( kWhitespace);
              if (!str.IsEmpty())
                     str.Append( " ", 1);
              str.Append( pStart, tCnt);
       }
       
       str.Trim( kWhitespace);
       
       if (!m_realName.IsEmpty() && !m_email.IsEmpty())
              return( PR_TRUE);
       
       // now we should have a string with any remaining non-delimitted text
       // we assume that the last token is the email
       // anything before that is realName
       if (!m_email.IsEmpty()) {
              m_realName = str;
              return( PR_TRUE);
       }
       
       tCnt = str.RFindChar( ' ');
       if (tCnt == -1) {
              if (!str.IsEmpty()) {
                     m_email = str;
                     return( PR_TRUE);
              }
              return( PR_FALSE);
       }
       
       str.Right( m_email, str.Length() - tCnt - 1);
       str.Left( m_realName, tCnt);
       m_realName.Trim( kWhitespace);
       m_email.Trim( kWhitespace);
       
       return( !m_email.IsEmpty());
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 82 of file nsEudoraAddress.cpp.

Definition at line 80 of file nsEudoraAddress.cpp.

Definition at line 81 of file nsEudoraAddress.cpp.


The documentation for this class was generated from the following file: