Add the time field to some notifications
This commit is contained in:
parent
913009ab71
commit
7d9a45ee91
20
core/bot.py
20
core/bot.py
|
@ -135,7 +135,7 @@ class IRCBot(IRCClient):
|
||||||
relay = main.network[self.net].relays[num]
|
relay = main.network[self.net].relays[num]
|
||||||
self.nickname = alias["nick"]
|
self.nickname = alias["nick"]
|
||||||
self.realname = alias["realname"]
|
self.realname = alias["realname"]
|
||||||
self.username = alias["nick"]+"/"+relay["net"]
|
self.username = alias["nick"].lower()+"/"+relay["net"]
|
||||||
self.password = main.config["Relay"]["Password"]
|
self.password = main.config["Relay"]["Password"]
|
||||||
self.userinfo = None #
|
self.userinfo = None #
|
||||||
self.fingerReply = None #
|
self.fingerReply = None #
|
||||||
|
@ -335,8 +335,8 @@ class IRCBot(IRCClient):
|
||||||
self.setNick(self._attemptedNick)
|
self.setNick(self._attemptedNick)
|
||||||
|
|
||||||
def irc_ERR_PASSWDMISMATCH(self, prefix, params):
|
def irc_ERR_PASSWDMISMATCH(self, prefix, params):
|
||||||
log("%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" % (self.net, self.num))
|
sendAll("%s - %i: password mismatch as %s" % (self.net, self.num, self.username))
|
||||||
|
|
||||||
def _who(self, channel):
|
def _who(self, channel):
|
||||||
d = Deferred()
|
d = Deferred()
|
||||||
|
@ -618,7 +618,12 @@ class IRCBot(IRCClient):
|
||||||
|
|
||||||
def signedOn(self):
|
def signedOn(self):
|
||||||
log("signed on: %s - %i" % (self.net, self.num))
|
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):
|
def joined(self, channel):
|
||||||
if not channel in self.channels:
|
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)
|
self.event(type="kick", muser=kicker, channel=channel, msg=message, user=kickee)
|
||||||
|
|
||||||
def chanlessEvent(self, cast):
|
def chanlessEvent(self, cast):
|
||||||
|
cast["time"] = str(datetime.now().isoformat())
|
||||||
cast["nick"], cast["ident"], cast["host"] = parsen(cast["muser"])
|
cast["nick"], cast["ident"], cast["host"] = parsen(cast["muser"])
|
||||||
if dedup(self.name, cast): # Needs to be kept self.name until the dedup
|
if dedup(self.name, cast): # Needs to be kept self.name until the dedup
|
||||||
# function is converted to the new net, num
|
# function is converted to the new net, num
|
||||||
|
@ -731,7 +737,8 @@ class IRCBotFactory(ReconnectingClientFactory):
|
||||||
if not self.relay:
|
if not self.relay:
|
||||||
log("%s - %i: connection lost: %s" % (self.net, self.num, error))
|
log("%s - %i: connection lost: %s" % (self.net, self.num, error))
|
||||||
sendAll("%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)
|
self.retry(connector)
|
||||||
#ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
|
#ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
|
||||||
|
|
||||||
|
@ -744,7 +751,8 @@ class IRCBotFactory(ReconnectingClientFactory):
|
||||||
log("%s - %i: connection failed: %s" % (self.net, self.num, error))
|
log("%s - %i: connection failed: %s" % (self.net, self.num, error))
|
||||||
if not self.relay:
|
if not self.relay:
|
||||||
sendAll("%s - %s: connection failed: %s" % (self.net, self.num, error))
|
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)
|
self.retry(connector)
|
||||||
#ReconnectingClientFactory.clientConnectionFailed(self, connector, reason)
|
#ReconnectingClientFactory.clientConnectionFailed(self, connector, reason)
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,8 @@ def parsemeta(numName, c):
|
||||||
# in which case, do not do this
|
# in which case, do not do this
|
||||||
if c["type"] in ["msg", "notice", "action", "topic", "mode"]:
|
if c["type"] in ["msg", "notice", "action", "topic", "mode"]:
|
||||||
userinfo.editUser(c["net"], c["muser"])
|
userinfo.editUser(c["net"], c["muser"])
|
||||||
if c["type"] == "mode":
|
#if c["type"] == "mode":
|
||||||
userinfo.updateMode(c)
|
# userinfo.updateMode(c)
|
||||||
elif c["type"] == "nick":
|
elif c["type"] == "nick":
|
||||||
userinfo.renameUser(c["net"], c["nick"], c["muser"], c["user"], c["user"]+"!"+c["ident"]+"@"+c["host"])
|
userinfo.renameUser(c["net"], c["nick"], c["muser"], c["user"], c["user"]+"!"+c["ident"]+"@"+c["host"])
|
||||||
elif c["type"] == "kick":
|
elif c["type"] == "kick":
|
||||||
|
|
Loading…
Reference in New Issue