DND support
- dnd_action field added darcs-hash:20060122145141-86b55-501a990f765fa66033bdbad9e8da1885a2ef05fe.gz
This commit is contained in:
@@ -131,7 +131,7 @@ class MailComponent(Component):
|
||||
|
||||
field = self.__reg_form.add_field(type = "list-single", \
|
||||
label = "Action when state is 'Free For Chat'", \
|
||||
var = "ffc_action", \
|
||||
var = "chat_action", \
|
||||
value = str(mailconnection.RETRIEVE))
|
||||
field.add_option(label = "Do nothing", \
|
||||
value = str(mailconnection.DO_NOTHING))
|
||||
@@ -163,8 +163,19 @@ class MailComponent(Component):
|
||||
value = str(mailconnection.RETRIEVE))
|
||||
|
||||
field = self.__reg_form.add_field(type = "list-single", \
|
||||
label = "Action when state is 'Extended Away'", \
|
||||
var = "ea_action", \
|
||||
label = "Action when state is 'Not Available'", \
|
||||
var = "xa_action", \
|
||||
value = str(mailconnection.DIGEST))
|
||||
field.add_option(label = "Do nothing", \
|
||||
value = str(mailconnection.DO_NOTHING))
|
||||
field.add_option(label = "Send mail digest", \
|
||||
value = str(mailconnection.DIGEST))
|
||||
field.add_option(label = "Retrieve mail", \
|
||||
value = str(mailconnection.RETRIEVE))
|
||||
|
||||
field = self.__reg_form.add_field(type = "list-single", \
|
||||
label = "Action when state is 'Do not Disturb'", \
|
||||
var = "dnd_action", \
|
||||
value = str(mailconnection.DIGEST))
|
||||
field.add_option(label = "Do nothing", \
|
||||
value = str(mailconnection.DO_NOTHING))
|
||||
@@ -249,8 +260,8 @@ class MailComponent(Component):
|
||||
|
||||
field = self.__reg_form_init.add_field(type = "list-single", \
|
||||
label = "Action when state is 'Free For Chat'", \
|
||||
var = "ffc_action", \
|
||||
value = str(account.ffc_action))
|
||||
var = "chat_action", \
|
||||
value = str(account.chat_action))
|
||||
field.add_option(label = "Do nothing", \
|
||||
value = str(mailconnection.DO_NOTHING))
|
||||
field.add_option(label = "Send mail digest", \
|
||||
@@ -281,9 +292,20 @@ class MailComponent(Component):
|
||||
value = str(mailconnection.RETRIEVE))
|
||||
|
||||
field = self.__reg_form_init.add_field(type = "list-single", \
|
||||
label = "Action when state is 'Extended Away'", \
|
||||
var = "ea_action", \
|
||||
value = str(account.ea_action))
|
||||
label = "Action when state is 'Not Available'", \
|
||||
var = "xa_action", \
|
||||
value = str(account.xa_action))
|
||||
field.add_option(label = "Do nothing", \
|
||||
value = str(mailconnection.DO_NOTHING))
|
||||
field.add_option(label = "Send mail digest", \
|
||||
value = str(mailconnection.DIGEST))
|
||||
field.add_option(label = "Retrieve mail", \
|
||||
value = str(mailconnection.RETRIEVE))
|
||||
|
||||
field = self.__reg_form_init.add_field(type = "list-single", \
|
||||
label = "Action when state is 'Do not Disturb'", \
|
||||
var = "dnd_action", \
|
||||
value = str(account.dnd_action))
|
||||
field.add_option(label = "Do nothing", \
|
||||
value = str(mailconnection.DO_NOTHING))
|
||||
field.add_option(label = "Send mail digest", \
|
||||
@@ -312,10 +334,11 @@ class MailComponent(Component):
|
||||
self.__reg_form_init.fields["host"].value = account.host
|
||||
self.__reg_form_init.fields["port"].value = str(account.port)
|
||||
self.__reg_form_init.fields["type"].value = account.get_type()
|
||||
self.__reg_form_init.fields["ffc_action"].value = str(account.ffc_action)
|
||||
self.__reg_form_init.fields["chat_action"].value = str(account.chat_action)
|
||||
self.__reg_form_init.fields["online_action"].value = str(account.online_action)
|
||||
self.__reg_form_init.fields["away_action"].value = str(account.away_action)
|
||||
self.__reg_form_init.fields["ea_action"].value = str(account.ea_action)
|
||||
self.__reg_form_init.fields["xa_action"].value = str(account.xa_action)
|
||||
self.__reg_form_init.fields["dnd_action"].value = str(account.dnd_action)
|
||||
self.__reg_form_init.fields["offline_action"].value = str(account.offline_action)
|
||||
self.__reg_form_init.fields["interval"].value = str(account.interval)
|
||||
|
||||
@@ -549,10 +572,10 @@ class MailComponent(Component):
|
||||
else:
|
||||
port = None
|
||||
|
||||
if x.fields.has_key("ffc_action") and x.fields["ffc_action"].value != "":
|
||||
ffc_action = int(x.fields["ffc_action"].value)
|
||||
if x.fields.has_key("chat_action") and x.fields["chat_action"].value != "":
|
||||
chat_action = int(x.fields["chat_action"].value)
|
||||
else:
|
||||
ffc_action = mailconnection.DO_NOTHING
|
||||
chat_action = mailconnection.DO_NOTHING
|
||||
|
||||
if x.fields.has_key("online_action") and x.fields["online_action"].value != "":
|
||||
online_action = int(x.fields["online_action"].value)
|
||||
@@ -564,10 +587,15 @@ class MailComponent(Component):
|
||||
else:
|
||||
away_action = mailconnection.DO_NOTHING
|
||||
|
||||
if x.fields.has_key("ea_action") and x.fields["ea_action"].value != "":
|
||||
ea_action = int(x.fields["ea_action"].value)
|
||||
if x.fields.has_key("xa_action") and x.fields["xa_action"].value != "":
|
||||
xa_action = int(x.fields["xa_action"].value)
|
||||
else:
|
||||
ea_action = mailconnection.DO_NOTHING
|
||||
xa_action = mailconnection.DO_NOTHING
|
||||
|
||||
if x.fields.has_key("dnd_action") and x.fields["dnd_action"].value != "":
|
||||
dnd_action = int(x.fields["dnd_action"].value)
|
||||
else:
|
||||
dnd_action = mailconnection.DO_NOTHING
|
||||
|
||||
if x.fields.has_key("offline_action") and x.fields["offline_action"].value != "":
|
||||
offline_action = int(x.fields["offline_action"].value)
|
||||
@@ -579,10 +607,10 @@ class MailComponent(Component):
|
||||
else:
|
||||
interval = None
|
||||
|
||||
self.__logger.debug(u"New Account: %s, %s, %s, %s, %s, %s, %s %i %i %i %i %i %i" \
|
||||
self.__logger.debug(u"New Account: %s, %s, %s, %s, %s, %s, %s %i %i %i %i %i %i %i" \
|
||||
% (name, login, password, host, str(port), \
|
||||
mailbox, type, ffc_action, online_action, away_action, \
|
||||
ea_action, offline_action, interval))
|
||||
mailbox, type, chat_action, online_action, away_action, \
|
||||
xa_action, dnd_action, offline_action, interval))
|
||||
|
||||
iq = iq.make_result_response()
|
||||
self.stream.send(iq)
|
||||
@@ -621,10 +649,11 @@ class MailComponent(Component):
|
||||
account.login = login
|
||||
account.password = password
|
||||
account.host = host
|
||||
account.ffc_action = ffc_action
|
||||
account.chat_action = chat_action
|
||||
account.online_action = online_action
|
||||
account.away_action = away_action
|
||||
account.ea_action = ea_action
|
||||
account.xa_action = xa_action
|
||||
account.dnd_action = dnd_action
|
||||
account.offline_action = offline_action
|
||||
account.interval = interval
|
||||
|
||||
@@ -753,48 +782,6 @@ class MailComponent(Component):
|
||||
# self.stream.send(msg)
|
||||
return 1
|
||||
|
||||
# """ Store registered sessions """
|
||||
# def store_registered(self):
|
||||
# self.__logger.debug("STORE_REGISTERED")
|
||||
# try:
|
||||
# if not os.path.isdir(self.__spool_dir):
|
||||
# os.makedirs(self.__spool_dir)
|
||||
# str_registered = anydbm.open(self.__spool_dir + "/registered.db", \
|
||||
# 'n')
|
||||
# self.__logger.debug("Saving registered sessions")
|
||||
# for jid in self.__registered.keys():
|
||||
# for name in self.__registered[jid].keys():
|
||||
# self.__logger.debug("\t" + jid + ", _" + name + "_")
|
||||
# str_registered[jid + '#' + name] = \
|
||||
# str(self.__storage[(jid, name)])
|
||||
# str_registered.close()
|
||||
# except Exception, e:
|
||||
# print >>sys.stderr, "Cannot save to registered.db : "
|
||||
# print >>sys.stderr, e
|
||||
|
||||
# """ Load previously registered sessions """
|
||||
# def load_registered(self):
|
||||
# self.__logger.debug("LOAD_REGISTERED")
|
||||
# try:
|
||||
# if not os.path.isdir(self.__spool_dir):
|
||||
# os.makedirs(self.__spool_dir)
|
||||
# str_registered = anydbm.open(self.__spool_dir + "/registered.db", \
|
||||
# 'c')
|
||||
# self.__logger.debug("Loading previously registered sessions")
|
||||
# for key in str_registered.keys():
|
||||
# jid, name = key.split('#')
|
||||
# if not self.__registered.has_key(jid):
|
||||
# self.__registered[jid] = {}
|
||||
# self.__storage[(jid, name)] = \
|
||||
# mailconnection_factory.str_to_mail_connection(str_registered[key])
|
||||
# # self.__storage[(jid, name)].name = name
|
||||
# self.__logger.debug("Loaded data for %s on %s :" % (jid, name))
|
||||
# self.__logger.debug("\t %s" % (self.__storage[(jid, name)]))
|
||||
# str_registered.close()
|
||||
# except Exception, e:
|
||||
# print >>sys.stderr, "Cannot load registered.db : "
|
||||
# print >>sys.stderr, e
|
||||
|
||||
""" Check mail account """
|
||||
def check_mail(self, jid, name):
|
||||
self.__logger.debug("CHECK_MAIL")
|
||||
|
||||
@@ -151,10 +151,11 @@ class MailConnection(object):
|
||||
self.lastcheck = 0
|
||||
self.status = "offline"
|
||||
self.connection = None
|
||||
self.ffc_action = RETRIEVE
|
||||
self.chat_action = RETRIEVE
|
||||
self.online_action = RETRIEVE
|
||||
self.away_action = RETRIEVE
|
||||
self.ea_action = RETRIEVE
|
||||
self.xa_action = RETRIEVE
|
||||
self.dnd_action = RETRIEVE
|
||||
self.offline_action = DO_NOTHING
|
||||
self.interval = 5
|
||||
|
||||
@@ -165,18 +166,19 @@ class MailConnection(object):
|
||||
and self.host == other.host \
|
||||
and self.port == other.port \
|
||||
and self.ssl == other.ssl \
|
||||
and self.ffc_action == other.ffc_action \
|
||||
and self.chat_action == other.chat_action \
|
||||
and self.online_action == other.online_action \
|
||||
and self.away_action == other.away_action \
|
||||
and self.ea_action == other.ea_action \
|
||||
and self.xa_action == other.xa_action \
|
||||
and self.dnd_action == other.dnd_action \
|
||||
and self.offline_action == other.offline_action \
|
||||
and self.interval == other.interval
|
||||
|
||||
def __str__(self):
|
||||
return self.get_type() + "#" + self.login + "#" + self.password + "#" \
|
||||
+ self.host + "#" + str(self.port) + "#" + str(self.ffc_action) + "#" \
|
||||
+ self.host + "#" + str(self.port) + "#" + str(self.chat_action) + "#" \
|
||||
+ str(self.online_action) + "#" + str(self.away_action) + "#" + \
|
||||
str(self.ea_action) + "#" + str(self.offline_action)
|
||||
str(self.xa_action) + "#" + str(self.dnd_action) + "#" + str(self.offline_action)
|
||||
|
||||
def get_decoded_part(self, part):
|
||||
content_charset = part.get_content_charset()
|
||||
@@ -242,9 +244,10 @@ class MailConnection(object):
|
||||
|
||||
def get_action(self):
|
||||
mapping = {"online": self.online_action,
|
||||
"ffc": self.ffc_action,
|
||||
"chat": self.chat_action,
|
||||
"away": self.away_action,
|
||||
"ea": self.ea_action,
|
||||
"xa": self.xa_action,
|
||||
"dnd": self.dnd_action,
|
||||
"offline": self.offline_action}
|
||||
if mapping.has_key(self.status):
|
||||
return mapping[self.status]
|
||||
|
||||
@@ -62,10 +62,11 @@ def str_to_mail_connection(connection_string):
|
||||
password = arg_list.pop()
|
||||
host = arg_list.pop()
|
||||
port = int(arg_list.pop())
|
||||
ffc_action = int(arg_list.pop())
|
||||
chat_action = int(arg_list.pop())
|
||||
online_action = int(arg_list.pop())
|
||||
away_action = int(arg_list.pop())
|
||||
ea_action = int(arg_list.pop())
|
||||
xa_action = int(arg_list.pop())
|
||||
dnd_action = int(arg_list.pop())
|
||||
offline_action = int(arg_list.pop())
|
||||
result = None
|
||||
if type == "imap":
|
||||
@@ -98,10 +99,11 @@ def str_to_mail_connection(connection_string):
|
||||
ssl = True)
|
||||
if result is None:
|
||||
raise Exception, "Connection type \"" + type + "\" unknown"
|
||||
result.ffc_action = ffc_action
|
||||
result.chat_action = chat_action
|
||||
result.online_action = online_action
|
||||
result.away_action = away_action
|
||||
result.ea_action = ea_action
|
||||
result.xa_action = xa_action
|
||||
result.dnd_action = dnd_action
|
||||
result.offline_action = offline_action
|
||||
return result
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ if __name__ == '__main__':
|
||||
component2_suite, \
|
||||
storage_suite, \
|
||||
dbmstorage_suite))
|
||||
test_support.run_suite(storage_suite)
|
||||
test_support.run_suite(dbmstorage_suite)
|
||||
|
||||
# coverage.stop()
|
||||
# coverage.analysis(jabber.mailconnection_factory)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<config>
|
||||
<jabber>
|
||||
<server>127.0.0.1</server>
|
||||
<port>55555</port>
|
||||
<port>5347</port>
|
||||
<secret>secret</secret>
|
||||
<service>jmc.localhost</service>
|
||||
<connectsleep>5</connectsleep>
|
||||
|
||||
@@ -137,7 +137,7 @@ class MailComponent_TestCase_NoReg(unittest.TestCase):
|
||||
"<field type=\"text-single\" label=\"Mailbox (IMAP)\" var=\"mailbox\">" + \
|
||||
"<value>INBOX</value>" + \
|
||||
"</field>" + \
|
||||
"<field type=\"list-single\" label=\"Action when state is 'Free For Chat'\" var=\"ffc_action\">" + \
|
||||
"<field type=\"list-single\" label=\"Action when state is 'Free For Chat'\" var=\"chat_action\">" + \
|
||||
"<value>2</value>" + \
|
||||
"<option label=\"Do nothing\">" + \
|
||||
"<value>0</value>" + \
|
||||
@@ -173,7 +173,19 @@ class MailComponent_TestCase_NoReg(unittest.TestCase):
|
||||
"<value>2</value>" + \
|
||||
"</option>" + \
|
||||
"</field>" + \
|
||||
"<field type=\"list-single\" label=\"Action when state is 'Extended Away'\" var=\"ea_action\">" + \
|
||||
"<field type=\"list-single\" label=\"Action when state is 'Not Available'\" var=\"xa_action\">" + \
|
||||
"<value>1</value>" + \
|
||||
"<option label=\"Do nothing\">" + \
|
||||
"<value>0</value>" + \
|
||||
"</option>" + \
|
||||
"<option label=\"Send mail digest\">" + \
|
||||
"<value>1</value>" + \
|
||||
"</option>" + \
|
||||
"<option label=\"Retrieve mail\">" + \
|
||||
"<value>2</value>" + \
|
||||
"</option>" + \
|
||||
"</field>" + \
|
||||
"<field type=\"list-single\" label=\"Action when state is 'Do not Disturb'\" var=\"dnd_action\">" + \
|
||||
"<value>1</value>" + \
|
||||
"<option label=\"Do nothing\">" + \
|
||||
"<value>0</value>" + \
|
||||
@@ -252,7 +264,7 @@ class MailComponent_TestCase_NoReg(unittest.TestCase):
|
||||
"<field type='text-single' var='mailbox'>" + \
|
||||
"<value>INBOX</value>" + \
|
||||
"</field>" + \
|
||||
"<field type='list-single' var='ffc_action'>" + \
|
||||
"<field type='list-single' var='chat_action'>" + \
|
||||
"<value>2</value>" + \
|
||||
"</field>" + \
|
||||
"<field type='list-single' var='online_action'>" + \
|
||||
@@ -261,7 +273,10 @@ class MailComponent_TestCase_NoReg(unittest.TestCase):
|
||||
"<field type='list-single' var='away_action'>" + \
|
||||
"<value>1</value>" + \
|
||||
"</field>" + \
|
||||
"<field type='list-single' var='ea_action'>" + \
|
||||
"<field type='list-single' var='xa_action'>" + \
|
||||
"<value>1</value>" + \
|
||||
"</field>" + \
|
||||
"<field type='list-single' var='dnd_action'>" + \
|
||||
"<value>1</value>" + \
|
||||
"</field>" + \
|
||||
"<field type='list-single' var='offline_action'>" + \
|
||||
|
||||
@@ -42,56 +42,60 @@ class MailConnectionFactory_TestCase(unittest.TestCase):
|
||||
self.assertEquals(mc, mc)
|
||||
|
||||
def test_str_to_mail_connection_imap(self):
|
||||
mc = str_to_mail_connection("imap#login#passwd#host#193#0#0#0#1#2#INBOX")
|
||||
mc = str_to_mail_connection("imap#login#passwd#host#193#0#0#0#1#1#2#INBOX")
|
||||
self.assertEquals(mc.get_type(), "imap")
|
||||
self.assertEquals(mc.login, "login")
|
||||
self.assertEquals(mc.password, "passwd")
|
||||
self.assertEquals(mc.host, "host")
|
||||
self.assertEquals(mc.port, 193)
|
||||
self.assertEquals(mc.mailbox, "INBOX")
|
||||
self.assertEquals(mc.ffc_action, mailconnection.DO_NOTHING)
|
||||
self.assertEquals(mc.chat_action, mailconnection.DO_NOTHING)
|
||||
self.assertEquals(mc.online_action, mailconnection.DO_NOTHING)
|
||||
self.assertEquals(mc.away_action, mailconnection.DO_NOTHING)
|
||||
self.assertEquals(mc.ea_action, mailconnection.DIGEST)
|
||||
self.assertEquals(mc.xa_action, mailconnection.DIGEST)
|
||||
self.assertEquals(mc.dnd_action, mailconnection.DIGEST)
|
||||
self.assertEquals(mc.offline_action, mailconnection.RETRIEVE)
|
||||
|
||||
def test_str_to_mail_connection_imaps(self):
|
||||
mc = str_to_mail_connection("imaps#login#passwd#host#993#0#0#0#1#2#INBOX.SubDir")
|
||||
mc = str_to_mail_connection("imaps#login#passwd#host#993#0#0#0#1#1#2#INBOX.SubDir")
|
||||
self.assertEquals(mc.get_type(), "imaps")
|
||||
self.assertEquals(mc.login, "login")
|
||||
self.assertEquals(mc.password, "passwd")
|
||||
self.assertEquals(mc.host, "host")
|
||||
self.assertEquals(mc.port, 993)
|
||||
self.assertEquals(mc.mailbox, "INBOX.SubDir")
|
||||
self.assertEquals(mc.ffc_action, mailconnection.DO_NOTHING)
|
||||
self.assertEquals(mc.chat_action, mailconnection.DO_NOTHING)
|
||||
self.assertEquals(mc.online_action, mailconnection.DO_NOTHING)
|
||||
self.assertEquals(mc.away_action, mailconnection.DO_NOTHING)
|
||||
self.assertEquals(mc.ea_action, mailconnection.DIGEST)
|
||||
self.assertEquals(mc.xa_action, mailconnection.DIGEST)
|
||||
self.assertEquals(mc.dnd_action, mailconnection.DIGEST)
|
||||
self.assertEquals(mc.offline_action, mailconnection.RETRIEVE)
|
||||
|
||||
def test_str_to_mail_connection_pop3(self):
|
||||
mc = str_to_mail_connection("pop3#login#passwd#host#110#0#0#0#1#2")
|
||||
mc = str_to_mail_connection("pop3#login#passwd#host#110#0#0#0#1#1#2")
|
||||
self.assertEquals(mc.get_type(), "pop3")
|
||||
self.assertEquals(mc.login, "login")
|
||||
self.assertEquals(mc.password, "passwd")
|
||||
self.assertEquals(mc.host, "host")
|
||||
self.assertEquals(mc.port, 110)
|
||||
self.assertEquals(mc.ffc_action, mailconnection.DO_NOTHING)
|
||||
self.assertEquals(mc.chat_action, mailconnection.DO_NOTHING)
|
||||
self.assertEquals(mc.online_action, mailconnection.DO_NOTHING)
|
||||
self.assertEquals(mc.away_action, mailconnection.DO_NOTHING)
|
||||
self.assertEquals(mc.ea_action, mailconnection.DIGEST)
|
||||
self.assertEquals(mc.xa_action, mailconnection.DIGEST)
|
||||
self.assertEquals(mc.dnd_action, mailconnection.DIGEST)
|
||||
self.assertEquals(mc.offline_action, mailconnection.RETRIEVE)
|
||||
|
||||
def test_str_to_mail_connection_pop3s(self):
|
||||
mc = str_to_mail_connection("pop3s#login#passwd#host#995#0#0#0#1#2")
|
||||
mc = str_to_mail_connection("pop3s#login#passwd#host#995#0#0#0#1#1#2")
|
||||
self.assertEquals(mc.get_type(), "pop3s")
|
||||
self.assertEquals(mc.login, "login")
|
||||
self.assertEquals(mc.password, "passwd")
|
||||
self.assertEquals(mc.host, "host")
|
||||
self.assertEquals(mc.port, 995)
|
||||
self.assertEquals(mc.ffc_action, mailconnection.DO_NOTHING)
|
||||
self.assertEquals(mc.chat_action, mailconnection.DO_NOTHING)
|
||||
self.assertEquals(mc.online_action, mailconnection.DO_NOTHING)
|
||||
self.assertEquals(mc.away_action, mailconnection.DO_NOTHING)
|
||||
self.assertEquals(mc.ea_action, mailconnection.DIGEST)
|
||||
self.assertEquals(mc.xa_action, mailconnection.DIGEST)
|
||||
self.assertEquals(mc.dnd_action, mailconnection.DIGEST)
|
||||
self.assertEquals(mc.offline_action, mailconnection.RETRIEVE)
|
||||
|
||||
|
||||
@@ -52,10 +52,11 @@ class DBMStorage_TestCase(unittest.TestCase):
|
||||
port = 993,
|
||||
ssl = True,
|
||||
mailbox = "INBOX.box1")
|
||||
self._account1.ffc_action = mailconnection.DO_NOTHING
|
||||
self._account1.chat_action = mailconnection.DO_NOTHING
|
||||
self._account1.onlline_action = mailconnection.DO_NOTHING
|
||||
self._account1.away_action = mailconnection.DO_NOTHING
|
||||
self._account1.ea_action = mailconnection.DO_NOTHING
|
||||
self._account1.xa_action = mailconnection.DO_NOTHING
|
||||
self._account1.dnd_action = mailconnection.DO_NOTHING
|
||||
self._account1.offline_action = mailconnection.DO_NOTHING
|
||||
self._account2 = IMAPConnection(login = "login2",
|
||||
password = "password2",
|
||||
@@ -63,10 +64,11 @@ class DBMStorage_TestCase(unittest.TestCase):
|
||||
port = 1993,
|
||||
ssl = False,
|
||||
mailbox = "INBOX.box2")
|
||||
self._account2.ffc_action = mailconnection.DO_NOTHING
|
||||
self._account2.chat_action = mailconnection.DO_NOTHING
|
||||
self._account2.onlline_action = mailconnection.DO_NOTHING
|
||||
self._account2.away_action = mailconnection.DO_NOTHING
|
||||
self._account2.ea_action = mailconnection.DO_NOTHING
|
||||
self._account2.xa_action = mailconnection.DO_NOTHING
|
||||
self._account2.dnd_action = mailconnection.DO_NOTHING
|
||||
self._account2.offline_action = mailconnection.DO_NOTHING
|
||||
|
||||
def tearDown(self):
|
||||
|
||||
28
tests/tmp.py
28
tests/tmp.py
@@ -1,28 +0,0 @@
|
||||
import dummy_server
|
||||
|
||||
server = dummy_server.DummyServer(("localhost", 1143))
|
||||
server.responses = ["* OK [CAPABILITY IMAP4 LOGIN-REFERRALS " + \
|
||||
"AUTH=PLAIN]\r\n", \
|
||||
lambda data: "* CAPABILITY IMAP4 " + \
|
||||
"LOGIN-REFERRALS AUTH=PLAIN\r\n" + \
|
||||
data.split()[0] + \
|
||||
" OK CAPABILITY completed\r\n", \
|
||||
lambda data: data.split()[0] + \
|
||||
" OK LOGIN completed\r\n", \
|
||||
lambda data: "* 42 EXISTS\r\n* 1 RECENT\r\n* OK" +\
|
||||
" [UNSEEN 9]\r\n* FLAGS (\Deleted \Seen\*)\r\n*" +\
|
||||
" OK [PERMANENTFLAGS (\Deleted \Seen\*)\r\n" + \
|
||||
data.split()[0] + \
|
||||
" OK [READ-WRITE] SELECT completed\r\n", \
|
||||
lambda data: "* 1 FETCH ((RFC822) {12}\r\nbody text\r\n)\r\n" + \
|
||||
data.split()[0] + " OK FETCH completed\r\n", \
|
||||
lambda data: "* 1 FETCH (FLAGS (\UNSEEN))\r\n" + \
|
||||
data.split()[0] + " OK STORE completed\r\n"]
|
||||
server.queries = ["CAPABILITY", \
|
||||
"LOGIN login \"pass\"", \
|
||||
"SELECT INBOX", \
|
||||
"FETCH 1 (RFC822)", \
|
||||
"STORE 1 FLAGS (UNSEEN)", \
|
||||
"LOGOUT"]
|
||||
server.serve()
|
||||
#server.verify_queries()
|
||||
121
tests/tmp1
121
tests/tmp1
@@ -1,121 +0,0 @@
|
||||
<iq from="jmc.localhost" to="test@localhost/test" type="result" id="aad9a">
|
||||
<query xmlns="jabber:iq:register">
|
||||
<x xmlns="jabber:x:data">
|
||||
<title>
|
||||
Jabber Mail connection registration</title>
|
||||
<instructions>
|
||||
Enter anything below</instructions>
|
||||
<field type="text-single" label="Connection name" var="name"/>
|
||||
<field type="text-single" label="Login" var="login"/>
|
||||
<field type="text-private" label="Password" var="password"/>
|
||||
<field type="text-single" label="Host" var="host"/>
|
||||
<field type="text-single" label="Port" var="port"/>
|
||||
<field type="list-single" label="Mailbox type" var="type">
|
||||
<option label="POP3">
|
||||
<value>
|
||||
pop3</value>
|
||||
</option>
|
||||
<option label="POP3S">
|
||||
<value>
|
||||
pop3s</value>
|
||||
</option>
|
||||
<option label="IMAP">
|
||||
<value>
|
||||
imap</value>
|
||||
</option>
|
||||
<option label="IMAPS">
|
||||
<value>
|
||||
imaps</value>
|
||||
</option>
|
||||
</field>
|
||||
<field type="text-single" label="Mailbox (IMAP)" var="mailbox">
|
||||
<value>
|
||||
INBOX</value>
|
||||
</field>
|
||||
<field type="list-single" label="Action when state is 'Free For Chat'" var="ffc_action">
|
||||
<value>
|
||||
2</value>
|
||||
<option label="Do nothing">
|
||||
<value>
|
||||
0</value>
|
||||
</option>
|
||||
<option label="Send mail digest">
|
||||
<value>
|
||||
1</value>
|
||||
</option>
|
||||
<option label="Retrieve mail">
|
||||
<value>
|
||||
2</value>
|
||||
</option>
|
||||
</field>
|
||||
<field type="list-single" label="Action when state is 'Online'" var="online_action">
|
||||
<value>
|
||||
2</value>
|
||||
<option label="Do nothing">
|
||||
<value>
|
||||
0</value>
|
||||
</option>
|
||||
<option label="Send mail digest">
|
||||
<value>
|
||||
1</value>
|
||||
</option>
|
||||
<option label="Retrieve mail">
|
||||
<value>
|
||||
2</value>
|
||||
</option>
|
||||
</field>
|
||||
<field type="list-single" label="Action when state is 'Away'" var="away_action">
|
||||
<value>
|
||||
1</value>
|
||||
<option label="Do nothing">
|
||||
<value>
|
||||
0</value>
|
||||
</option>
|
||||
<option label="Send mail digest">
|
||||
<value>
|
||||
1</value>
|
||||
</option>
|
||||
<option label="Retrieve mail">
|
||||
<value>
|
||||
2</value>
|
||||
</option>
|
||||
</field>
|
||||
<field type="list-single" label="Action when state is 'Extended Away'" var="ea_action">
|
||||
<value>
|
||||
1</value>
|
||||
<option label="Do nothing">
|
||||
<value>
|
||||
0</value>
|
||||
</option>
|
||||
<option label="Send mail digest">
|
||||
<value>
|
||||
1</value>
|
||||
</option>
|
||||
<option label="Retrieve mail">
|
||||
<value>
|
||||
2</value>
|
||||
</option>
|
||||
</field>
|
||||
<field type="list-single" label="Action when state is 'Offline'" var="offline_action">
|
||||
<value>
|
||||
0</value>
|
||||
<option label="Do nothing">
|
||||
<value>
|
||||
0</value>
|
||||
</option>
|
||||
<option label="Send mail digest">
|
||||
<value>
|
||||
1</value>
|
||||
</option>
|
||||
<option label="Retrieve mail">
|
||||
<value>
|
||||
2</value>
|
||||
</option>
|
||||
</field>
|
||||
<field type="text-single" label="Mail check interval (in minutes)" var="interval">
|
||||
<value>
|
||||
5</value>
|
||||
</field>
|
||||
</x>
|
||||
</query>
|
||||
</iq>
|
||||
121
tests/tmp2
121
tests/tmp2
@@ -1,121 +0,0 @@
|
||||
<iq from="jmc.localhost" to="test@localhost/test" type="result" id="aad9a">
|
||||
<query xmlns="jabber:iq:register">
|
||||
<x xmlns="jabber:x:data">
|
||||
<title>
|
||||
Jabber Mail connection registration</title>
|
||||
<instructions>
|
||||
Enter anything below</instructions>
|
||||
<field type="text-single" label="Connection name" var="name"/>
|
||||
<field type="text-single" label="Login" var="login"/>
|
||||
<field type="text-private" label="Password" var="password"/>
|
||||
<field type="text-single" label="Host" var="host"/>
|
||||
<field type="text-single" label="Port" var="port"/>
|
||||
<field type="list-single" label="Mailbox type" var="type">
|
||||
<option label="POP3">
|
||||
<value>
|
||||
pop3</value>
|
||||
</option>
|
||||
<option label="POP3S">
|
||||
<value>
|
||||
pop3s</value>
|
||||
</option>
|
||||
<option label="IMAP">
|
||||
<value>
|
||||
imap</value>
|
||||
</option>
|
||||
<option label="IMAPS">
|
||||
<value>
|
||||
imaps</value>
|
||||
</option>
|
||||
</field>
|
||||
<field type="text-single" label="Mailbox (IMAP)" var="mailbox">
|
||||
<value>
|
||||
INBOX</value>
|
||||
</field>
|
||||
<field type="list-single" label="Action when state is 'Free For Chat'" var="ffc_action">
|
||||
<value>
|
||||
2</value>
|
||||
<option label="Do nothing">
|
||||
<value>
|
||||
0</value>
|
||||
</option>
|
||||
<option label="Send mail digest">
|
||||
<value>
|
||||
1</value>
|
||||
</option>
|
||||
<option label="Retrieve mail">
|
||||
<value>
|
||||
2</value>
|
||||
</option>
|
||||
</field>
|
||||
<field type="list-single" label="Action when state is 'Online'" var="online_action">
|
||||
<value>
|
||||
2</value>
|
||||
<option label="Do nothing">
|
||||
<value>
|
||||
0</value>
|
||||
</option>
|
||||
<option label="Send mail digest">
|
||||
<value>
|
||||
1</value>
|
||||
</option>
|
||||
<option label="Retrieve mail">
|
||||
<value>
|
||||
2</value>
|
||||
</option>
|
||||
</field>
|
||||
<field type="list-single" label="Action when state is 'Away'" var="away_action">
|
||||
<value>
|
||||
1</value>
|
||||
<option label="Do nothing">
|
||||
<value>
|
||||
0</value>
|
||||
</option>
|
||||
<option label="Send mail digest">
|
||||
<value>
|
||||
1</value>
|
||||
</option>
|
||||
<option label="Retrieve mail">
|
||||
<value>
|
||||
2</value>
|
||||
</option>
|
||||
</field>
|
||||
<field type="list-single" label="Action when state is 'Extended Away'" var="ea_action">
|
||||
<value>
|
||||
1</value>
|
||||
<option label="Do nothing">
|
||||
<value>
|
||||
0</value>
|
||||
</option>
|
||||
<option label="Send mail digest">
|
||||
<value>
|
||||
1</value>
|
||||
</option>
|
||||
<option label="Retrieve mail">
|
||||
<value>
|
||||
2</value>
|
||||
</option>
|
||||
</field>
|
||||
<field type="list-single" label="Action when state is 'Offline'" var="offline_action">
|
||||
<value>
|
||||
0</value>
|
||||
<option label="Do nothing">
|
||||
<value>
|
||||
0</value>
|
||||
</option>
|
||||
<option label="Send mail digest">
|
||||
<value>
|
||||
1</value>
|
||||
</option>
|
||||
<option label="Retrieve mail">
|
||||
<value>
|
||||
2</value>
|
||||
</option>
|
||||
</field>
|
||||
<field type="text-single" label="Mail check interval (in minutes)" var="interval">
|
||||
<value>
|
||||
5</value>
|
||||
</field>
|
||||
</x>
|
||||
</query>
|
||||
</iq>
|
||||
Reference in New Issue
Block a user