6
class Session(e3.Session):
7
'''a specialization of e3.Session'''
9
DESCRIPTION = 'Session to test the client (no connection)'
10
AUTHOR = 'Mariano Guerra'
11
WEBSITE = 'www.emesene.org'
15
"host": "dummy.server.com",
20
CAPABILITIES = [e3.Session.SERVICE_CONTACT_INVITE,
21
e3.Session.SERVICE_PROFILE_PICTURE,
22
e3.Session.SERVICE_STATUS,
23
e3.Session.SERVICE_CONTACT_NICK,
24
e3.Session.SERVICE_CONTACT_PM,
25
e3.Session.SERVICE_ENDPOINTS]
27
def __init__(self, id_=None, account=None):
29
e3.Session.__init__(self, id_, account)
31
def login(self, account, password, status, proxy, host, port,
32
use_http=False, use_ipv6=False):
33
'''start the login process'''
34
self.account = e3.Account(account, password, status, host)
35
worker = Worker.Worker(self, proxy, use_http, use_ipv6)
38
self.add_action(e3.Action.ACTION_LOGIN, (account, password, status))
40
def send_message(self, cid, text, style=None, cedict=None, celist=None):
41
'''send a common message'''
48
account = self.account.account
49
message = e3.Message(e3.Message.TYPE_MESSAGE, text, account,
51
self.add_action(e3.Action.ACTION_SEND_MESSAGE, (cid, message))
53
def send_typing_notification(self, cid):
54
'''send typing notification to contact'''
57
def request_attention(self, cid):
58
'''request the attention of the contact'''
59
account = self.account.account
60
message = e3.Message(e3.Message.TYPE_NUDGE,
61
'%s requests your attention' % (account, ), account)
62
self.add_action(e3.Action.ACTION_SEND_MESSAGE, (cid, message))
64
extension.implements(Session, 'session')