summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/libmailwrapper/smtpwrapper.cpp39
-rw-r--r--noncore/net/mail/smtpwrapper.cpp39
2 files changed, 70 insertions, 8 deletions
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
index 21992b4..285561c 100644
--- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
@@ -82,5 +82,34 @@ mailimf_address_list *SMTPwrapper::parseAddresses(const QString&addr )
82 addresses = mailimf_address_list_new_empty(); 82 addresses = mailimf_address_list_new_empty();
83 83
84 QStringList list = QStringList::split( ',', addr ); 84 bool literal_open = false;
85 unsigned int startpos = 0;
86 QStringList list;
87 QString s;
88 unsigned int i = 0;
89 for (; i < addr.length();++i) {
90 switch (addr[i]) {
91 case '\"':
92 literal_open = !literal_open;
93 break;
94 case ',':
95 if (!literal_open) {
96 s = addr.mid(startpos,i-startpos);
97 if (!s.isEmpty()) {
98 list.append(s);
99 qDebug("Appended %s",s.latin1());
100 }
101 // !!!! this is a MUST BE!
102 startpos = ++i;
103 }
104 break;
105 default:
106 break;
107 }
108 }
109 s = addr.mid(startpos,i-startpos);
110 if (!s.isEmpty()) {
111 list.append(s);
112 qDebug("Appended %s",s.latin1());
113 }
85 QStringList::Iterator it; 114 QStringList::Iterator it;
86 for ( it = list.begin(); it != list.end(); it++ ) { 115 for ( it = list.begin(); it != list.end(); it++ ) {
@@ -92,8 +121,7 @@ mailimf_address_list *SMTPwrapper::parseAddresses(const QString&addr )
92 free( str ); 121 free( str );
93 } else { 122 } else {
94 qDebug( "Parse success! :)" ); 123 qDebug( "Parse success! %s",(*it).latin1());
95 } 124 }
96 } 125 }
97
98 return addresses; 126 return addresses;
99} 127}
@@ -626,5 +654,8 @@ int SMTPwrapper::smtpSend(char*from,clist*rcpts,char*data,size_t size, SMTPaccou
626 654
627 err = mailsmtp_send( session, from, rcpts, data, size ); 655 err = mailsmtp_send( session, from, rcpts, data, size );
628 if ( err != MAILSMTP_NO_ERROR ) {result = 0; goto free_con_session;} 656 if ( err != MAILSMTP_NO_ERROR ) {
657 qDebug("Error sending mail: %s",mailsmtpError(err).latin1());
658 result = 0; goto free_con_session;
659 }
629 660
630 qDebug( "Mail sent." ); 661 qDebug( "Mail sent." );
diff --git a/noncore/net/mail/smtpwrapper.cpp b/noncore/net/mail/smtpwrapper.cpp
index 21992b4..285561c 100644
--- a/noncore/net/mail/smtpwrapper.cpp
+++ b/noncore/net/mail/smtpwrapper.cpp
@@ -82,5 +82,34 @@ mailimf_address_list *SMTPwrapper::parseAddresses(const QString&addr )
82 addresses = mailimf_address_list_new_empty(); 82 addresses = mailimf_address_list_new_empty();
83 83
84 QStringList list = QStringList::split( ',', addr ); 84 bool literal_open = false;
85 unsigned int startpos = 0;
86 QStringList list;
87 QString s;
88 unsigned int i = 0;
89 for (; i < addr.length();++i) {
90 switch (addr[i]) {
91 case '\"':
92 literal_open = !literal_open;
93 break;
94 case ',':
95 if (!literal_open) {
96 s = addr.mid(startpos,i-startpos);
97 if (!s.isEmpty()) {
98 list.append(s);
99 qDebug("Appended %s",s.latin1());
100 }
101 // !!!! this is a MUST BE!
102 startpos = ++i;
103 }
104 break;
105 default:
106 break;
107 }
108 }
109 s = addr.mid(startpos,i-startpos);
110 if (!s.isEmpty()) {
111 list.append(s);
112 qDebug("Appended %s",s.latin1());
113 }
85 QStringList::Iterator it; 114 QStringList::Iterator it;
86 for ( it = list.begin(); it != list.end(); it++ ) { 115 for ( it = list.begin(); it != list.end(); it++ ) {
@@ -92,8 +121,7 @@ mailimf_address_list *SMTPwrapper::parseAddresses(const QString&addr )
92 free( str ); 121 free( str );
93 } else { 122 } else {
94 qDebug( "Parse success! :)" ); 123 qDebug( "Parse success! %s",(*it).latin1());
95 } 124 }
96 } 125 }
97
98 return addresses; 126 return addresses;
99} 127}
@@ -626,5 +654,8 @@ int SMTPwrapper::smtpSend(char*from,clist*rcpts,char*data,size_t size, SMTPaccou
626 654
627 err = mailsmtp_send( session, from, rcpts, data, size ); 655 err = mailsmtp_send( session, from, rcpts, data, size );
628 if ( err != MAILSMTP_NO_ERROR ) {result = 0; goto free_con_session;} 656 if ( err != MAILSMTP_NO_ERROR ) {
657 qDebug("Error sending mail: %s",mailsmtpError(err).latin1());
658 result = 0; goto free_con_session;
659 }
629 660
630 qDebug( "Mail sent." ); 661 qDebug( "Mail sent." );