summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/libmailwrapper/nntpwrapper.cpp19
-rw-r--r--noncore/net/mail/libmailwrapper/nntpwrapper.h2
2 files changed, 17 insertions, 4 deletions
diff --git a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp
index a766a59..5a8c224 100644
--- a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp
@@ -197,37 +197,50 @@ QList<Folder>* NNTPwrapper::listFolders() {
groups = account->getGroups();
}
for ( QStringList::Iterator it = groups.begin(); it != groups.end(); ++it ) {
folders->append(new Folder((*it),"."));
}
return folders;
}
-QStringList NNTPwrapper::listAllNewsgroups() {
+/* we made this method in raw nntp access of etpan and not via generic interface
+ * 'cause in that case there will be doubled copy operations. eg. the etpan would
+ * copy that stuff into its own structures and we must copy it into useable c++
+ * structures for our frontend. this would not make sense, so it is better to reimplement
+ * the stuff from generic interface of etpan but copy it direct to qt classes.
+ */
+QStringList NNTPwrapper::listAllNewsgroups(const QString&mask) {
login();
QStringList res;
clist *result = 0;
clistcell *current = 0;
newsnntp_group_description *group;
if ( m_nntp ) {
mailsession * session = m_nntp->sto_session;
newsnntp * news = ( ( nntp_session_state_data * )session->sess_data )->nntp_session;
- int err = newsnntp_list_newsgroups(news, NULL, &result);
+ int err = NEWSNNTP_NO_ERROR;
+ if (mask.isEmpty()) {
+ err = newsnntp_list(news, &result);
+ } else {
+ /* taken from generic wrapper of etpan */
+ QString nmask = mask+".*";
+ err = newsnntp_list_active(news, nmask.latin1(), &result);
+ }
if ( err == NEWSNNTP_NO_ERROR && result) {
for ( current=clist_begin(result);current!=NULL;current=clist_next(current) ) {
group = ( newsnntp_group_description* ) current->data;
if (!group||!group->grp_name||strlen(group->grp_name)==0) continue;
res.append(group->grp_name);
}
}
}
if (result) {
- clist_free(result);
+ newsnntp_list_free(result);
}
return res;
}
void NNTPwrapper::answeredMail(const RecMail&) {}
void NNTPwrapper::statusFolder(folderStat&target_stat,const QString&) {
login();
diff --git a/noncore/net/mail/libmailwrapper/nntpwrapper.h b/noncore/net/mail/libmailwrapper/nntpwrapper.h
index 4d03754..d51c955 100644
--- a/noncore/net/mail/libmailwrapper/nntpwrapper.h
+++ b/noncore/net/mail/libmailwrapper/nntpwrapper.h
@@ -20,17 +20,17 @@ public:
virtual ~NNTPwrapper();
/* mailbox will be ignored */
virtual void listMessages(const QString & mailbox, QList<RecMail> &target );
/* should only get the subscribed one */
virtual QList<Folder>* listFolders();
/* mailbox will be ignored */
virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX");
- QStringList listAllNewsgroups();
+ QStringList listAllNewsgroups(const QString&mask = QString::null);
virtual void deleteMail(const RecMail&mail);
virtual void answeredMail(const RecMail&mail);
virtual int deleteAllMail(const Folder*);
virtual RecBody fetchBody( const RecMail &mail );
virtual encodedString* fetchRawBody(const RecMail&mail);
virtual void logout();
virtual const QString&getType()const;