summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/accountview.cpp6
-rw-r--r--noncore/net/mail/composemail.cpp2
-rw-r--r--noncore/net/mail/editaccounts.cpp30
-rw-r--r--noncore/net/mail/libmailwrapper/abstractmail.h4
-rw-r--r--noncore/net/mail/libmailwrapper/genericwrapper.cpp10
-rw-r--r--noncore/net/mail/libmailwrapper/genericwrapper.h2
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.cpp2
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.h2
-rw-r--r--noncore/net/mail/libmailwrapper/maildefines.h16
-rw-r--r--noncore/net/mail/libmailwrapper/mboxwrapper.cpp4
-rw-r--r--noncore/net/mail/libmailwrapper/mboxwrapper.h4
-rw-r--r--noncore/net/mail/libmailwrapper/mhwrapper.cpp4
-rw-r--r--noncore/net/mail/libmailwrapper/mhwrapper.h6
-rw-r--r--noncore/net/mail/libmailwrapper/nntpwrapper.cpp6
-rw-r--r--noncore/net/mail/libmailwrapper/nntpwrapper.h2
-rw-r--r--noncore/net/mail/libmailwrapper/pop3wrapper.cpp2
-rw-r--r--noncore/net/mail/libmailwrapper/pop3wrapper.h2
-rw-r--r--noncore/net/mail/libmailwrapper/settings.cpp18
-rw-r--r--noncore/net/mail/libmailwrapper/settings.h9
-rw-r--r--noncore/net/mail/libmailwrapper/statusmail.cpp8
-rw-r--r--noncore/net/mail/opiemail.cpp2
21 files changed, 93 insertions, 48 deletions
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp
index 64557ee..4375044 100644
--- a/noncore/net/mail/accountview.cpp
+++ b/noncore/net/mail/accountview.cpp
@@ -61,22 +61,22 @@ void AccountView::populate( QList<Account> list )
Account *it;
for ( it = list.first(); it; it = list.next() )
{
- if ( it->getType().compare( "IMAP" ) == 0 )
+ if ( it->getType() == MAILLIB::A_IMAP )
{
IMAPaccount *imap = static_cast<IMAPaccount *>(it);
qDebug( "added IMAP " + imap->getAccountName() );
imapAccounts.append(new IMAPviewItem( imap, this ));
}
- else if ( it->getType().compare( "POP3" ) == 0 )
+ else if ( it->getType() == MAILLIB::A_POP3 )
{
POP3account *pop3 = static_cast<POP3account *>(it);
qDebug( "added POP3 " + pop3->getAccountName() );
/* must not be hold 'cause it isn't required */
(void) new POP3viewItem( pop3, this );
}
- else if ( it->getType().compare( "NNTP" ) == 0 )
+ else if ( it->getType() == MAILLIB::A_NNTP )
{
NNTPaccount *nntp = static_cast<NNTPaccount *>(it);
qDebug( "added NNTP " + nntp->getAccountName() );
/* must not be hold 'cause it isn't required */
diff --git a/noncore/net/mail/composemail.cpp b/noncore/net/mail/composemail.cpp
index f51a8fe..f8ac76f 100644
--- a/noncore/net/mail/composemail.cpp
+++ b/noncore/net/mail/composemail.cpp
@@ -45,9 +45,9 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m
QList<Account> accounts = settings->getAccounts();
Account *it;
for ( it = accounts.first(); it; it = accounts.next() ) {
- if ( it->getType().compare( "SMTP" ) == 0 ) {
+ if ( it->getType()==MAILLIB::A_SMTP ) {
SMTPaccount *smtp = static_cast<SMTPaccount *>(it);
smtpAccountBox->insertItem( smtp->getAccountName() );
smtpAccounts.append( smtp );
}
diff --git a/noncore/net/mail/editaccounts.cpp b/noncore/net/mail/editaccounts.cpp
index 28d531b..5c4bdf7 100644
--- a/noncore/net/mail/editaccounts.cpp
+++ b/noncore/net/mail/editaccounts.cpp
@@ -15,9 +15,27 @@ AccountListItem::AccountListItem( QListView *parent, Account *a)
: QListViewItem( parent )
{
account = a;
setText( 0, account->getAccountName() );
- setText( 1, account->getType() );
+ QString ttext = "";
+ switch (account->getType()) {
+ case MAILLIB::A_NNTP:
+ ttext="NNTP";
+ break;
+ case MAILLIB::A_POP3:
+ ttext = "POP3";
+ break;
+ case MAILLIB::A_IMAP:
+ ttext = "IMAP";
+ break;
+ case MAILLIB::A_SMTP:
+ ttext = "SMTP";
+ break;
+ default:
+ ttext = "UNKNOWN";
+ break;
+ }
+ setText( 1, ttext);
}
EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags )
: EditAccountsUI( parent, name, modal, flags )
@@ -48,9 +66,9 @@ void EditAccounts::slotFillLists()
QList<Account> accounts = settings->getAccounts();
Account *it;
for ( it = accounts.first(); it; it = accounts.next() )
{
- if ( it->getType().compare( "NNTP" ) == 0 )
+ if ( it->getType()==MAILLIB::A_NNTP )
{
(void) new AccountListItem( newsList, it );
}
else
@@ -142,36 +160,36 @@ void EditAccounts::slotNewAccount( const QString &type )
}
void EditAccounts::slotEditAccount( Account *account )
{
- if ( account->getType().compare( "IMAP" ) == 0 )
+ if ( account->getType() == MAILLIB::A_IMAP )
{
IMAPaccount *imapAcc = static_cast<IMAPaccount *>(account);
IMAPconfig imap( imapAcc, this, 0, true, WStyle_ContextHelp );
if ( QDialog::Accepted == QPEApplication::execDialog( &imap ) )
{
slotFillLists();
}
}
- else if ( account->getType().compare( "POP3" ) == 0 )
+ else if ( account->getType()==MAILLIB::A_POP3 )
{
POP3account *pop3Acc = static_cast<POP3account *>(account);
POP3config pop3( pop3Acc, this, 0, true, WStyle_ContextHelp );
if ( QDialog::Accepted == QPEApplication::execDialog( &pop3 ) )
{
slotFillLists();
}
}
- else if ( account->getType().compare( "SMTP" ) == 0 )
+ else if ( account->getType()==MAILLIB::A_SMTP )
{
SMTPaccount *smtpAcc = static_cast<SMTPaccount *>(account);
SMTPconfig smtp( smtpAcc, this, 0, true, WStyle_ContextHelp );
if ( QDialog::Accepted == QPEApplication::execDialog( &smtp ) )
{
slotFillLists();
}
}
- else if ( account->getType().compare( "NNTP" ) == 0 )
+ else if ( account->getType()==MAILLIB::A_NNTP)
{
NNTPaccount *nntpAcc = static_cast<NNTPaccount *>(account);
NNTPconfig nntp( nntpAcc, this, 0, true, WStyle_ContextHelp );
if ( QDialog::Accepted == QPEApplication::execDialog( &nntp ) )
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.h b/noncore/net/mail/libmailwrapper/abstractmail.h
index b6e1538..442ebfe 100644
--- a/noncore/net/mail/libmailwrapper/abstractmail.h
+++ b/noncore/net/mail/libmailwrapper/abstractmail.h
@@ -1,7 +1,9 @@
#ifndef __abstract_mail_
#define __abstract_mail_
+#include "maildefines.h"
+
#include <qobject.h>
#include "settings.h"
class RecMail;
@@ -54,9 +56,9 @@ public:
static AbstractMail* getWrapper(const QString&a,const QString&name="Local Folders");
static QString defaultLocalfolder();
- virtual const QString&getType()const=0;
+ virtual MAILLIB::ATYPE getType()const=0;
virtual const QString&getName()const=0;
protected:
static encodedString*decode_String(const encodedString*text,const QString&enc);
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.cpp b/noncore/net/mail/libmailwrapper/genericwrapper.cpp
index 350808a..3fe319b 100644
--- a/noncore/net/mail/libmailwrapper/genericwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/genericwrapper.cpp
@@ -443,9 +443,9 @@ void Genericwrapper::cleanMimeCache()
bodyCache.clear();
qDebug("Genericwrapper: cache cleaned");
}
-void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const QString&mailbox)
+void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const QString&mailbox,bool mbox_as_to)
{
int r;
mailmessage_list * env_list = 0;
r = mailsession_get_messages_list(session,&env_list);
@@ -487,10 +487,14 @@ void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const
if (single_fields.fld_subject)
mail->setSubject( convert_String(single_fields.fld_subject->sbj_value));
if (single_fields.fld_from)
mail->setFrom(parseMailboxList(single_fields.fld_from->frm_mb_list));
- if (single_fields.fld_to)
- mail->setTo( parseAddressList( single_fields.fld_to->to_addr_list ) );
+ if (!mbox_as_to) {
+ if (single_fields.fld_to)
+ mail->setTo( parseAddressList( single_fields.fld_to->to_addr_list ) );
+ } else {
+ mail->setTo(mailbox);
+ }
if (single_fields.fld_cc)
mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) );
if (single_fields.fld_bcc)
mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) );
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.h b/noncore/net/mail/libmailwrapper/genericwrapper.h
index e471dc8..b451416 100644
--- a/noncore/net/mail/libmailwrapper/genericwrapper.h
+++ b/noncore/net/mail/libmailwrapper/genericwrapper.h
@@ -53,9 +53,9 @@ protected:
void traverseBody(RecBody&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rek=0,int current_count=1);
static void fillSingleBody(RecPart&target,mailmessage*message,mailmime*mime);
static void fillParameters(RecPart&target,clist*parameters);
static QString getencoding(mailmime_mechanism*aEnc);
- virtual void parseList(QList<RecMail> &target,mailsession*session,const QString&mailbox);
+ virtual void parseList(QList<RecMail> &target,mailsession*session,const QString&mailbox,bool mbox_as_to=false);
QString msgTempName;
unsigned int last_msg_id;
QMap<QString,encodedString*> bodyCache;
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
index 1dfcc4c..3375e69 100644
--- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
@@ -1089,9 +1089,9 @@ void IMAPwrapper::storeMessage(const char*msg,size_t length, const QString&folde
Global::statusMessage("Error storing mail!");
}
}
-const QString&IMAPwrapper::getType()const
+MAILLIB::ATYPE IMAPwrapper::getType()const
{
return account->getType();
}
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.h b/noncore/net/mail/libmailwrapper/imapwrapper.h
index 0a1fe2c..2623725 100644
--- a/noncore/net/mail/libmailwrapper/imapwrapper.h
+++ b/noncore/net/mail/libmailwrapper/imapwrapper.h
@@ -45,9 +45,9 @@ public:
static void imap_progress( size_t current, size_t maximum );
virtual void logout();
- virtual const QString&getType()const;
+ virtual MAILLIB::ATYPE getType()const;
virtual const QString&getName()const;
protected:
RecMail*parse_list_result(mailimap_msg_att*);
diff --git a/noncore/net/mail/libmailwrapper/maildefines.h b/noncore/net/mail/libmailwrapper/maildefines.h
new file mode 100644
index 0000000..431f9ea
--- a/dev/null
+++ b/noncore/net/mail/libmailwrapper/maildefines.h
@@ -0,0 +1,16 @@
+#ifndef __MAILDEFINES_H
+#define __MAILDEFINES_H
+
+namespace MAILLIB {
+ enum ATYPE {
+ A_UNDEFINED,
+ A_IMAP,
+ A_POP3,
+ A_SMTP,
+ A_MH,
+ A_MBOX,
+ A_NNTP,
+ };
+}
+
+#endif
diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp
index 97f301e..11ffd92 100644
--- a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp
@@ -5,9 +5,9 @@
#include <qdir.h>
#include <stdlib.h>
#include <qpe/global.h>
-const QString MBOXwrapper::wrapperType="MBOX";
+const MAILLIB::ATYPE MBOXwrapper::wrapperType=MAILLIB::MBOX;
MBOXwrapper::MBOXwrapper(const QString & mbox_dir,const QString&mbox_name)
: Genericwrapper(),MBOXPath(mbox_dir),MBOXName(mbox_name)
{
@@ -325,9 +325,9 @@ void MBOXwrapper::statusFolder(folderStat&target_stat,const QString & mailbox)
if (folder) mailfolder_free(folder);
if (storage) mailstorage_free(storage);
}
-const QString&MBOXwrapper::getType()const
+MAILLIB::ATYPE MBOXwrapper::getType()const
{
return wrapperType;
}
diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.h b/noncore/net/mail/libmailwrapper/mboxwrapper.h
index a579a3d..a12a1dd 100644
--- a/noncore/net/mail/libmailwrapper/mboxwrapper.h
+++ b/noncore/net/mail/libmailwrapper/mboxwrapper.h
@@ -34,15 +34,15 @@ public:
virtual encodedString* fetchRawBody(const RecMail&mail);
virtual void deleteMails(const QString & FolderName,QList<RecMail> &target);
virtual int deleteAllMail(const Folder*);
- virtual const QString&getType()const;
+ virtual MAILLIB::ATYPE getType()const;
virtual const QString&getName()const;
protected:
static void deleteMails(mailmbox_folder*f,QList<RecMail> &target);
QString MBOXPath;
QString MBOXName;
- static const QString wrapperType;
+ static const MAILLIB::ATYPE wrapperType;
};
#endif
diff --git a/noncore/net/mail/libmailwrapper/mhwrapper.cpp b/noncore/net/mail/libmailwrapper/mhwrapper.cpp
index df7f773..179bd34 100644
--- a/noncore/net/mail/libmailwrapper/mhwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/mhwrapper.cpp
@@ -7,9 +7,9 @@
#include <stdlib.h>
#include <qpe/global.h>
#include <opie2/oprocess.h>
-const QString MHwrapper::wrapperType="MH";
+const MAILLIB::ATYPE MHwrapper::wrapperType=MAILLIB::A_MH;
MHwrapper::MHwrapper(const QString & mbox_dir,const QString&mbox_name)
: Genericwrapper(),MHPath(mbox_dir),MHName(mbox_name)
{
@@ -365,9 +365,9 @@ void MHwrapper::statusFolder(folderStat&target_stat,const QString & mailbox)
Global::statusMessage(tr("Error retrieving status"));
}
}
-const QString&MHwrapper::getType()const
+MAILLIB::ATYPE MHwrapper::getType()const
{
return wrapperType;
}
diff --git a/noncore/net/mail/libmailwrapper/mhwrapper.h b/noncore/net/mail/libmailwrapper/mhwrapper.h
index b8e380c..c1ba78d 100644
--- a/noncore/net/mail/libmailwrapper/mhwrapper.h
+++ b/noncore/net/mail/libmailwrapper/mhwrapper.h
@@ -1,7 +1,9 @@
#ifndef __MH_WRAPPER_H
#define __MH_WRAPPER_H
+#include "maildefines.h"
+
#include "genericwrapper.h"
#include <qstring.h>
class RecMail;
@@ -36,9 +38,9 @@ public:
virtual encodedString* fetchRawBody(const RecMail&mail);
virtual void deleteMails(const QString & FolderName,QList<RecMail> &target);
virtual int deleteAllMail(const Folder*);
- virtual const QString&getType()const;
+ virtual MAILLIB::ATYPE getType()const;
virtual const QString&getName()const;
public slots:
/* for deleting maildirs we are using a system call */
@@ -47,9 +49,9 @@ public slots:
protected:
QString buildPath(const QString&p);
QString MHPath;
QString MHName;
- static const QString wrapperType;
+ static const MAILLIB::ATYPE wrapperType;
void init_storage();
void clean_storage();
diff --git a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp
index 5a8c224..1956c61 100644
--- a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp
@@ -102,9 +102,9 @@ void NNTPwrapper::listMessages(const QString & which, QList<RecMail> &target )
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);
+ parseList(target,m_nntp->sto_session,which,true);
}
void NNTPwrapper::login()
{
@@ -268,17 +268,17 @@ encodedString* NNTPwrapper::fetchRawBody(const RecMail&mail) {
}
return res;
}
-const QString&NNTPwrapper::getType()const {
+MAILLIB::ATYPE NNTPwrapper::getType()const {
return account->getType();
}
const QString&NNTPwrapper::getName()const{
return account->getAccountName();
}
-void NNTPwrapper::deleteMail(const RecMail&mail) {
+void NNTPwrapper::deleteMail(const RecMail&) {
}
int NNTPwrapper::deleteAllMail(const Folder*) {
}
diff --git a/noncore/net/mail/libmailwrapper/nntpwrapper.h b/noncore/net/mail/libmailwrapper/nntpwrapper.h
index d51c955..955b9f1 100644
--- a/noncore/net/mail/libmailwrapper/nntpwrapper.h
+++ b/noncore/net/mail/libmailwrapper/nntpwrapper.h
@@ -32,9 +32,9 @@ public:
virtual RecBody fetchBody( const RecMail &mail );
virtual encodedString* fetchRawBody(const RecMail&mail);
virtual void logout();
- virtual const QString&getType()const;
+ virtual MAILLIB::ATYPE getType()const;
virtual const QString&getName()const;
static void nntp_progress( size_t current, size_t maximum );
protected:
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
index 6fab401..0939b22 100644
--- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
@@ -245,9 +245,9 @@ encodedString* POP3wrapper::fetchRawBody(const RecMail&mail) {
}
return res;
}
-const QString&POP3wrapper::getType()const {
+MAILLIB::ATYPE POP3wrapper::getType()const {
return account->getType();
}
const QString&POP3wrapper::getName()const{
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.h b/noncore/net/mail/libmailwrapper/pop3wrapper.h
index a24b9cf..391c841 100644
--- a/noncore/net/mail/libmailwrapper/pop3wrapper.h
+++ b/noncore/net/mail/libmailwrapper/pop3wrapper.h
@@ -28,9 +28,9 @@ public:
virtual RecBody fetchBody( const RecMail &mail );
virtual encodedString* fetchRawBody(const RecMail&mail);
virtual void logout();
- virtual const QString&getType()const;
+ virtual MAILLIB::ATYPE getType()const;
virtual const QString&getName()const;
static void pop3_progress( size_t current, size_t maximum );
protected:
diff --git a/noncore/net/mail/libmailwrapper/settings.cpp b/noncore/net/mail/libmailwrapper/settings.cpp
index 0d34fd5..2c81963 100644
--- a/noncore/net/mail/libmailwrapper/settings.cpp
+++ b/noncore/net/mail/libmailwrapper/settings.cpp
@@ -105,9 +105,9 @@ void Settings::readAccounts()
Account::Account()
{
accountName = "changeMe";
- type = "changeMe";
+ type = MAILLIB::A_UNDEFINED;
ssl = false;
connectionType = 1;
offline = false;
}
@@ -124,9 +124,9 @@ IMAPaccount::IMAPaccount()
file = IMAPaccount::getUniqueFileName();
accountName = "New IMAP Account";
ssl = false;
connectionType = 1;
- type = "IMAP";
+ type = MAILLIB::A_IMAP;
port = IMAP_PORT;
}
IMAPaccount::IMAPaccount( QString filename )
@@ -135,9 +135,9 @@ IMAPaccount::IMAPaccount( QString filename )
file = filename;
accountName = "New IMAP Account";
ssl = false;
connectionType = 1;
- type = "IMAP";
+ type = MAILLIB::A_IMAP;
port = IMAP_PORT;
}
QString IMAPaccount::getUniqueFileName()
@@ -209,9 +209,9 @@ POP3account::POP3account()
file = POP3account::getUniqueFileName();
accountName = "New POP3 Account";
ssl = false;
connectionType = 1;
- type = "POP3";
+ type = MAILLIB::A_POP3;
port = POP3_PORT;
}
POP3account::POP3account( QString filename )
@@ -220,9 +220,9 @@ POP3account::POP3account( QString filename )
file = filename;
accountName = "New POP3 Account";
ssl = false;
connectionType = 1;
- type = "POP3";
+ type = MAILLIB::A_POP3;
port = POP3_PORT;
}
QString POP3account::getUniqueFileName()
@@ -290,9 +290,9 @@ SMTPaccount::SMTPaccount()
login = false;
useCC = false;
useBCC = false;
useReply = false;
- type = "SMTP";
+ type = MAILLIB::A_SMTP;
port = SMTP_PORT;
}
SMTPaccount::SMTPaccount( QString filename )
@@ -302,9 +302,9 @@ SMTPaccount::SMTPaccount( QString filename )
accountName = "New SMTP Account";
ssl = false;
connectionType = 1;
login = false;
- type = "SMTP";
+ type = MAILLIB::A_SMTP;
port = SMTP_PORT;
}
QString SMTPaccount::getUniqueFileName()
@@ -368,9 +368,9 @@ NNTPaccount::NNTPaccount()
file = NNTPaccount::getUniqueFileName();
accountName = "New NNTP Account";
ssl = false;
login = false;
- type = "NNTP";
+ type = MAILLIB::A_NNTP;
port = NNTP_PORT;
}
NNTPaccount::NNTPaccount( QString filename )
@@ -379,9 +379,9 @@ NNTPaccount::NNTPaccount( QString filename )
file = filename;
accountName = "New NNTP Account";
ssl = false;
login = false;
- type = "NNTP";
+ type = MAILLIB::A_NNTP;
port = NNTP_PORT;
}
QString NNTPaccount::getUniqueFileName()
diff --git a/noncore/net/mail/libmailwrapper/settings.h b/noncore/net/mail/libmailwrapper/settings.h
index 1feedbf..27e2823 100644
--- a/noncore/net/mail/libmailwrapper/settings.h
+++ b/noncore/net/mail/libmailwrapper/settings.h
@@ -1,7 +1,9 @@
#ifndef SETTINGS_H
#define SETTINGS_H
+#include "maildefines.h"
+
#include <qobject.h>
#include <qlist.h>
class Account
@@ -13,9 +15,9 @@ public:
void remove();
void setAccountName( QString name ) { accountName = name; }
const QString&getAccountName()const{ return accountName; }
- const QString&getType()const{ return type; }
+ MAILLIB::ATYPE getType()const{ return type; }
void setServer(const QString&str){ server = str; }
const QString&getServer()const{ return server; }
@@ -40,14 +42,15 @@ public:
virtual QString getFileName() { return accountName; }
virtual void read() { qDebug( "base reading..." ); }
virtual void save() { qDebug( "base saving..." ); }
-
+
protected:
- QString accountName, type, server, port, user, password;
+ QString accountName, server, port, user, password;
bool ssl;
int connectionType;
bool offline;
+ MAILLIB::ATYPE type;
};
class IMAPaccount : public Account
{
diff --git a/noncore/net/mail/libmailwrapper/statusmail.cpp b/noncore/net/mail/libmailwrapper/statusmail.cpp
index 4134e79..b78244d 100644
--- a/noncore/net/mail/libmailwrapper/statusmail.cpp
+++ b/noncore/net/mail/libmailwrapper/statusmail.cpp
@@ -25,17 +25,17 @@ void StatusMail::initAccounts(QList<Account>&accounts)
currentPop3Stat.message_count=0;
currentPop3Stat.message_recent=0;
currentPop3Stat.message_unseen=0;
for ( it = accounts.first(); it; it = accounts.next() ) {
- if ( it->getType().compare( "IMAP" ) == 0 && !it->getOffline() ) {
+ if ( it->getType()==MAILLIB::A_IMAP && !it->getOffline() ) {
IMAPaccount*ima = static_cast<IMAPaccount *>(it);
current = AbstractMail::getWrapper(ima);
connectionList.append(current);
current->statusFolder(currentStat);
currentImapStat.message_count+=currentStat.message_unseen;
currentImapStat.message_count+=currentStat.message_recent;
currentImapStat.message_count+=currentStat.message_count;
- } else if ( it->getType().compare( "POP3" ) == 0 && !it->getOffline() ) {
+ } else if ( it->getType() == MAILLIB::A_POP3 && !it->getOffline() ) {
POP3account *pop3 = static_cast<POP3account *>(it);
current = AbstractMail::getWrapper(pop3);
connectionList.append(current);
current->statusFolder(currentStat);
@@ -65,13 +65,13 @@ void StatusMail::check_current_stat(folderStat&targetStat)
currentImapStat = currentPop3Stat;
for ( it = connectionList.first(); it; it = connectionList.next() ) {
it->statusFolder(currentStat);
it->logout();
- if (it->getType().lower()=="imap") {
+ if (it->getType() == MAILLIB::A_IMAP) {
currentImapStat.message_unseen+=currentStat.message_unseen;
currentImapStat.message_recent+=currentStat.message_recent;
currentImapStat.message_count+=currentStat.message_count;
- } else if (it->getType().lower()=="pop3") {
+ } else if (it->getType() == MAILLIB::A_POP3) {
currentPop3Stat.message_count+=currentStat.message_count;
qDebug("Pop3 count: %i",currentPop3Stat.message_count);
}
}
diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp
index 6bfc824..d8b58b6 100644
--- a/noncore/net/mail/opiemail.cpp
+++ b/noncore/net/mail/opiemail.cpp
@@ -81,9 +81,9 @@ void OpieMail::slotSendQueued()
smtpList.setAutoDelete(false);
Account *it;
for ( it = list.first(); it; it = list.next() )
{
- if ( it->getType().compare( "SMTP" ) == 0 )
+ if ( it->getType() == MAILLIB::A_SMTP )
{
smtp = static_cast<SMTPaccount *>(it);
smtpList.append(smtp);
}