# Path: wh.py
# def shlexSplit(str, sep):
#   """
#   shlexSplit(str, sep)
#   
#   split string by separator, observing quotes
#   """
#   if not str:
#     return []
#   lex=shlex(str, posix=True)
#   lex.whitespace=sep
#   lex.commenters=''
#   lex.whitespace_split=True
#   return list(lex)


import ssl
import imaplib
import adm
from wh import shlexSplit
from imap_utf7 import decode as decodeUtf7, encode as encodeUtf7 # @UnusedImport
        for i in range(0, len(parts), 2):
          self.id[parts[i]]= parts[i+1]
        
    return self.ok()
  
  def GetAcl(self, mailbox):
    result=self.getresult(self.getacl(mailbox))
    if result:
      acls={}
      for line in result:
        parts=shlexSplit(line, ' ')     
        for i in range(1, len(parts), 2): 
          who=parts[i]
          acl=parts[i+1]
          acls[who] = acl
      return acls
    return None


  def SetAcl(self, mailbox, who, acl=None):
    if isinstance(who, list):
      lst=[mailbox]
      for item in who:
        if isinstance(item, tuple):
          lst.append(item[0])
          lst.append(item[1])
        else:
          lst.append(item)
      return self.getresult(self._simple_command('SETACL', *lst))
    else:

# Path: wh.py
# def shlexSplit(str, sep):
#   """
#   shlexSplit(str, sep)
#   
#   split string by separator, observing quotes
#   """
#   if not str:
#     return []
#   lex=shlex(str, posix=True)
#   lex.whitespace=sep
#   lex.commenters=''
#   lex.whitespace_split=True
#   return list(lex)


# Path: modImap/_imap.py
import ssl
import imaplib
import adm
from wh import shlexSplit
from imap_utf7 import decode as decodeUtf7, encode as encodeUtf7 # @UnusedImport

        for i in range(0, len(parts), 2):
          self.id[parts[i]]= parts[i+1]
        
    return self.ok()
  
  def GetAcl(self, mailbox):
    result=self.getresult(self.getacl(mailbox))
    if result:
      acls={}
      for line in result:
        parts=shlexSplit(line, ' ')     
        for i in range(1, len(parts), 2): 
          who=parts[i]
          acl=parts[i+1]
          acls[who] = acl
      return acls
    return None


  def SetAcl(self, mailbox, who, acl=None):
    if isinstance(who, list):
      lst=[mailbox]
      for item in who:
        if isinstance(item, tuple):
          lst.append(item[0])
          lst.append(item[1])
        else:
          lst.append(item)
      return self.getresult(self._simple_command('SETACL', *lst))
    else:

      return self.getresult(self.setacl(mailbox, who, acl))