summaryrefslogtreecommitdiff
authorharlekin <harlekin>2004-02-29 23:19:13 (UTC)
committer harlekin <harlekin>2004-02-29 23:19:13 (UTC)
commit47cb805563e76732320f082975aad3046be1992a (patch) (side-by-side diff)
treec7dc988659c47166370dfd93d9140d4919c944da
parentdcf152e23f7cc85fe2e46521e07b64e2288efdda (diff)
downloadopie-47cb805563e76732320f082975aad3046be1992a.zip
opie-47cb805563e76732320f082975aad3046be1992a.tar.gz
opie-47cb805563e76732320f082975aad3046be1992a.tar.bz2
little update
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/mail/libmailwrapper/nntpwrapper.cpp28
1 files changed, 21 insertions, 7 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
@@ -137,90 +137,104 @@ void NNTPwrapper::login()
}
} else {
user = account->getUser().latin1();
pass = account->getPassword().latin1();
}
// bool ssl = account->getSSL();
m_nntp=mailstorage_new(NULL);
int conntypeset = account->ConnectionType();
int conntype = 0;
if ( conntypeset == 3 ) {
conntype = CONNECTION_TYPE_COMMAND;
} else if ( conntypeset == 2 ) {
conntype = CONNECTION_TYPE_TLS;
} else if ( conntypeset == 1 ) {
conntype = CONNECTION_TYPE_STARTTLS;
} else if ( conntypeset == 0 ) {
conntype = CONNECTION_TYPE_TRY_STARTTLS;
}
nntp_mailstorage_init(m_nntp,(char*)server, port, NULL, conntype, NNTP_AUTH_TYPE_PLAIN,
(char*)user,(char*)pass,0,0,0);
err = mailstorage_connect(m_nntp);
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 );
clist *result = 0;
+ clistcell *current;
+ newsnntp_group_description *list;
- // int err =
-// if ( err == _NO_ERROR ) {
-// current = result->first;
-// for ( current=clist_begin(result);current!=NULL;current=clist_next(current)) {
-
+ login();
+ 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 ) {
+ current = result->first;
+ for ( current=clist_begin(result);current!=NULL;current=clist_next(current)) {
+ list = ( newsnntp_group_description* ) current->data;
+ qDebug( list->grp_name );
+ }
// Folder*inb=new Folder("INBOX","/");
-
-
+ }
+ }
// folders->append(inb);
return folders;
}
void NNTPwrapper::answeredMail(const RecMail&) {}
void NNTPwrapper::statusFolder(folderStat&target_stat,const QString&) {
login();
target_stat.message_count = 0;
target_stat.message_unseen = 0;
target_stat.message_recent = 0;
if (!m_nntp)
return;
int r = mailsession_status_folder(m_nntp->sto_session,0,&target_stat.message_count,
&target_stat.message_recent,&target_stat.message_unseen);
}
encodedString* NNTPwrapper::fetchRawBody(const RecMail&mail) {
char*target=0;
size_t length=0;
encodedString*res = 0;
mailmessage * mailmsg = 0;
int err = mailsession_get_message(m_nntp->sto_session, mail.getNumber(), &mailmsg);
err = mailmessage_fetch(mailmsg,&target,&length);
if (mailmsg)
mailmessage_free(mailmsg);
if (target) {
res = new encodedString(target,length);
}
return res;