Rework undocumented listjoin to create UID sequences

This function was badly named and completely undocumented. Rework it to
avoid copying the full UID list using an iterator. Make it possible to
hand it a list of UIDs as strings rather than implicitely relying on the
fact that they are numeric already. Document the code.

The behavior off the function itself remained otherwise unchanged.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Sebastian Spaeth
2011-08-22 12:21:11 +02:00
committed by Nicolas Sebrecht
parent 3302940382
commit fb8017991c
3 changed files with 23 additions and 25 deletions

View File

@ -55,7 +55,7 @@ class GmailFolder(IMAPFolder):
try:
imapobj.select(self.getfullname())
result = imapobj.uid('copy',
imaputil.listjoin(uidlist),
imaputil.uid_sequence(uidlist),
self.trash_folder)
assert result[0] == 'OK', \
"Bad IMAPlib result: %s" % result[0]

View File

@ -626,7 +626,7 @@ class IMAPFolder(BaseFolder):
self.ui.flagstoreadonly(self, uidlist, flags)
return
r = imapobj.uid('store',
imaputil.listjoin(uidlist),
imaputil.uid_sequence(uidlist),
operation + 'FLAGS',
imaputil.flagsmaildir2imap(flags))
assert r[0] == 'OK', 'Error with store: ' + '. '.join(r[1])