summaryrefslogtreecommitdiffabout
path: root/kmicromail/libmailwrapper/nntpwrapper.cpp
Side-by-side diff
Diffstat (limited to 'kmicromail/libmailwrapper/nntpwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/libmailwrapper/nntpwrapper.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/kmicromail/libmailwrapper/nntpwrapper.cpp b/kmicromail/libmailwrapper/nntpwrapper.cpp
index 93cd2b5..b328ecd 100644
--- a/kmicromail/libmailwrapper/nntpwrapper.cpp
+++ b/kmicromail/libmailwrapper/nntpwrapper.cpp
@@ -1,22 +1,24 @@
// CHANGED 2004-09-31 Lutz Rogowski
#include "nntpwrapper.h"
#include "logindialog.h"
#include "mailtypes.h"
#include <qfile.h>
+//Added by qt3to4:
+#include <Q3ValueList>
#include <stdlib.h>
#include <libetpan/libetpan.h>
#define HARD_MSG_SIZE_LIMIT 5242880
using namespace Opie::Core;
NNTPwrapper::NNTPwrapper( NNTPaccount *a )
: Genericwrapper() {
account = a;
m_nntp = NULL;
msgTempName = a->getFileName()+"_msg_cache";
last_msg_id = 0;
@@ -47,72 +49,72 @@ RecBodyP NNTPwrapper::fetchBody( const RecMailP &mail ) {
}
mailmessage * mailmsg;
if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) {
; // << "Message to large: " << mail->Msgsize() << "" << oendl;
return body;
}
QFile msg_cache(msgTempName);
cleanMimeCache();
if (mail->getNumber()!=last_msg_id) {
if (msg_cache.exists()) {
msg_cache.remove();
}
- msg_cache.open(IO_ReadWrite|IO_Truncate);
+ msg_cache.open(QIODevice::ReadWrite|QIODevice::Truncate);
last_msg_id = mail->getNumber();
err = mailsession_get_message(m_nntp->sto_session, mail->getNumber(), &mailmsg);
err = mailmessage_fetch(mailmsg,&message,&length);
msg_cache.writeBlock(message,length);
} else {
QString msg="";
- msg_cache.open(IO_ReadOnly);
+ msg_cache.open(QIODevice::ReadOnly);
message = new char[4096];
memset(message,0,4096);
while (msg_cache.readBlock(message,4095)>0) {
msg+=message;
memset(message,0,4096);
}
delete message;
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 & which, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb)
+void NNTPwrapper::listMessages(const QString & which, Q3ValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb)
{
login();
if (!m_nntp)
return;
uint32_t res_messages,res_recent,res_unseen;
mailsession_status_folder(m_nntp->sto_session,(char*)which.latin1(),&res_messages,&res_recent,&res_unseen);
parseList(target,m_nntp->sto_session,which,true, maxSizeInKb);
}
void NNTPwrapper::login()
{
if (account->getOffline())
return;
/* we'll hold the line */
if ( m_nntp != NULL )
return;
@@ -173,35 +175,35 @@ void NNTPwrapper::login()
mailsession * session = m_nntp->sto_session;
newsnntp * news = ( ( nntp_session_state_data * )session->sess_data )->nntp_session;
news->nntp_progr_fun = &nntp_progress;
}
}
void NNTPwrapper::logout()
{
int err = NEWSNNTP_NO_ERROR;
if ( m_nntp == NULL )
return;
mailstorage_free(m_nntp);
m_nntp = 0;
}
-QValueList<Opie::Core::OSmartPointer<Folder> >* NNTPwrapper::listFolders() {
+Q3ValueList<Opie::Core::OSmartPointer<Folder> >* NNTPwrapper::listFolders() {
- QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<Opie::Core::OSmartPointer<Folder> >();
+ Q3ValueList<Opie::Core::OSmartPointer<Folder> >* folders = new Q3ValueList<Opie::Core::OSmartPointer<Folder> >();
QStringList groups;
if (account) {
groups = account->getGroups();
}
for ( QStringList::Iterator it = groups.begin(); it != groups.end(); ++it ) {
folders->append(new Folder((*it),"."));
}
return folders;
}
/* 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.
*/