/head: changeset 33
Updated.
This commit is contained in:
11
head/offlineimap/ui/TTY.py
Normal file
11
head/offlineimap/ui/TTY.py
Normal file
@ -0,0 +1,11 @@
|
||||
import UIBase
|
||||
from getpass import getpass
|
||||
|
||||
class TTYUI(UIBase.UIBase):
|
||||
def _msg(s, msg):
|
||||
print msg
|
||||
|
||||
def getpass(s, accountname, host, port, user):
|
||||
return getpass("%s: Password required for %s on %s" %
|
||||
(accountname, user, host))
|
||||
|
99
head/offlineimap/ui/UIBase.py
Normal file
99
head/offlineimap/ui/UIBase.py
Normal file
@ -0,0 +1,99 @@
|
||||
# UI base class
|
||||
# Copyright (C) 2002 John Goerzen
|
||||
# <jgoerzen@complete.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
from imapsync import repository
|
||||
|
||||
class UIBase:
|
||||
################################################## UTILS
|
||||
def _msg(s, msg):
|
||||
"""Generic tool called when no other works."""
|
||||
raise NotImplementedException
|
||||
|
||||
def warn(s, msg):
|
||||
s._msg("WARNING: " + msg)
|
||||
|
||||
def getnicename(s, object):
|
||||
return str(object.__class__).split('.')[-1]
|
||||
|
||||
################################################## INPUT
|
||||
|
||||
def getpass(s, accountname, host, port, user):
|
||||
raise NotImplementedException
|
||||
|
||||
################################################## MESSAGES
|
||||
|
||||
def init_banner(s):
|
||||
"Display the copyright banner."
|
||||
s._msg("""imapsync
|
||||
Copyright (C) 2002 John Goerzen. All rights reserved.
|
||||
This software comes with NO WARRANTY: see the file COPYING for details.""")
|
||||
|
||||
def acct(s, accountname):
|
||||
s._msg("Processing account %s" % accountname)
|
||||
|
||||
def syncfolders(s, srcrepos, destrepos):
|
||||
s._msg("Copying folder structure from %s to %s" % \
|
||||
(s.getnicename(srcrepos), s.getnicename(destrepos)))
|
||||
|
||||
############################## Folder syncing
|
||||
def syncingfolder(s, srcrepos, srcfolder, destrepos, destfolder):
|
||||
"""Called when a folder sync operation is started."""
|
||||
s._msg("Syncing %s[%s] -> %s[%s]" % (srcrepos, srcfolder,
|
||||
destrepos, destfolder))
|
||||
|
||||
def validityproblem(s, folder):
|
||||
s.warn("UID validity problem for folder %s; skipping it" % \
|
||||
folder.getname())
|
||||
|
||||
def loadmessagelist(s, repos, folder):
|
||||
s._msg("Loading message list for %s[%s]" % (s.getnicename(repos),
|
||||
s.getnicename(folder)))
|
||||
|
||||
def messagelistloaded(s, repos, folder, count):
|
||||
s._msg("Message list for %s[%s] loaded: %d messages" % \
|
||||
(s.getnicename(repos), s.getnicename(folder), count))
|
||||
|
||||
############################## Message syncing
|
||||
|
||||
def syncingmessages(s, sr, sf, dr, df):
|
||||
s._msg("Syncing messages %s[%s] -> %s[%s]" % (s.getnicename(sr),
|
||||
s.getnicename(sf),
|
||||
s.getnicename(dr),
|
||||
s.getnicename(df)))
|
||||
|
||||
def copyingmessage(s, uid, src, destlist):
|
||||
ds = ["%s[%s]" % (s.getnicename(x), x.getname()) for x in destlist].join(', ')
|
||||
s._msg("Copy message %d %s[%s] -> %s" % (uid, s.getnicename(src),
|
||||
src.getname(), ds))
|
||||
|
||||
def deletingmessage(s, uid, destlist):
|
||||
ds = ["%s[%s]" % (s.getnicename(x), x.getname()) for x in destlist].join(', ')
|
||||
s._msg("Deleting message %d in %s" % (uid, ds))
|
||||
|
||||
def addingflags(s, uid, flags, destlist):
|
||||
ds = ["%s[%s]" % (s.getnicename(x), x.getname()) for x in destlist].join(', ')
|
||||
s._msg("Adding flags %s to message %d on %s" % \
|
||||
(flags.join(", "), uid, ds))
|
||||
|
||||
def deletingflags(s, uid, flags, destlist):
|
||||
ds = ["%s[%s]" % (s.getnicename(x), x.getname()) for x in destlist].join(', ')
|
||||
s._msg("Deleting flags %s to message %d on %s" % \
|
||||
(flags.join(", "), uid, ds))
|
||||
|
||||
|
||||
|
1
head/offlineimap/ui/__init__.py
Normal file
1
head/offlineimap/ui/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
import TTY
|
Reference in New Issue
Block a user