-rw-r--r-- | noncore/net/mail/libmailwrapper/pop3wrapper.cpp | 1 | ||||
-rw-r--r-- | noncore/net/mail/pop3wrapper.cpp | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp index 2aaff30..72f3c36 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp | |||
@@ -6,48 +6,49 @@ | |||
6 | POP3wrapper::POP3wrapper( POP3account *a ) | 6 | POP3wrapper::POP3wrapper( POP3account *a ) |
7 | { | 7 | { |
8 | account = a; | 8 | account = a; |
9 | m_pop3 = NULL; | 9 | m_pop3 = NULL; |
10 | } | 10 | } |
11 | 11 | ||
12 | POP3wrapper::~POP3wrapper() | 12 | POP3wrapper::~POP3wrapper() |
13 | { | 13 | { |
14 | logout(); | 14 | logout(); |
15 | } | 15 | } |
16 | 16 | ||
17 | void POP3wrapper::pop3_progress( size_t current, size_t maximum ) | 17 | void POP3wrapper::pop3_progress( size_t current, size_t maximum ) |
18 | { | 18 | { |
19 | qDebug( "POP3: %i of %i", current, maximum ); | 19 | qDebug( "POP3: %i of %i", current, maximum ); |
20 | } | 20 | } |
21 | 21 | ||
22 | void POP3wrapper::listMessages( QList<RecMail> &target ) | 22 | void POP3wrapper::listMessages( QList<RecMail> &target ) |
23 | { | 23 | { |
24 | int err = MAILPOP3_NO_ERROR; | 24 | int err = MAILPOP3_NO_ERROR; |
25 | char *header; | 25 | char *header; |
26 | size_t length; | 26 | size_t length; |
27 | carray *messages; | 27 | carray *messages; |
28 | 28 | ||
29 | login(); | 29 | login(); |
30 | if (!m_pop3) return; | ||
30 | mailpop3_list( m_pop3, &messages ); | 31 | mailpop3_list( m_pop3, &messages ); |
31 | 32 | ||
32 | for ( int i = carray_count( messages ); i > 0; i-- ) { | 33 | for ( int i = carray_count( messages ); i > 0; i-- ) { |
33 | mailpop3_msg_info *info = (mailpop3_msg_info *) carray_get( messages, i - 1 ); | 34 | mailpop3_msg_info *info = (mailpop3_msg_info *) carray_get( messages, i - 1 ); |
34 | 35 | ||
35 | err = mailpop3_header( m_pop3, info->index, &header, &length ); | 36 | err = mailpop3_header( m_pop3, info->index, &header, &length ); |
36 | if ( err != MAILPOP3_NO_ERROR ) { | 37 | if ( err != MAILPOP3_NO_ERROR ) { |
37 | qDebug( "POP3: error retrieving header msgid: %i", info->index ); | 38 | qDebug( "POP3: error retrieving header msgid: %i", info->index ); |
38 | logout(); | 39 | logout(); |
39 | return; | 40 | return; |
40 | } | 41 | } |
41 | RecMail *mail = parseHeader( header ); | 42 | RecMail *mail = parseHeader( header ); |
42 | mail->setNumber( info->index ); | 43 | mail->setNumber( info->index ); |
43 | target.append( mail ); | 44 | target.append( mail ); |
44 | } | 45 | } |
45 | 46 | ||
46 | logout(); | 47 | logout(); |
47 | } | 48 | } |
48 | 49 | ||
49 | RecMail *POP3wrapper::parseHeader( const char *header ) | 50 | RecMail *POP3wrapper::parseHeader( const char *header ) |
50 | { | 51 | { |
51 | int err = MAILIMF_NO_ERROR; | 52 | int err = MAILIMF_NO_ERROR; |
52 | size_t curTok; | 53 | size_t curTok; |
53 | RecMail *mail = new RecMail(); | 54 | RecMail *mail = new RecMail(); |
diff --git a/noncore/net/mail/pop3wrapper.cpp b/noncore/net/mail/pop3wrapper.cpp index 2aaff30..72f3c36 100644 --- a/noncore/net/mail/pop3wrapper.cpp +++ b/noncore/net/mail/pop3wrapper.cpp | |||
@@ -6,48 +6,49 @@ | |||
6 | POP3wrapper::POP3wrapper( POP3account *a ) | 6 | POP3wrapper::POP3wrapper( POP3account *a ) |
7 | { | 7 | { |
8 | account = a; | 8 | account = a; |
9 | m_pop3 = NULL; | 9 | m_pop3 = NULL; |
10 | } | 10 | } |
11 | 11 | ||
12 | POP3wrapper::~POP3wrapper() | 12 | POP3wrapper::~POP3wrapper() |
13 | { | 13 | { |
14 | logout(); | 14 | logout(); |
15 | } | 15 | } |
16 | 16 | ||
17 | void POP3wrapper::pop3_progress( size_t current, size_t maximum ) | 17 | void POP3wrapper::pop3_progress( size_t current, size_t maximum ) |
18 | { | 18 | { |
19 | qDebug( "POP3: %i of %i", current, maximum ); | 19 | qDebug( "POP3: %i of %i", current, maximum ); |
20 | } | 20 | } |
21 | 21 | ||
22 | void POP3wrapper::listMessages( QList<RecMail> &target ) | 22 | void POP3wrapper::listMessages( QList<RecMail> &target ) |
23 | { | 23 | { |
24 | int err = MAILPOP3_NO_ERROR; | 24 | int err = MAILPOP3_NO_ERROR; |
25 | char *header; | 25 | char *header; |
26 | size_t length; | 26 | size_t length; |
27 | carray *messages; | 27 | carray *messages; |
28 | 28 | ||
29 | login(); | 29 | login(); |
30 | if (!m_pop3) return; | ||
30 | mailpop3_list( m_pop3, &messages ); | 31 | mailpop3_list( m_pop3, &messages ); |
31 | 32 | ||
32 | for ( int i = carray_count( messages ); i > 0; i-- ) { | 33 | for ( int i = carray_count( messages ); i > 0; i-- ) { |
33 | mailpop3_msg_info *info = (mailpop3_msg_info *) carray_get( messages, i - 1 ); | 34 | mailpop3_msg_info *info = (mailpop3_msg_info *) carray_get( messages, i - 1 ); |
34 | 35 | ||
35 | err = mailpop3_header( m_pop3, info->index, &header, &length ); | 36 | err = mailpop3_header( m_pop3, info->index, &header, &length ); |
36 | if ( err != MAILPOP3_NO_ERROR ) { | 37 | if ( err != MAILPOP3_NO_ERROR ) { |
37 | qDebug( "POP3: error retrieving header msgid: %i", info->index ); | 38 | qDebug( "POP3: error retrieving header msgid: %i", info->index ); |
38 | logout(); | 39 | logout(); |
39 | return; | 40 | return; |
40 | } | 41 | } |
41 | RecMail *mail = parseHeader( header ); | 42 | RecMail *mail = parseHeader( header ); |
42 | mail->setNumber( info->index ); | 43 | mail->setNumber( info->index ); |
43 | target.append( mail ); | 44 | target.append( mail ); |
44 | } | 45 | } |
45 | 46 | ||
46 | logout(); | 47 | logout(); |
47 | } | 48 | } |
48 | 49 | ||
49 | RecMail *POP3wrapper::parseHeader( const char *header ) | 50 | RecMail *POP3wrapper::parseHeader( const char *header ) |
50 | { | 51 | { |
51 | int err = MAILIMF_NO_ERROR; | 52 | int err = MAILIMF_NO_ERROR; |
52 | size_t curTok; | 53 | size_t curTok; |
53 | RecMail *mail = new RecMail(); | 54 | RecMail *mail = new RecMail(); |