Diffstat (limited to 'noncore/net/mail/libmailwrapper/smtpwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/libmailwrapper/smtpwrapper.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp index a3c68ae..d75d52a 100644 --- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp | |||
@@ -1,131 +1,131 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | #include <sys/stat.h> | 2 | #include <sys/stat.h> |
3 | #include <sys/types.h> | 3 | #include <sys/types.h> |
4 | #include <unistd.h> | 4 | #include <unistd.h> |
5 | #include <fcntl.h> | 5 | #include <fcntl.h> |
6 | #include <string.h> | 6 | #include <string.h> |
7 | #include <qdir.h> | 7 | #include <qdir.h> |
8 | #include <qt.h> | 8 | #include <qt.h> |
9 | #include <qmessagebox.h> | 9 | #include <qmessagebox.h> |
10 | 10 | ||
11 | #include <qpe/config.h> | 11 | #include <qpe/config.h> |
12 | #include <qpe/qcopenvelope_qws.h> | 12 | #include <qpe/qcopenvelope_qws.h> |
13 | 13 | ||
14 | #include <libetpan/libetpan.h> | 14 | #include <libetpan/libetpan.h> |
15 | 15 | ||
16 | #include "smtpwrapper.h" | 16 | #include "smtpwrapper.h" |
17 | #include "mailwrapper.h" | 17 | #include "mailwrapper.h" |
18 | #include "abstractmail.h" | 18 | #include "abstractmail.h" |
19 | #include "logindialog.h" | 19 | #include "logindialog.h" |
20 | #include "mailtypes.h" | 20 | #include "mailtypes.h" |
21 | #include "sendmailprogress.h" | 21 | #include "sendmailprogress.h" |
22 | 22 | ||
23 | const char* SMTPwrapper::USER_AGENT="OpieMail v0.4"; | 23 | const char* SMTPwrapper::USER_AGENT="OpieMail v0.4"; |
24 | 24 | ||
25 | progressMailSend*SMTPwrapper::sendProgress = 0; | 25 | progressMailSend*SMTPwrapper::sendProgress = 0; |
26 | 26 | ||
27 | SMTPwrapper::SMTPwrapper(SMTPaccount * aSmtp ) | 27 | SMTPwrapper::SMTPwrapper(SMTPaccount * aSmtp ) |
28 | : QObject() | 28 | : QObject() |
29 | { | 29 | { |
30 | m_SmtpAccount = aSmtp; | 30 | m_SmtpAccount = aSmtp; |
31 | Config cfg( "mail" ); | 31 | Config cfg( "mail" ); |
32 | cfg.setGroup( "Status" ); | 32 | cfg.setGroup( "Status" ); |
33 | m_queuedMail = cfg.readNumEntry( "outgoing", 0 ); | 33 | m_queuedMail = cfg.readNumEntry( "outgoing", 0 ); |
34 | emit queuedMails( m_queuedMail ); | 34 | emit queuedMails( m_queuedMail ); |
35 | connect( this, SIGNAL( queuedMails( int ) ), this, SLOT( emitQCop( int ) ) ); | 35 | connect( this, SIGNAL( queuedMails(int) ), this, SLOT( emitQCop(int) ) ); |
36 | m_smtp = 0; | 36 | m_smtp = 0; |
37 | } | 37 | } |
38 | 38 | ||
39 | SMTPwrapper::~SMTPwrapper() | 39 | SMTPwrapper::~SMTPwrapper() |
40 | { | 40 | { |
41 | disc_server(); | 41 | disc_server(); |
42 | } | 42 | } |
43 | 43 | ||
44 | void SMTPwrapper::emitQCop( int queued ) { | 44 | void SMTPwrapper::emitQCop( int queued ) { |
45 | QCopEnvelope env( "QPE/Pim", "outgoingMails(int)" ); | 45 | QCopEnvelope env( "QPE/Pim", "outgoingMails(int)" ); |
46 | env << queued; | 46 | env << queued; |
47 | } | 47 | } |
48 | 48 | ||
49 | QString SMTPwrapper::mailsmtpError( int errnum ) { | 49 | QString SMTPwrapper::mailsmtpError( int errnum ) { |
50 | switch ( errnum ) { | 50 | switch ( errnum ) { |
51 | case MAILSMTP_NO_ERROR: | 51 | case MAILSMTP_NO_ERROR: |
52 | return tr( "No error" ); | 52 | return tr( "No error" ); |
53 | case MAILSMTP_ERROR_UNEXPECTED_CODE: | 53 | case MAILSMTP_ERROR_UNEXPECTED_CODE: |
54 | return tr( "Unexpected error code" ); | 54 | return tr( "Unexpected error code" ); |
55 | case MAILSMTP_ERROR_SERVICE_NOT_AVAILABLE: | 55 | case MAILSMTP_ERROR_SERVICE_NOT_AVAILABLE: |
56 | return tr( "Service not available" ); | 56 | return tr( "Service not available" ); |
57 | case MAILSMTP_ERROR_STREAM: | 57 | case MAILSMTP_ERROR_STREAM: |
58 | return tr( "Stream error" ); | 58 | return tr( "Stream error" ); |
59 | case MAILSMTP_ERROR_HOSTNAME: | 59 | case MAILSMTP_ERROR_HOSTNAME: |
60 | return tr( "gethostname() failed" ); | 60 | return tr( "gethostname() failed" ); |
61 | case MAILSMTP_ERROR_NOT_IMPLEMENTED: | 61 | case MAILSMTP_ERROR_NOT_IMPLEMENTED: |
62 | return tr( "Not implemented" ); | 62 | return tr( "Not implemented" ); |
63 | case MAILSMTP_ERROR_ACTION_NOT_TAKEN: | 63 | case MAILSMTP_ERROR_ACTION_NOT_TAKEN: |
64 | return tr( "Error, action not taken" ); | 64 | return tr( "Error, action not taken" ); |
65 | case MAILSMTP_ERROR_EXCEED_STORAGE_ALLOCATION: | 65 | case MAILSMTP_ERROR_EXCEED_STORAGE_ALLOCATION: |
66 | return tr( "Data exceeds storage allocation" ); | 66 | return tr( "Data exceeds storage allocation" ); |
67 | case MAILSMTP_ERROR_IN_PROCESSING: | 67 | case MAILSMTP_ERROR_IN_PROCESSING: |
68 | return tr( "Error in processing" ); | 68 | return tr( "Error in processing" ); |
69 | case MAILSMTP_ERROR_STARTTLS_NOT_SUPPORTED: | 69 | case MAILSMTP_ERROR_STARTTLS_NOT_SUPPORTED: |
70 | return tr( "Starttls not supported" ); | 70 | return tr( "Starttls not supported" ); |
71 | // case MAILSMTP_ERROR_INSUFFISANT_SYSTEM_STORAGE: | 71 | // case MAILSMTP_ERROR_INSUFFISANT_SYSTEM_STORAGE: |
72 | // return tr( "Insufficient system storage" ); | 72 | // return tr( "Insufficient system storage" ); |
73 | case MAILSMTP_ERROR_MAILBOX_UNAVAILABLE: | 73 | case MAILSMTP_ERROR_MAILBOX_UNAVAILABLE: |
74 | return tr( "Mailbox unavailable" ); | 74 | return tr( "Mailbox unavailable" ); |
75 | case MAILSMTP_ERROR_MAILBOX_NAME_NOT_ALLOWED: | 75 | case MAILSMTP_ERROR_MAILBOX_NAME_NOT_ALLOWED: |
76 | return tr( "Mailbox name not allowed" ); | 76 | return tr( "Mailbox name not allowed" ); |
77 | case MAILSMTP_ERROR_BAD_SEQUENCE_OF_COMMAND: | 77 | case MAILSMTP_ERROR_BAD_SEQUENCE_OF_COMMAND: |
78 | return tr( "Bad command sequence" ); | 78 | return tr( "Bad command sequence" ); |
79 | case MAILSMTP_ERROR_USER_NOT_LOCAL: | 79 | case MAILSMTP_ERROR_USER_NOT_LOCAL: |
80 | return tr( "User not local" ); | 80 | return tr( "User not local" ); |
81 | case MAILSMTP_ERROR_TRANSACTION_FAILED: | 81 | case MAILSMTP_ERROR_TRANSACTION_FAILED: |
82 | return tr( "Transaction failed" ); | 82 | return tr( "Transaction failed" ); |
83 | case MAILSMTP_ERROR_MEMORY: | 83 | case MAILSMTP_ERROR_MEMORY: |
84 | return tr( "Memory error" ); | 84 | return tr( "Memory error" ); |
85 | case MAILSMTP_ERROR_CONNECTION_REFUSED: | 85 | case MAILSMTP_ERROR_CONNECTION_REFUSED: |
86 | return tr( "Connection refused" ); | 86 | return tr( "Connection refused" ); |
87 | default: | 87 | default: |
88 | return tr( "Unknown error code" ); | 88 | return tr( "Unknown error code" ); |
89 | } | 89 | } |
90 | } | 90 | } |
91 | 91 | ||
92 | mailimf_mailbox *SMTPwrapper::newMailbox(const QString&name, const QString&mail ) { | 92 | mailimf_mailbox *SMTPwrapper::newMailbox(const QString&name, const QString&mail ) { |
93 | return mailimf_mailbox_new( strdup( name.latin1() ), | 93 | return mailimf_mailbox_new( strdup( name.latin1() ), |
94 | strdup( mail.latin1() ) ); | 94 | strdup( mail.latin1() ) ); |
95 | } | 95 | } |
96 | 96 | ||
97 | mailimf_address_list *SMTPwrapper::parseAddresses(const QString&addr ) { | 97 | mailimf_address_list *SMTPwrapper::parseAddresses(const QString&addr ) { |
98 | mailimf_address_list *addresses; | 98 | mailimf_address_list *addresses; |
99 | 99 | ||
100 | if ( addr.isEmpty() ) | 100 | if ( addr.isEmpty() ) |
101 | return NULL; | 101 | return NULL; |
102 | 102 | ||
103 | addresses = mailimf_address_list_new_empty(); | 103 | addresses = mailimf_address_list_new_empty(); |
104 | 104 | ||
105 | bool literal_open = false; | 105 | bool literal_open = false; |
106 | unsigned int startpos = 0; | 106 | unsigned int startpos = 0; |
107 | QStringList list; | 107 | QStringList list; |
108 | QString s; | 108 | QString s; |
109 | unsigned int i = 0; | 109 | unsigned int i = 0; |
110 | for (; i < addr.length();++i) { | 110 | for (; i < addr.length();++i) { |
111 | switch (addr[i]) { | 111 | switch (addr[i]) { |
112 | case '\"': | 112 | case '\"': |
113 | literal_open = !literal_open; | 113 | literal_open = !literal_open; |
114 | break; | 114 | break; |
115 | case ',': | 115 | case ',': |
116 | if (!literal_open) { | 116 | if (!literal_open) { |
117 | s = addr.mid(startpos,i-startpos); | 117 | s = addr.mid(startpos,i-startpos); |
118 | if (!s.isEmpty()) { | 118 | if (!s.isEmpty()) { |
119 | list.append(s); | 119 | list.append(s); |
120 | qDebug("Appended %s",s.latin1()); | 120 | qDebug("Appended %s",s.latin1()); |
121 | } | 121 | } |
122 | // !!!! this is a MUST BE! | 122 | // !!!! this is a MUST BE! |
123 | startpos = ++i; | 123 | startpos = ++i; |
124 | } | 124 | } |
125 | break; | 125 | break; |
126 | default: | 126 | default: |
127 | break; | 127 | break; |
128 | } | 128 | } |
129 | } | 129 | } |
130 | s = addr.mid(startpos,i-startpos); | 130 | s = addr.mid(startpos,i-startpos); |
131 | if (!s.isEmpty()) { | 131 | if (!s.isEmpty()) { |