author | alwin <alwin> | 2004-03-06 01:53:46 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-03-06 01:53:46 (UTC) |
commit | dcddc2bbe09153468a5d994c64011a5dc175baad (patch) (side-by-side diff) | |
tree | 416af037e0147f214fc478a133f78e85343e541d | |
parent | 4aea85aa2e205040da3ebdf50debde8b296e3c61 (diff) | |
download | opie-dcddc2bbe09153468a5d994c64011a5dc175baad.zip opie-dcddc2bbe09153468a5d994c64011a5dc175baad.tar.gz opie-dcddc2bbe09153468a5d994c64011a5dc175baad.tar.bz2 |
- subscribed NG will displayed in main windows
- we get the list of articles inside a newsgroup
- we can read an article
ToDo:
- filter article for that are read.
-rw-r--r-- | noncore/net/mail/libmailwrapper/nntpwrapper.cpp | 15 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/nntpwrapper.h | 2 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/settings.cpp | 1 |
3 files changed, 11 insertions, 7 deletions
diff --git a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp index ecdf848..798879d 100644 --- a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp @@ -75,56 +75,56 @@ RecBody NNTPwrapper::fetchBody( const RecMail &mail ) { message = (char*)malloc(msg.length()+1*sizeof(char)); memset(message,0,msg.length()+1); memcpy(message,msg.latin1(),msg.length()); /* transform to libetpan stuff */ mailmsg = mailmessage_new(); mailmessage_init(mailmsg, NULL, data_message_driver, 0, strlen(message)); generic_message_t * msg_data; msg_data = (generic_message_t *)mailmsg->msg_data; msg_data->msg_fetched = 1; msg_data->msg_message = message; msg_data->msg_length = strlen(message); } body = parseMail(mailmsg); /* clean up */ if (mailmsg) mailmessage_free(mailmsg); if (message) free(message); return body; } -void NNTPwrapper::listMessages(const QString &, QList<RecMail> &target ) +void NNTPwrapper::listMessages(const QString & which, QList<RecMail> &target ) { login(); if (!m_nntp) return; uint32_t res_messages,res_recent,res_unseen; - mailsession_status_folder(m_nntp->sto_session,"INBOX",&res_messages,&res_recent,&res_unseen); - parseList(target,m_nntp->sto_session,"INBOX"); + mailsession_status_folder(m_nntp->sto_session,(char*)which.latin1(),&res_messages,&res_recent,&res_unseen); + parseList(target,m_nntp->sto_session,which); } void NNTPwrapper::login() { if (account->getOffline()) return; /* we'll hold the line */ if ( m_nntp != NULL ) return; const char *server, *user, *pass; QString User,Pass; uint16_t port; int err = NEWSNNTP_NO_ERROR; server = account->getServer().latin1(); port = account->getPort().toUInt(); user = pass = 0; if ( ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) && account->getLogin() ) { LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); login.show(); if ( QDialog::Accepted == login.exec() ) { @@ -171,50 +171,55 @@ void NNTPwrapper::login() if (err != NEWSNNTP_NO_ERROR) { qDebug( QString( "FEHLERNUMMER %1" ).arg( err ) ); // Global::statusMessage(tr("Error initializing folder")); mailstorage_free(m_nntp); m_nntp = 0; } } void NNTPwrapper::logout() { int err = NEWSNNTP_NO_ERROR; if ( m_nntp == NULL ) return; mailstorage_free(m_nntp); m_nntp = 0; } QList<Folder>* NNTPwrapper::listFolders() { QList<Folder> * folders = new QList<Folder>(); folders->setAutoDelete( false ); - -// folders->append(inb); + QStringList groups; + if (account) { + groups = account->getGroups(); + } + for ( QStringList::Iterator it = groups.begin(); it != groups.end(); ++it ) { + folders->append(new Folder((*it),".")); + } return folders; } clist * NNTPwrapper::listAllNewsgroups() { login(); clist *result = 0; clistcell *current; newsnntp_group_description *list; 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); if ( err == NEWSNNTP_NO_ERROR ) { return result; } } } void NNTPwrapper::answeredMail(const RecMail&) {} void NNTPwrapper::statusFolder(folderStat&target_stat,const QString&) { login(); target_stat.message_count = 0; diff --git a/noncore/net/mail/libmailwrapper/nntpwrapper.h b/noncore/net/mail/libmailwrapper/nntpwrapper.h index e4d4a37..e8e2cf4 100644 --- a/noncore/net/mail/libmailwrapper/nntpwrapper.h +++ b/noncore/net/mail/libmailwrapper/nntpwrapper.h @@ -4,45 +4,45 @@ #include "mailwrapper.h" #include "genericwrapper.h" #include <qstring.h> #include <libetpan/clist.h> class encodedString; struct mailstorage; struct mailfolder; class NNTPwrapper : public Genericwrapper { Q_OBJECT public: NNTPwrapper( NNTPaccount *a ); 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"); - clist * listAllNewsgroups(); + clist * listAllNewsgroups(); 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; virtual const QString&getName()const; static void nntp_progress( size_t current, size_t maximum ); protected: void login(); NNTPaccount *account; mailstorage* m_nntp; }; #endif diff --git a/noncore/net/mail/libmailwrapper/settings.cpp b/noncore/net/mail/libmailwrapper/settings.cpp index f64c17d..0d34fd5 100644 --- a/noncore/net/mail/libmailwrapper/settings.cpp +++ b/noncore/net/mail/libmailwrapper/settings.cpp @@ -417,25 +417,24 @@ void NNTPaccount::read() void NNTPaccount::save() { qDebug( "saving " + getFileName() ); Settings::checkDirectory(); Config *conf = new Config( getFileName(), Config::File ); conf->setGroup( "NNTP Account" ); conf->writeEntry( "Account", accountName ); conf->writeEntry( "Server", server ); conf->writeEntry( "Port", port ); conf->writeEntry( "SSL", ssl ); conf->writeEntry( "Login", login ); conf->writeEntry( "User", user ); conf->writeEntryCrypt( "Password", password ); conf->writeEntry( "Subscribed" , subscribedGroups, ',' ); conf->write(); delete conf; } QString NNTPaccount::getFileName() { return (QString) getenv( "HOME" ) + "/Applications/opiemail/nntp-" + file; } - |