summaryrefslogtreecommitdiff
path: root/noncore/net/mail/libmailwrapper/imapwrapper.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/mail/libmailwrapper/imapwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
index d252159..bb74de9 100644
--- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
@@ -8,48 +8,49 @@
IMAPwrapper::IMAPwrapper( IMAPaccount *a )
: AbstractMail()
{
account = a;
m_imap = 0;
}
IMAPwrapper::~IMAPwrapper()
{
logout();
}
void IMAPwrapper::imap_progress( size_t current, size_t maximum )
{
qDebug( "IMAP: %i of %i", current, maximum );
}
void IMAPwrapper::login()
{
const char *server, *user, *pass;
uint16_t port;
int err = MAILIMAP_NO_ERROR;
+ if (account->getOffline()) return;
/* we are connected this moment */
/* TODO: setup a timer holding the line or if connection closed - delete the value */
if (m_imap) {
err = mailimap_noop(m_imap);
if (err!=MAILIMAP_NO_ERROR) {
logout();
} else {
mailstream_flush(m_imap->imap_stream);
return;
}
}
server = account->getServer().latin1();
port = account->getPort().toUInt();
if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) {
LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true );
login.show();
if ( QDialog::Accepted == login.exec() ) {
// ok
user = login.getUser().latin1();
pass = login.getPassword().latin1();
} else {
// cancel
qDebug( "IMAP: Login canceled" );
return;
@@ -985,30 +986,35 @@ void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox)
}
} else {
qDebug("Error retrieving status");
}
if (status) mailimap_mailbox_data_status_free(status);
if (att_list) mailimap_status_att_list_free(att_list);
}
void IMAPwrapper::storeMessage(const char*msg,size_t length, const QString&folder)
{
login();
if (!m_imap) return;
if (!msg) return;
int r = mailimap_append(m_imap,(char*)folder.latin1(),0,0,msg,length);
if (r != MAILIMAP_NO_ERROR) {
Global::statusMessage("Error storing mail!");
}
}
const QString&IMAPwrapper::getType()const
{
return account->getType();
}
+const QString&IMAPwrapper::getName()const
+{
+ return account->getAccountName();
+}
+
encodedString* IMAPwrapper::fetchRawBody(const RecMail&mail)
{
// dummy
QValueList<int> path;
return fetchRawPart(mail,path,false);
}