Add the time field to some notifications

master
Mark Veidemanis 4 years ago
parent 913009ab71
commit 7d9a45ee91

@ -135,7 +135,7 @@ class IRCBot(IRCClient):
relay = main.network[self.net].relays[num]
self.nickname = alias["nick"]
self.realname = alias["realname"]
self.username = alias["nick"]+"/"+relay["net"]
self.username = alias["nick"].lower()+"/"+relay["net"]
self.password = main.config["Relay"]["Password"]
self.userinfo = None #
self.fingerReply = None #
@ -335,8 +335,8 @@ class IRCBot(IRCClient):
self.setNick(self._attemptedNick)
def irc_ERR_PASSWDMISMATCH(self, prefix, params):
log("%s - %i: password mismatch" % (self.net, self.num))
sendAll("%s - %i: password mismatch" % (self.net, self.num))
log("%s - %i: password mismatch as %s" % (self.net, self.num, self.username))
sendAll("%s - %i: password mismatch as %s" % (self.net, self.num, self.username))
def _who(self, channel):
d = Deferred()
@ -618,7 +618,12 @@ class IRCBot(IRCClient):
def signedOn(self):
log("signed on: %s - %i" % (self.net, self.num))
sendRelayNotification({"type": "conn", "net": self.net, "num": self.num, "status": "signedon"})
ctime = str(datetime.now().isoformat())
sendRelayNotification({"type": "conn", "net": self.net, "num": self.num, "status": "signedon", "time": ctime})
if not self.authenticated:
inst = regproc.selectInst(self.net)
if inst["ping"] and inst["check"]:
self.msg(inst["entity"], inst["pingmsg"])
def joined(self, channel):
if not channel in self.channels:
@ -661,6 +666,7 @@ class IRCBot(IRCClient):
self.event(type="kick", muser=kicker, channel=channel, msg=message, user=kickee)
def chanlessEvent(self, cast):
cast["time"] = str(datetime.now().isoformat())
cast["nick"], cast["ident"], cast["host"] = parsen(cast["muser"])
if dedup(self.name, cast): # Needs to be kept self.name until the dedup
# function is converted to the new net, num
@ -731,7 +737,8 @@ class IRCBotFactory(ReconnectingClientFactory):
if not self.relay:
log("%s - %i: connection lost: %s" % (self.net, self.num, error))
sendAll("%s - %i: connection lost: %s" % (self.net, self.num, error))
sendRelayNotification({"type": "conn", "net": self.net, "num": self.num, "status": "lost", "message": error})
ctime = str(datetime.now().isoformat())
sendRelayNotification({"type": "conn", "net": self.net, "num": self.num, "status": "lost", "message": error, "time": ctime})
self.retry(connector)
#ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
@ -744,7 +751,8 @@ class IRCBotFactory(ReconnectingClientFactory):
log("%s - %i: connection failed: %s" % (self.net, self.num, error))
if not self.relay:
sendAll("%s - %s: connection failed: %s" % (self.net, self.num, error))
sendRelayNotification({"type": "conn", "net": self.net, "num": self.num, "status": "failed", "message": error})
ctime = str(datetime.now().isoformat())
sendRelayNotification({"type": "conn", "net": self.net, "num": self.num, "status": "failed", "message": error, "time": ctime})
self.retry(connector)
#ReconnectingClientFactory.clientConnectionFailed(self, connector, reason)

@ -19,8 +19,8 @@ def parsemeta(numName, c):
# in which case, do not do this
if c["type"] in ["msg", "notice", "action", "topic", "mode"]:
userinfo.editUser(c["net"], c["muser"])
if c["type"] == "mode":
userinfo.updateMode(c)
#if c["type"] == "mode":
# userinfo.updateMode(c)
elif c["type"] == "nick":
userinfo.renameUser(c["net"], c["nick"], c["muser"], c["user"], c["user"]+"!"+c["ident"]+"@"+c["host"])
elif c["type"] == "kick":

Loading…
Cancel
Save