Diffstat (limited to 'noncore/net/mail/libmailwrapper/nntpwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/libmailwrapper/nntpwrapper.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp index 1956c61..2ec052c 100644 --- a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp | |||
@@ -167,65 +167,64 @@ void NNTPwrapper::login() | |||
167 | nntp_mailstorage_init(m_nntp,(char*)server, port, NULL, CONNECTION_TYPE_PLAIN, NNTP_AUTH_TYPE_PLAIN, | 167 | nntp_mailstorage_init(m_nntp,(char*)server, port, NULL, CONNECTION_TYPE_PLAIN, NNTP_AUTH_TYPE_PLAIN, |
168 | (char*)user,(char*)pass,0,0,0); | 168 | (char*)user,(char*)pass,0,0,0); |
169 | 169 | ||
170 | err = mailstorage_connect( m_nntp ); | 170 | err = mailstorage_connect( m_nntp ); |
171 | 171 | ||
172 | if (err != NEWSNNTP_NO_ERROR) { | 172 | if (err != NEWSNNTP_NO_ERROR) { |
173 | qDebug( QString( "FEHLERNUMMER %1" ).arg( err ) ); | 173 | qDebug( QString( "FEHLERNUMMER %1" ).arg( err ) ); |
174 | // Global::statusMessage(tr("Error initializing folder")); | 174 | // Global::statusMessage(tr("Error initializing folder")); |
175 | mailstorage_free(m_nntp); | 175 | mailstorage_free(m_nntp); |
176 | m_nntp = 0; | 176 | m_nntp = 0; |
177 | 177 | ||
178 | } | 178 | } |
179 | 179 | ||
180 | } | 180 | } |
181 | 181 | ||
182 | void NNTPwrapper::logout() | 182 | void NNTPwrapper::logout() |
183 | { | 183 | { |
184 | int err = NEWSNNTP_NO_ERROR; | 184 | int err = NEWSNNTP_NO_ERROR; |
185 | if ( m_nntp == NULL ) | 185 | if ( m_nntp == NULL ) |
186 | return; | 186 | return; |
187 | mailstorage_free(m_nntp); | 187 | mailstorage_free(m_nntp); |
188 | m_nntp = 0; | 188 | m_nntp = 0; |
189 | } | 189 | } |
190 | 190 | ||
191 | QList<Folder>* NNTPwrapper::listFolders() { | 191 | QValueList<Opie::osmart_pointer<Folder> >* NNTPwrapper::listFolders() { |
192 | 192 | ||
193 | QList<Folder> * folders = new QList<Folder>(); | 193 | QValueList<Opie::osmart_pointer<Folder> >* folders = new QValueList<Opie::osmart_pointer<Folder> >(); |
194 | folders->setAutoDelete( false ); | ||
195 | QStringList groups; | 194 | QStringList groups; |
196 | if (account) { | 195 | if (account) { |
197 | groups = account->getGroups(); | 196 | groups = account->getGroups(); |
198 | } | 197 | } |
199 | for ( QStringList::Iterator it = groups.begin(); it != groups.end(); ++it ) { | 198 | for ( QStringList::Iterator it = groups.begin(); it != groups.end(); ++it ) { |
200 | folders->append(new Folder((*it),".")); | 199 | folders->append(new Folder((*it),".")); |
201 | } | 200 | } |
202 | return folders; | 201 | return folders; |
203 | } | 202 | } |
204 | 203 | ||
205 | /* we made this method in raw nntp access of etpan and not via generic interface | 204 | /* we made this method in raw nntp access of etpan and not via generic interface |
206 | * 'cause in that case there will be doubled copy operations. eg. the etpan would | 205 | * 'cause in that case there will be doubled copy operations. eg. the etpan would |
207 | * copy that stuff into its own structures and we must copy it into useable c++ | 206 | * copy that stuff into its own structures and we must copy it into useable c++ |
208 | * structures for our frontend. this would not make sense, so it is better to reimplement | 207 | * structures for our frontend. this would not make sense, so it is better to reimplement |
209 | * the stuff from generic interface of etpan but copy it direct to qt classes. | 208 | * the stuff from generic interface of etpan but copy it direct to qt classes. |
210 | */ | 209 | */ |
211 | QStringList NNTPwrapper::listAllNewsgroups(const QString&mask) { | 210 | QStringList NNTPwrapper::listAllNewsgroups(const QString&mask) { |
212 | login(); | 211 | login(); |
213 | QStringList res; | 212 | QStringList res; |
214 | clist *result = 0; | 213 | clist *result = 0; |
215 | clistcell *current = 0; | 214 | clistcell *current = 0; |
216 | newsnntp_group_description *group; | 215 | newsnntp_group_description *group; |
217 | 216 | ||
218 | if ( m_nntp ) { | 217 | if ( m_nntp ) { |
219 | mailsession * session = m_nntp->sto_session; | 218 | mailsession * session = m_nntp->sto_session; |
220 | newsnntp * news = ( ( nntp_session_state_data * )session->sess_data )->nntp_session; | 219 | newsnntp * news = ( ( nntp_session_state_data * )session->sess_data )->nntp_session; |
221 | int err = NEWSNNTP_NO_ERROR; | 220 | int err = NEWSNNTP_NO_ERROR; |
222 | if (mask.isEmpty()) { | 221 | if (mask.isEmpty()) { |
223 | err = newsnntp_list(news, &result); | 222 | err = newsnntp_list(news, &result); |
224 | } else { | 223 | } else { |
225 | /* taken from generic wrapper of etpan */ | 224 | /* taken from generic wrapper of etpan */ |
226 | QString nmask = mask+".*"; | 225 | QString nmask = mask+".*"; |
227 | err = newsnntp_list_active(news, nmask.latin1(), &result); | 226 | err = newsnntp_list_active(news, nmask.latin1(), &result); |
228 | } | 227 | } |
229 | if ( err == NEWSNNTP_NO_ERROR && result) { | 228 | if ( err == NEWSNNTP_NO_ERROR && result) { |
230 | for ( current=clist_begin(result);current!=NULL;current=clist_next(current) ) { | 229 | for ( current=clist_begin(result);current!=NULL;current=clist_next(current) ) { |
231 | group = ( newsnntp_group_description* ) current->data; | 230 | group = ( newsnntp_group_description* ) current->data; |
@@ -259,26 +258,26 @@ encodedString* NNTPwrapper::fetchRawBody(const RecMail&mail) { | |||
259 | size_t length=0; | 258 | size_t length=0; |
260 | encodedString*res = 0; | 259 | encodedString*res = 0; |
261 | mailmessage * mailmsg = 0; | 260 | mailmessage * mailmsg = 0; |
262 | int err = mailsession_get_message(m_nntp->sto_session, mail.getNumber(), &mailmsg); | 261 | int err = mailsession_get_message(m_nntp->sto_session, mail.getNumber(), &mailmsg); |
263 | err = mailmessage_fetch(mailmsg,&target,&length); | 262 | err = mailmessage_fetch(mailmsg,&target,&length); |
264 | if (mailmsg) | 263 | if (mailmsg) |
265 | mailmessage_free(mailmsg); | 264 | mailmessage_free(mailmsg); |
266 | if (target) { | 265 | if (target) { |
267 | res = new encodedString(target,length); | 266 | res = new encodedString(target,length); |
268 | } | 267 | } |
269 | return res; | 268 | return res; |
270 | } | 269 | } |
271 | 270 | ||
272 | MAILLIB::ATYPE NNTPwrapper::getType()const { | 271 | MAILLIB::ATYPE NNTPwrapper::getType()const { |
273 | return account->getType(); | 272 | return account->getType(); |
274 | } | 273 | } |
275 | 274 | ||
276 | const QString&NNTPwrapper::getName()const{ | 275 | const QString&NNTPwrapper::getName()const{ |
277 | return account->getAccountName(); | 276 | return account->getAccountName(); |
278 | } | 277 | } |
279 | 278 | ||
280 | void NNTPwrapper::deleteMail(const RecMail&) { | 279 | void NNTPwrapper::deleteMail(const RecMail&) { |
281 | } | 280 | } |
282 | 281 | ||
283 | int NNTPwrapper::deleteAllMail(const Folder*) { | 282 | int NNTPwrapper::deleteAllMail(const FolderP&) { |
284 | } | 283 | } |