-rw-r--r-- | noncore/net/mail/imapwrapper.cpp | 4 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.cpp | 4 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mailwrapper.cpp | 12 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mailwrapper.h | 4 | ||||
-rw-r--r-- | noncore/net/mail/mailwrapper.cpp | 12 | ||||
-rw-r--r-- | noncore/net/mail/mailwrapper.h | 4 |
6 files changed, 32 insertions, 8 deletions
diff --git a/noncore/net/mail/imapwrapper.cpp b/noncore/net/mail/imapwrapper.cpp index b253b49..0ce2c6c 100644 --- a/noncore/net/mail/imapwrapper.cpp +++ b/noncore/net/mail/imapwrapper.cpp @@ -191,29 +191,31 @@ QList<Folder>* IMAPwrapper::listFolders() bool selectable = true; mailimap_mbx_list_flags*bflags; err = mailimap_list( m_imap, (char*)path, (char*)mask, &result ); if ( err == MAILIMAP_NO_ERROR ) { current = result->first; for ( current=clist_begin(result);current!=NULL;current=clist_next(current)) { list = (mailimap_mailbox_list *) current->data; // it is better use the deep copy mechanism of qt itself // instead of using strdup! temp = list->mb_name; if (temp.lower()=="inbox") continue; + if (temp.lower()==account->getPrefix().lower()) + continue; if ( (bflags = list->mb_flag) ) { selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&& bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT); } - folders->append(new IMAPFolder(temp,selectable)); + folders->append(new IMAPFolder(temp,selectable,account->getPrefix())); } } else { qDebug("error fetching folders %s",m_imap->imap_response); } mailimap_list_result_free( result ); return folders; } RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) { RecMail * m = 0; mailimap_msg_att_item *item=0; diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp index b253b49..0ce2c6c 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp @@ -191,29 +191,31 @@ QList<Folder>* IMAPwrapper::listFolders() bool selectable = true; mailimap_mbx_list_flags*bflags; err = mailimap_list( m_imap, (char*)path, (char*)mask, &result ); if ( err == MAILIMAP_NO_ERROR ) { current = result->first; for ( current=clist_begin(result);current!=NULL;current=clist_next(current)) { list = (mailimap_mailbox_list *) current->data; // it is better use the deep copy mechanism of qt itself // instead of using strdup! temp = list->mb_name; if (temp.lower()=="inbox") continue; + if (temp.lower()==account->getPrefix().lower()) + continue; if ( (bflags = list->mb_flag) ) { selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&& bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT); } - folders->append(new IMAPFolder(temp,selectable)); + folders->append(new IMAPFolder(temp,selectable,account->getPrefix())); } } else { qDebug("error fetching folders %s",m_imap->imap_response); } mailimap_list_result_free( result ); return folders; } RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) { RecMail * m = 0; mailimap_msg_att_item *item=0; diff --git a/noncore/net/mail/libmailwrapper/mailwrapper.cpp b/noncore/net/mail/libmailwrapper/mailwrapper.cpp index 3ffc274..96602c2 100644 --- a/noncore/net/mail/libmailwrapper/mailwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mailwrapper.cpp @@ -25,28 +25,38 @@ Folder::Folder(const QString&tmp_name ) for ( int pos = nameDisplay.find( '&' ); pos != -1; pos = nameDisplay.find( '&' ) ) { int end = nameDisplay.find( '-' ); if ( end == -1 || end <= pos ) break; QString str64 = nameDisplay.mid( pos + 1, end - pos - 1 ); // TODO: do real base64 decoding here ! if ( str64.compare( "APw" ) == 0 ) { nameDisplay = nameDisplay.replace( pos, end - pos + 1, "ue" ); } else if ( str64.compare( "APY" ) == 0 ) { nameDisplay = nameDisplay.replace( pos, end - pos + 1, "oe" ); } } - qDebug( "folder " + name + " - displayed as " + nameDisplay ); } + +IMAPFolder::IMAPFolder(const QString&name,bool select,const QString&prefix ) + : Folder( name ),m_MaySelect(select) +{ + if (prefix.length()>0) { + if (nameDisplay.startsWith(prefix) && nameDisplay.length()>prefix.length()) { + nameDisplay=nameDisplay.right(nameDisplay.length()-prefix.length()); + } + } +} + MailWrapper::MailWrapper( Settings *s ) : QObject() { settings = s; } QString MailWrapper::mailsmtpError( int errnum ) { switch ( errnum ) { case MAILSMTP_NO_ERROR: return tr( "No error" ); case MAILSMTP_ERROR_UNEXPECTED_CODE: diff --git a/noncore/net/mail/libmailwrapper/mailwrapper.h b/noncore/net/mail/libmailwrapper/mailwrapper.h index 34fd5c5..6994dd8 100644 --- a/noncore/net/mail/libmailwrapper/mailwrapper.h +++ b/noncore/net/mail/libmailwrapper/mailwrapper.h @@ -67,33 +67,33 @@ private: }; class Folder : public QObject { Q_OBJECT public: Folder( const QString&init_name ); const QString&getDisplayName()const { return nameDisplay; } const QString&getName()const { return name; } virtual bool may_select()const{return true;}; -private: +protected: QString nameDisplay, name; }; class IMAPFolder : public Folder { public: - IMAPFolder( QString name,bool select=true ) : Folder( name ),m_MaySelect(select) {} + IMAPFolder(const QString&name,bool select=true,const QString&prefix="" ); virtual bool may_select()const{return m_MaySelect;} private: bool m_MaySelect; }; class MailWrapper : public QObject { Q_OBJECT public: MailWrapper( Settings *s ); void sendMail( Mail mail ); diff --git a/noncore/net/mail/mailwrapper.cpp b/noncore/net/mail/mailwrapper.cpp index 3ffc274..96602c2 100644 --- a/noncore/net/mail/mailwrapper.cpp +++ b/noncore/net/mail/mailwrapper.cpp @@ -25,28 +25,38 @@ Folder::Folder(const QString&tmp_name ) for ( int pos = nameDisplay.find( '&' ); pos != -1; pos = nameDisplay.find( '&' ) ) { int end = nameDisplay.find( '-' ); if ( end == -1 || end <= pos ) break; QString str64 = nameDisplay.mid( pos + 1, end - pos - 1 ); // TODO: do real base64 decoding here ! if ( str64.compare( "APw" ) == 0 ) { nameDisplay = nameDisplay.replace( pos, end - pos + 1, "ue" ); } else if ( str64.compare( "APY" ) == 0 ) { nameDisplay = nameDisplay.replace( pos, end - pos + 1, "oe" ); } } - qDebug( "folder " + name + " - displayed as " + nameDisplay ); } + +IMAPFolder::IMAPFolder(const QString&name,bool select,const QString&prefix ) + : Folder( name ),m_MaySelect(select) +{ + if (prefix.length()>0) { + if (nameDisplay.startsWith(prefix) && nameDisplay.length()>prefix.length()) { + nameDisplay=nameDisplay.right(nameDisplay.length()-prefix.length()); + } + } +} + MailWrapper::MailWrapper( Settings *s ) : QObject() { settings = s; } QString MailWrapper::mailsmtpError( int errnum ) { switch ( errnum ) { case MAILSMTP_NO_ERROR: return tr( "No error" ); case MAILSMTP_ERROR_UNEXPECTED_CODE: diff --git a/noncore/net/mail/mailwrapper.h b/noncore/net/mail/mailwrapper.h index 34fd5c5..6994dd8 100644 --- a/noncore/net/mail/mailwrapper.h +++ b/noncore/net/mail/mailwrapper.h @@ -67,33 +67,33 @@ private: }; class Folder : public QObject { Q_OBJECT public: Folder( const QString&init_name ); const QString&getDisplayName()const { return nameDisplay; } const QString&getName()const { return name; } virtual bool may_select()const{return true;}; -private: +protected: QString nameDisplay, name; }; class IMAPFolder : public Folder { public: - IMAPFolder( QString name,bool select=true ) : Folder( name ),m_MaySelect(select) {} + IMAPFolder(const QString&name,bool select=true,const QString&prefix="" ); virtual bool may_select()const{return m_MaySelect;} private: bool m_MaySelect; }; class MailWrapper : public QObject { Q_OBJECT public: MailWrapper( Settings *s ); void sendMail( Mail mail ); |