Update of /cvsroot/mahogany/M/src/mail
In directory usw-pr-cvs1:/tmp/cvs-serv30173/src/mail
Modified Files:
MailFolderCC.cpp
Log Message:
check if we can set the flags before setting them to deal with the IMAP
folders which don't allow setting of some flags (or are just readonly)
(fixes bug 592)
Index: MailFolderCC.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/mail/MailFolderCC.cpp,v
retrieving revision 1.622
retrieving revision 1.623
diff -b -u -2 -r1.622 -r1.623
--- MailFolderCC.cpp 12 Jun 2002 16:46:53 -0000 1.622
+++ MailFolderCC.cpp 12 Jun 2002 17:58:07 -0000 1.623
@@ -4291,4 +4291,12 @@
CHECK_DEAD_RC("Cannot access closed folder '%s'.", false);
+ if ( !CanSetFlag(flag) )
+ {
+ ERRORMESSAGE((_("Impossible to set this flag for the folder '%s'."),
+ GetName().c_str()));
+
+ return false;
+ }
+
String flags = GetImapFlags(flag);
@@ -4466,4 +4474,45 @@
}
//else: flags didn't really change
+}
+
+bool MailFolderCC::IsReadOnly(void) const
+{
+ CHECK( m_MailStream, true, "MailFolderCC::IsReadOnly(): folder is closed" );
+
+ return m_MailStream->rdonly != 0;
+}
+
+bool MailFolderCC::CanSetFlag(int flags) const
+{
+ CHECK( m_MailStream, false, "MailFolderCC::CanSetFlag(): folder is closed" );
+
+ if ( !IsReadOnly() )
+ {
+ // assume we can set all the flags in a folder opened read/write
+ return true;
+ }
+
+ int canSet = 1;
+ if ( flags & MSG_STAT_SEEN )
+ {
+ canSet &= m_MailStream->perm_seen;
+ }
+
+ if ( flags & MSG_STAT_DELETED )
+ {
+ canSet &= m_MailStream->perm_deleted;
+ }
+
+ if ( flags & MSG_STAT_ANSWERED )
+ {
+ canSet &= m_MailStream->perm_answered;
+ }
+
+ if ( flags & MSG_STAT_FLAGGED )
+ {
+ canSet &= m_MailStream->perm_flagged;
+ }
+
+ return canSet != 0;
}
_______________________________________________________________
Sponsored by:
ThinkGeek at http://www.ThinkGeek.com/
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates