Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

merged

  • Loading branch information...
commit 23a6051709a98044dcf400e8c8502611ccb80212 2 parents 0da24fa + 01dd003
nferrier authored
Showing with 35 additions and 4 deletions.
  1. +1 −0  .hgtags
  2. +16 −2 src/md
  3. +18 −2 src/mdlib/__init__.py
View
1  .hgtags
@@ -10,3 +10,4 @@ f81bbefa2055cf5e56b9e84cc7f76031471feb01 release_0_5
fd42acc848fb2db832aaa578604e24351d066297 release_0_55
2696e89eeb1b3a5af40dfc00e92dbe552039d875 filtering_added_to_ls
c5235602ab062c9159bc209d0e5fe7d1a85429b5 release_0_56
+4e02b4d7fc1118f040916c60cc346a5a8c6eb9f8 release_0_58
View
18 src/md
@@ -138,8 +138,12 @@ class MdCLI(cmdln.Cmdln):
${cmd_usage}
"""
- client = MdClient(self.maildir)
- client.remove(message)
+ maildir = getattr(self.options, "maildir",MAILDIR)
+ client = MdClient(maildir)
+ try:
+ client.remove(message)
+ except KeyError:
+ return 1
def do_mv(self, subcmd, opts, message, folder):
"""${cmd_name}: move the specified message to the specified folder
@@ -157,6 +161,16 @@ class MdCLI(cmdln.Cmdln):
client = MdClient(self.maildir)
client.gettext(message, sys.stdout)
+ def do_raw(self, subcmd, opts, message):
+ maildir = getattr(self.options, "maildir",MAILDIR)
+ client = MdClient(maildir)
+ client.getraw(message, sys.stdout)
+
+ def do_rawpart(self, subcmd, opts, message):
+ maildir = getattr(self.options, "maildir",MAILDIR)
+ client = MdClient(maildir)
+ client.getrawpart(message, sys.stdout)
+
def do_struct(self, subcmd, opts, message):
"""${cmd_name}: get the structure of the specified message
View
20 src/mdlib/__init__.py
@@ -203,12 +203,28 @@ def gettext(self, msgid, stream=sys.stdout, splitter="--text follows this line--
print >>stream, part.get_payload(decode=True)
break
+ def getrawpart(self, msgid, stream=sys.stdout):
+ """Get the first part from the message and print it raw.
+ """
+ for hdr, part in self._get(msgid):
+ pl = part.get_payload(decode=True)
+ if pl != None:
+ print >>stream, pl
+ break
+
+ def getraw(self, msgid, stream=sys.stdout):
+ """Get the whole message and print it.
+ """
+ foldername, msgkey = msgid.split(SEPERATOR)
+ folder = self.folder if foldername == "INBOX" else self._getfolder(foldername)
+ msg = folder[msgkey]
+ print msg.content
+
def getstruct(self, msgid, stream=sys.stdout):
"""Get and print the whole message.
"""
for hdr,part in self._get(msgid):
- if part.get_content_type() == "text/plain":
- print >>stream, part.get_content_type()
+ print >>stream, part.get_content_type()
def get(self, msgid, stream=sys.stdout):
foldername, msgkey = msgid.split(SEPERATOR)
Please sign in to comment.
Something went wrong with that request. Please try again.