# Path: wh.py
# def xlt(s): # translate
#   return s
#   t=wx.GetTranslation(s)
#   # if dict set and t == s: log untranslated
#   return t
# 
# def YesNo(b):
#   if b:
#     return xlt("Yes")
#   else:
#     return xlt("No")


import adm
from wh import xlt, YesNo
from _imap import ImapServer
# (c) 2014 Andreas Pflug
#
# Licensed under the Apache License, 
# see LICENSE.TXT for conditions of usage


class Server(adm.ServerNode):
  shortname=xlt("IMAP4 Server")
  typename=xlt("IMAP4 Server")
#  findObjectIncremental=False


  def __init__(self, settings):
    adm.ServerNode.__init__(self, settings)
    self.userList=[]
    self.mailboxPath=""

  def IsConnected(self, _deep=False):
    return self.connection != None


  def Disconnect(self):
    if self.connection:
      self.connection.logout()
      self.connection=None
      
          
  def DoConnect(self):
    if not self.connection:
      self.connection=ImapServer.Create(self)

# Path: wh.py
# def xlt(s): # translate
#   return s
#   t=wx.GetTranslation(s)
#   # if dict set and t == s: log untranslated
#   return t
# 
# def YesNo(b):
#   if b:
#     return xlt("Yes")
#   else:
#     return xlt("No")


# Path: modImap/Server.py
import adm
from wh import xlt, YesNo
from _imap import ImapServer

# (c) 2014 Andreas Pflug
#
# Licensed under the Apache License, 
# see LICENSE.TXT for conditions of usage


class Server(adm.ServerNode):
  shortname=xlt("IMAP4 Server")
  typename=xlt("IMAP4 Server")
#  findObjectIncremental=False


  def __init__(self, settings):
    adm.ServerNode.__init__(self, settings)
    self.userList=[]
    self.mailboxPath=""

  def IsConnected(self, _deep=False):
    return self.connection != None


  def Disconnect(self):
    if self.connection:
      self.connection.logout()
      self.connection=None
      
          
  def DoConnect(self):
    if not self.connection:
      self.connection=ImapServer.Create(self)

      self.connection.Login(self.user, self.password)