Changeset 200:ed6498330d85

Show
Ignore:
Timestamp:
01/03/11 22:28:12 (17 months ago)
Author:
Menno Smits <menno@…>
Branch:
default
Message:

Add support for fetch modifiers (#62)

Patch from Thomas Jost Schnouki (schnouki@…).

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • imapclient/imapclient.py

    r156 r200  
    459459 
    460460 
    461     def fetch(self, messages, parts): 
     461    def fetch(self, messages, parts, modifiers=None): 
    462462        """Retrieve selected data items for one or more messages. 
    463463 
    464464        @param messages: Message IDs to fetch. 
    465465        @param parts: A sequence of data items to retrieve. 
     466        @param modifiers: An optional sequence of modifiers. 
    466467        @return: A dictionary indexed by message number. Each item is itself a 
    467468            dictionary containing the requested message parts. 
     
    474475        msg_list = messages_to_str(messages) 
    475476        parts_list = seq_to_parenlist([p.upper() for p in parts]) 
     477        modifiers_list = None 
     478        if modifiers is not None: 
     479          modifiers_list = seq_to_parenlist([m.upper() for m in modifiers]) 
    476480 
    477481        if self.use_uid: 
    478             tag = self._imap._command('UID', 'FETCH', msg_list, parts_list) 
    479         else: 
    480             tag = self._imap._command('FETCH', msg_list, parts_list) 
     482            tag = self._imap._command('UID', 'FETCH', msg_list, parts_list, modifiers_list) 
     483        else: 
     484            tag = self._imap._command('FETCH', msg_list, parts_list, modifiers_list) 
    481485        typ, data = self._imap._command_complete('FETCH', tag) 
    482486        self._checkok('fetch', typ, data)