Diffstat (limited to 'noncore/net/mail/imapwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/imapwrapper.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/noncore/net/mail/imapwrapper.cpp b/noncore/net/mail/imapwrapper.cpp index 853e4a2..0178e33 100644 --- a/noncore/net/mail/imapwrapper.cpp +++ b/noncore/net/mail/imapwrapper.cpp | |||
@@ -91,19 +91,19 @@ void IMAPwrapper::logout() | |||
91 | mailimap_free( m_imap ); | 91 | mailimap_free( m_imap ); |
92 | m_imap = 0; | 92 | m_imap = 0; |
93 | } | 93 | } |
94 | 94 | ||
95 | void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) | 95 | void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) |
96 | { | 96 | { |
97 | const char *mb; | 97 | const char *mb = 0; |
98 | int err = MAILIMAP_NO_ERROR; | 98 | int err = MAILIMAP_NO_ERROR; |
99 | clist *result; | 99 | clist *result = 0; |
100 | clistcell *current; | 100 | clistcell *current; |
101 | // mailimap_fetch_att *fetchAtt,*fetchAttFlags,*fetchAttDate,*fetchAttSize; | 101 | // mailimap_fetch_att *fetchAtt,*fetchAttFlags,*fetchAttDate,*fetchAttSize; |
102 | mailimap_fetch_type *fetchType; | 102 | mailimap_fetch_type *fetchType = 0; |
103 | mailimap_set *set; | 103 | mailimap_set *set = 0; |
104 | 104 | ||
105 | mb = mailbox.latin1(); | 105 | mb = mailbox.latin1(); |
106 | login(); | 106 | login(); |
107 | if (!m_imap) { | 107 | if (!m_imap) { |
108 | return; | 108 | return; |
109 | } | 109 | } |
@@ -118,13 +118,12 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) | |||
118 | 118 | ||
119 | if (last == 0) { | 119 | if (last == 0) { |
120 | qDebug("mailbox has no mails"); | 120 | qDebug("mailbox has no mails"); |
121 | return; | 121 | return; |
122 | } | 122 | } |
123 | 123 | ||
124 | result = clist_new(); | ||
125 | /* the range has to start at 1!!! not with 0!!!! */ | 124 | /* the range has to start at 1!!! not with 0!!!! */ |
126 | set = mailimap_set_new_interval( 1, last ); | 125 | set = mailimap_set_new_interval( 1, last ); |
127 | fetchType = mailimap_fetch_type_new_fetch_att_list_empty(); | 126 | fetchType = mailimap_fetch_type_new_fetch_att_list_empty(); |
128 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_envelope()); | 127 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_envelope()); |
129 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_flags()); | 128 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_flags()); |
130 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_internaldate()); | 129 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_internaldate()); |
@@ -134,13 +133,12 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) | |||
134 | mailimap_set_free( set ); | 133 | mailimap_set_free( set ); |
135 | mailimap_fetch_type_free( fetchType ); | 134 | mailimap_fetch_type_free( fetchType ); |
136 | 135 | ||
137 | QString date,subject,from; | 136 | QString date,subject,from; |
138 | 137 | ||
139 | if ( err == MAILIMAP_NO_ERROR ) { | 138 | if ( err == MAILIMAP_NO_ERROR ) { |
140 | |||
141 | mailimap_msg_att * msg_att; | 139 | mailimap_msg_att * msg_att; |
142 | int i = 0; | 140 | int i = 0; |
143 | for (current = clist_begin(result); current != 0; current=clist_next(current)) { | 141 | for (current = clist_begin(result); current != 0; current=clist_next(current)) { |
144 | ++i; | 142 | ++i; |
145 | msg_att = (mailimap_msg_att*)current->data; | 143 | msg_att = (mailimap_msg_att*)current->data; |
146 | RecMail*m = parse_list_result(msg_att); | 144 | RecMail*m = parse_list_result(msg_att); |
@@ -151,13 +149,13 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) | |||
151 | target.append(m); | 149 | target.append(m); |
152 | } | 150 | } |
153 | } | 151 | } |
154 | } else { | 152 | } else { |
155 | qDebug("Error fetching headers: %s",m_imap->imap_response); | 153 | qDebug("Error fetching headers: %s",m_imap->imap_response); |
156 | } | 154 | } |
157 | mailimap_fetch_list_free(result); | 155 | if (result) mailimap_fetch_list_free(result); |
158 | } | 156 | } |
159 | 157 | ||
160 | QList<Folder>* IMAPwrapper::listFolders() | 158 | QList<Folder>* IMAPwrapper::listFolders() |
161 | { | 159 | { |
162 | const char *path, *mask; | 160 | const char *path, *mask; |
163 | int err = MAILIMAP_NO_ERROR; | 161 | int err = MAILIMAP_NO_ERROR; |