Commit cd572d75 authored by valtron's avatar valtron

boot other sessions when user logs in to MSNP < 18 (closes #16)

parent 9f77396f
......@@ -288,6 +288,16 @@ class Backend:
del contacts[ctc_head.uuid]
self._mark_modified(user, detail = detail)
def me_pop_boot_others(self, sess):
for sess_other in self._sc.get_sessions_by_user(sess.user):
if sess is sess_other: continue
sess_other.send_event(event.POPBootEvent())
def me_pop_notify_others(self, sess):
for sess_other in self._sc.get_sessions_by_user(sess.user):
if sess is sess_other: continue
sess_other.send_event(event.POPNotifyEvent())
def login_xfr(self, sess, email, token):
(user, extra_data) = self._load_user('sb/xfr', token)
if user is None: return None
......
......@@ -30,5 +30,13 @@ class ReplyEvent:
def __init__(self, data):
self.data = data
class POPBootEvent:
def __init__(self):
pass
class POPNotifyEvent:
def __init__(self):
pass
class CloseEvent:
pass
......@@ -115,6 +115,11 @@ def _util_usr_final(sess, trid, token):
if token:
sess.state.backend.util_set_sess_token(sess, token)
if dialect < 18:
sess.state.backend.me_pop_boot_others(sess)
else:
sess.state.backend.me_pop_notify_others(sess)
if dialect < 10:
args = (user.status.name,)
else:
......
......@@ -67,6 +67,12 @@ class MSNPWriter:
data = outgoing_event.data
self._write(['MSG', user.email, user.status.name, data])
return
if isinstance(outgoing_event, event.POPBootEvent):
self._write(['OUT', 'OTH'])
return
if isinstance(outgoing_event, event.POPNotifyEvent):
# TODO: What do?
return
if isinstance(outgoing_event, event.CloseEvent):
self._write(['OUT'])
return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment