Switch resume.py to use the last server-time
it saw, not last .recv()
This commit is contained in:
parent
240faa03fb
commit
768059fcf4
2 changed files with 6 additions and 7 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
#--depends-on server_time
|
||||||
|
|
||||||
from src import ModuleManager, utils
|
from src import ModuleManager, utils
|
||||||
|
|
||||||
CAP = utils.irc.Capability(None, "draft/resume-0.4")
|
CAP = utils.irc.Capability(None, "draft/resume-0.4")
|
||||||
|
@ -12,13 +14,13 @@ class Module(ModuleManager.BaseModule):
|
||||||
def _del_token(self, server, new=False):
|
def _del_token(self, server, new=False):
|
||||||
server.del_setting(self._setting(new))
|
server.del_setting(self._setting(new))
|
||||||
|
|
||||||
def _get_timestamp(self, server):
|
|
||||||
return server.get_setting("last-read", None)
|
|
||||||
|
|
||||||
@utils.hook("new.server")
|
@utils.hook("new.server")
|
||||||
def new_server(self, event):
|
def new_server(self, event):
|
||||||
resume_timestamp = self._get_timestamp(event["server"])
|
# we need to pull this before any data has been exchanged - to make sure
|
||||||
event["server"]._resume_timestamp = resume_timestamp
|
# it's not overwritten from the last connection
|
||||||
|
event["server"]._resume_timestamp = event["server"].get_setting(
|
||||||
|
"last-server-time", None)
|
||||||
|
|
||||||
@utils.hook("received.cap.ls")
|
@utils.hook("received.cap.ls")
|
||||||
def on_cap_ls(self, event):
|
def on_cap_ls(self, event):
|
||||||
|
|
|
@ -239,9 +239,6 @@ class Server(IRCObject.Object):
|
||||||
if lines:
|
if lines:
|
||||||
self.ping_sent = False
|
self.ping_sent = False
|
||||||
|
|
||||||
now = datetime.datetime.utcnow()
|
|
||||||
self.set_setting("last-read",
|
|
||||||
utils.iso8601_format(now, milliseconds=True))
|
|
||||||
return lines
|
return lines
|
||||||
|
|
||||||
def send(self, line_parsed: IRCLine.ParsedLine):
|
def send(self, line_parsed: IRCLine.ParsedLine):
|
||||||
|
|
Loading…
Reference in a new issue