-rw-r--r-- | noncore/net/mail/libmailwrapper/nntpwrapper.cpp | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp index e73a890..c68964d 100644 --- a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp | |||
@@ -155,44 +155,58 @@ void NNTPwrapper::login() | |||
155 | } else if ( conntypeset == 0 ) { | 155 | } else if ( conntypeset == 0 ) { |
156 | conntype = CONNECTION_TYPE_TRY_STARTTLS; | 156 | conntype = CONNECTION_TYPE_TRY_STARTTLS; |
157 | } | 157 | } |
158 | 158 | ||
159 | nntp_mailstorage_init(m_nntp,(char*)server, port, NULL, conntype, NNTP_AUTH_TYPE_PLAIN, | 159 | nntp_mailstorage_init(m_nntp,(char*)server, port, NULL, conntype, NNTP_AUTH_TYPE_PLAIN, |
160 | (char*)user,(char*)pass,0,0,0); | 160 | (char*)user,(char*)pass,0,0,0); |
161 | 161 | ||
162 | err = mailstorage_connect(m_nntp); | 162 | err = mailstorage_connect( m_nntp ); |
163 | 163 | ||
164 | if (err != NEWSNNTP_NO_ERROR) { | 164 | if (err != NEWSNNTP_NO_ERROR) { |
165 | qDebug( QString( "FEHLERNUMMER %1" ).arg( err ) ); | 165 | qDebug( QString( "FEHLERNUMMER %1" ).arg( err ) ); |
166 | // Global::statusMessage(tr("Error initializing folder")); | 166 | // Global::statusMessage(tr("Error initializing folder")); |
167 | mailstorage_free(m_nntp); | 167 | mailstorage_free(m_nntp); |
168 | m_nntp = 0; | 168 | m_nntp = 0; |
169 | |||
169 | } | 170 | } |
171 | |||
170 | } | 172 | } |
171 | 173 | ||
172 | void NNTPwrapper::logout() | 174 | void NNTPwrapper::logout() |
173 | { | 175 | { |
174 | int err = NEWSNNTP_NO_ERROR; | 176 | int err = NEWSNNTP_NO_ERROR; |
175 | if ( m_nntp == NULL ) | 177 | if ( m_nntp == NULL ) |
176 | return; | 178 | return; |
177 | mailstorage_free(m_nntp); | 179 | mailstorage_free(m_nntp); |
178 | m_nntp = 0; | 180 | m_nntp = 0; |
179 | } | 181 | } |
180 | 182 | ||
181 | QList<Folder>* NNTPwrapper::listFolders() { | 183 | QList<Folder>* NNTPwrapper::listFolders() { |
182 | QList<Folder> * folders = new QList<Folder>(); | ||
183 | folders->setAutoDelete( false ); | ||
184 | clist *result = 0; | ||
185 | 184 | ||
186 | // int err = | ||
187 | // if ( err == _NO_ERROR ) { | ||
188 | // current = result->first; | ||
189 | // for ( current=clist_begin(result);current!=NULL;current=clist_next(current)) { | ||
190 | 185 | ||
191 | 186 | ||
192 | // Folder*inb=new Folder("INBOX","/"); | ||
193 | |||
194 | 187 | ||
188 | QList<Folder> * folders = new QList<Folder>(); | ||
189 | folders->setAutoDelete( false ); | ||
190 | clist *result = 0; | ||
191 | clistcell *current; | ||
192 | newsnntp_group_description *list; | ||
193 | |||
194 | login(); | ||
195 | if ( m_nntp ) { | ||
196 | mailsession * session = m_nntp->sto_session; | ||
197 | newsnntp * news = ( ( nntp_session_state_data * )session->sess_data )->nntp_session; | ||
198 | int err = newsnntp_list_newsgroups(news, NULL, &result); | ||
199 | |||
200 | if ( err == NEWSNNTP_NO_ERROR ) { | ||
201 | current = result->first; | ||
202 | for ( current=clist_begin(result);current!=NULL;current=clist_next(current)) { | ||
203 | list = ( newsnntp_group_description* ) current->data; | ||
204 | qDebug( list->grp_name ); | ||
205 | } | ||
206 | // Folder*inb=new Folder("INBOX","/"); | ||
207 | } | ||
208 | } | ||
195 | // folders->append(inb); | 209 | // folders->append(inb); |
196 | return folders; | 210 | return folders; |
197 | } | 211 | } |
198 | 212 | ||