[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/3.5/kdepim/libkmime
From:       Tom Albers <tomalbers () kde ! nl>
Date:       2006-10-30 21:15:14
Message-ID: 1162242914.373294.13726.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 600533 by toma:

- Fix bug where email address was returned with a space in front or at end.
- expand the emails() function with a names() function and a displayNames() function.


 M  +27 -10    kmime_headers.cpp  
 M  +2 -0      kmime_headers_obs.h  


--- branches/KDE/3.5/kdepim/libkmime/kmime_headers.cpp #600532:600533
@@ -257,7 +257,7 @@
   QString maybeDotAtom;
   if ( !parseDotAtom( scursor, send, maybeDotAtom, isCRLF ) )
     return false;
-  
+
   mDotAtom = maybeDotAtom;
 
   eatCFWS( scursor, send, isCRLF );
@@ -298,7 +298,7 @@
 
   //
   // type
-  // 
+  //
 
   QPair<const char*,int> maybeMimeType;
   if ( !parseToken( scursor, send, maybeMimeType, false /* no 8Bit */ ) )
@@ -328,10 +328,10 @@
 
   eatCFWS( scursor, send, isCRLF );
   if ( scursor == send ) return true; // no parameters
-  
+
   if ( *scursor != ';' ) return false;
   scursor++;
-  
+
   if ( !parseParameterList( scursor, send, mParameterHash, isCRLF ) )
     return false;
 
@@ -356,7 +356,7 @@
 
   eatCFWS( scursor, send, isCRLF );
   if ( scursor == send ) return false;
-  
+
   QPair<const char*,int> maybeToken;
   if ( !parseToken( scursor, send, maybeToken, false /* no 8Bit */ ) )
     return false;
@@ -369,10 +369,10 @@
 
   eatCFWS( scursor, send, isCRLF );
   if ( scursor == send ) return true; // no parameters
-  
+
   if ( *scursor != ';' ) return false;
   scursor++;
-  
+
   if ( !parseParameterList( scursor, send, mParameterHash, isCRLF ) )
     return false;
 
@@ -445,7 +445,7 @@
 //-----<ReturnPath>-------------------------
 
 bool ReturnPath::parse( const char* & scursor, const char * const send, bool isCRLF ) {
-  
+
   eatCFWS( scursor, send, isCRLF );
   if ( scursor == send ) return false;
 
@@ -460,7 +460,7 @@
     eatCFWS( scursor, send, isCRLF );
     if ( scursor == send || *scursor != '>' ) return false;
     scursor++;
-    
+
     // prepare a Null mailbox:
     AddrSpec emptyAddrSpec;
     maybeMailbox.displayName = QString::null;
@@ -604,7 +604,7 @@
         pos1=pos2+1;
         pos2=s.find('>', pos1);
         if(pos2!=-1)
-          e_mail=s.mid(pos1, pos2-pos1);
+          e_mail=s.mid(pos1, pos2-pos1).stripWhiteSpace();
       }
       else return;
     break;
@@ -922,6 +922,23 @@
       l->append( it->email() );
 }
 
+void To::names(QStrList *l)
+{
+    l->clear();
+
+    for (AddressField *it=a_ddrList->first(); it != 0 ; it=a_ddrList->next() )
+        if( it->hasName() )
+            l->append( it->name() );
+}
+
+void To::displayNames(QStrList *l)
+{
+    l->clear();
+
+    for (AddressField *it=a_ddrList->first(); it != 0 ; it=a_ddrList->next() )
+            l->append( it->asUnicodeString() );
+}
+
 //-----</To>-----------------------------------
 #endif
 
--- branches/KDE/3.5/kdepim/libkmime/kmime_headers_obs.h #600532:600533
@@ -166,6 +166,8 @@
 
     void addAddress(const AddressField &a);
     void emails(QStrList *l);
+    void names(QStrList *l);
+    void displayNames(QStrList *l);
 
   protected:
     ObsAddressList *a_ddrList;
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic