コード例 #1
0
ファイル: account.py プロジェクト: pmaia/leap_mail
    def delete(self, name, force=False):
        """
        Deletes a mailbox.

        Right now it does not purge the messages, but just removes the mailbox
        name from the mailboxes list!!!

        :param name: the mailbox to be deleted
        :type name: str

        :param force: if True, it will not check for noselect flag or inferior
                      names. use with care.
        :type force: bool
        """
        name = self._parse_mailbox_name(name)

        if not name in self.mailboxes:
            raise imap4.MailboxException("No such mailbox: %r" % name)

        mbox = self.getMailbox(name)

        if force is False:
            # See if this box is flagged \Noselect
            # XXX use mbox.flags instead?
            if self.NOSELECT_FLAG in mbox.getFlags():
                # Check for hierarchically inferior mailboxes with this one
                # as part of their root.
                for others in self.mailboxes:
                    if others != name and others.startswith(name):
                        raise imap4.MailboxException, (
                            "Hierarchically inferior mailboxes "
                            "exist and \\Noselect is set")
        mbox.destroy()
        self._load_mailboxes()
コード例 #2
0
 def addMessage(self, msg, flags=None, date=None):
     raise imap4.MailboxException("Not implemented")
     headers = Parser().parse(msg)
     try:
         uid, hostname = headers["message-id"].replace("<", "").replace(
             ">", "").split("@")
     except Exception, e:
         return defer.fail(e)
コード例 #3
0
ファイル: account.py プロジェクト: pmaia/leap_mail
    def unsubscribe(self, name):
        """
        Unsubscribe from this mailbox

        :param name: name of the mailbox
        :type name: str
        """
        name = self._parse_mailbox_name(name)
        if name not in self.subscriptions:
            raise imap4.MailboxException("Not currently subscribed to %r" %
                                         name)
        self._set_subscription(name, False)
コード例 #4
0
 def check_can_be_deleted(mbox):
     global _mboxes
     # See if this box is flagged \Noselect
     mbox_flags = mbox.getFlags()
     if MessageFlags.NOSELECT_FLAG in mbox_flags:
         # Check for hierarchically inferior mailboxes with this one
         # as part of their root.
         for others in _mboxes:
             if others != name and others.startswith(name):
                 raise imap4.MailboxException(
                     "Hierarchically inferior mailboxes "
                     "exist and \\Noselect is set")
     return mbox
コード例 #5
0
ファイル: account.py プロジェクト: pmaia/leap_mail
    def getMailbox(self, name):
        """
        Returns a Mailbox with that name, without selecting it.

        :param name: name of the mailbox
        :type name: str

        :returns: a a SoledadMailbox instance
        :rtype: SoledadMailbox
        """
        name = self._parse_mailbox_name(name)

        if name not in self.mailboxes:
            raise imap4.MailboxException("No such mailbox: %r" % name)

        return SoledadMailbox(name, self._soledad, memstore=self._memstore)
コード例 #6
0
    def delete(self, name):
        name = name.upper()
        # See if this mailbox exists at all
        mbox = self.mailboxes.get(name)
        if not mbox:
            raise imap4.MailboxException("No such mailbox")
        # See if this box is flagged \Noselect
        if r'\Noselect' in mbox.getFlags():
            # Check for hierarchically inferior mailboxes with this one
            # as part of their root.
            for others in self.mailboxes.keys():
                if others != name and others.startswith(name):
                    raise imap4.MailboxException, (
                        "Hierarchically inferior mailboxes "
                        "exist and \\Noselect is set")
        mbox.destroy()

        # iff there are no hierarchically inferior names, we will
        # delete it from our ken.
        if self._inferiorNames(name) > 1:
            del self.mailboxes[name]
コード例 #7
0
    def _getMailbox(self, path, create=False):
        """
        Helper function to get a mailbox object at the given
        path, optionally creating it if it doesn't already exist.
        """
        if create:
            raise imap4.MailboxException("Create not yet supported.")

        if self.activesync.username in global_per_user_cache["mailbox"]:
            if path in global_per_user_cache["mailbox"][
                    self.activesync.username]:
                return global_per_user_cache["mailbox"][
                    self.activesync.username][path]
            for mbpath in global_per_user_cache["mailbox"][
                    self.activesync.username].keys():
                # case insensitive search
                if path.lower() == mbpath.lower():
                    return global_per_user_cache["mailbox"][
                        self.activesync.username][mbpath]
        d = self.activesync.add_operation(self.activesync.folder_sync)
        d.addCallback(self.listResponse)
        d.addCallback(self._getMailbox_callback, path, create)
        d.addErrback(self.listError)
        return d
コード例 #8
0
ファイル: twittermail.py プロジェクト: kalpaks/twimapd
 def getSubPart(self, part):
   print "SUBPART:: %s" % part
   raise imap4.MailboxException("getSubPart not implemented")
コード例 #9
0
ファイル: twittermail.py プロジェクト: kalpaks/twimapd
 def destroy(self):
   raise imap4.MailboxException("Not implemented")
コード例 #10
0
 def destroy(self):
     raise imap4.MailboxException('Not allowed')
コード例 #11
0
 def delete(self, path):
     "delete the mailbox at path"
     raise imap4.MailboxException("Delete not yet supported.")
コード例 #12
0
 def expunge(self):
     raise imap4.MailboxException('Not allowed')
コード例 #13
0
 def getUID(self, messageNum):
     if 0 < messageNum <= len(self.tasks):
         return self.tasks[messageNum - 1]["id"]
     raise imap4.MailboxException("Invalid message number")
コード例 #14
0
 def rename(self, oldname, newname):
     raise imap4.MailboxException('Not allowed')
コード例 #15
0
 def delete(self, name):
     raise imap4.MailboxException('Not allowed')
コード例 #16
0
 def create(self, pathspec):
     raise imap4.MailboxException('Not allowed')
コード例 #17
0
 def addMailbox(self, name, mbox):
     raise imap4.MailboxException('Not allowed')
コード例 #18
0
 def check_it_exists(mailboxes):
     if name not in mailboxes:
         raise imap4.MailboxException("No such mailbox: %r" % name)
     return True
コード例 #19
0
 def addMessage(self, msg, flags=(), date=None):
     raise imap4.MailboxException('Not allowed')
コード例 #20
0
 def getUIDNext(self):
     raise imap4.MailboxException("Not implemented")
コード例 #21
0
 def getSubPart(self, part):
     raise imap4.MailboxException("getSubPart not implemented")
コード例 #22
0
 def check_it_exists(mailboxes):
     global _mboxes
     _mboxes = mailboxes
     if name not in mailboxes:
         raise imap4.MailboxException("No such mailbox: %r" % name)
コード例 #23
0
ファイル: imap.py プロジェクト: thefonseca/localmail
 def delete(self, path):
     "delete the mailbox at path"
     raise imap4.MailboxException("Permission denied.")
コード例 #24
0
 def destroy(self):
     "complete remove the mailbox and all its contents"
     raise imap4.MailboxException("Permission denied.")
コード例 #25
0
ファイル: twittermail.py プロジェクト: kalpaks/twimapd
 def getUID(self, messageNum):
   raise imap4.MailboxException("Not implemented")
コード例 #26
0
 def create(self, path):
     raise imap4.MailboxException("Create not yet supported.")
     "create a mailbox at path and return it"
コード例 #27
0
ファイル: twittermail.py プロジェクト: kalpaks/twimapd
 def addMessage(self, msg, flags=None, date=None):
   #print "Add Message: %s :: %s" % (msg, flags)
   # passes a file handler here, need to cache fetchBodyFile so I can find the message id.
   raise imap4.MailboxException("Not implemented")
コード例 #28
0
 def rename(self, oldname, newname):
     "rename a mailbox"
     raise imap4.MailboxException("Rename not yet supported.")
コード例 #29
0
 def getUID(self, messageNum):
     messages = self.session.query(Message).order_by(
         Message.id.asc())[messageNum - 1:messageNum]
     if messages:
         return messages[0].id
     raise imap4.MailboxException('Message not found')