Use net and num instead of name in relay output
This commit is contained in:
parent
78e4d6bd66
commit
5eda50af13
42
core/bot.py
42
core/bot.py
|
@ -145,7 +145,7 @@ class IRCBot(IRCClient):
|
|||
if "msg" in cast.keys():
|
||||
if cast["ident"] == "znc" and cast["host"] == "znc.in":
|
||||
cast["type"] = "znc"
|
||||
cast["name"] = self.name
|
||||
cast["num"] = self.num
|
||||
del cast["nick"]
|
||||
del cast["ident"]
|
||||
del cast["host"]
|
||||
|
@ -156,7 +156,7 @@ class IRCBot(IRCClient):
|
|||
#castDup = deepcopy(cast) # however modes are not queries!
|
||||
cast["mtype"] = cast["type"]
|
||||
cast["type"] = "query"
|
||||
cast["name"] = self.name
|
||||
cast["num"] = self.num
|
||||
#self.event(**castDup)
|
||||
# Don't call self.event for this one because queries are not events on a
|
||||
# channel, but we still want to see them
|
||||
|
@ -165,14 +165,14 @@ class IRCBot(IRCClient):
|
|||
castDup = deepcopy(cast)
|
||||
castDup["mtype"] = cast["type"]
|
||||
castDup["type"] = "self"
|
||||
castDup["name"] = self.name
|
||||
cast["num"] = self.num
|
||||
self.event(**castDup)
|
||||
if "nick" in cast.keys():
|
||||
if cast["nick"].lower() == self.nickname.lower():
|
||||
castDup = deepcopy(cast)
|
||||
castDup["mtype"] = cast["type"]
|
||||
castDup["type"] = "self"
|
||||
castDup["name"] = self.name
|
||||
cast["num"] = self.num
|
||||
if not cast["channel"].lower() == self.nickname.lower(): # modes has been set on us directly
|
||||
self.event(**castDup) # don't tell anyone else
|
||||
if "msg" in cast.keys() and not cast["type"] == "query": # Don't highlight queries
|
||||
|
@ -181,13 +181,13 @@ class IRCBot(IRCClient):
|
|||
castDup = deepcopy(cast)
|
||||
castDup["mtype"] = cast["type"]
|
||||
castDup["type"] = "highlight"
|
||||
castDup["name"] = self.name
|
||||
cast["num"] = self.num
|
||||
self.event(**castDup)
|
||||
|
||||
if not "name" in cast.keys():
|
||||
cast["name"] = self.net
|
||||
if not "net" in cast.keys():
|
||||
cast["net"] = self.net
|
||||
counters.event(self.net, cast["type"])
|
||||
monitor.event(self.name, cast)
|
||||
monitor.event(self.net, cast)
|
||||
|
||||
def privmsg(self, user, channel, msg):
|
||||
self.event(type="msg", muser=user, channel=channel, msg=msg)
|
||||
|
@ -225,8 +225,8 @@ class IRCBot(IRCClient):
|
|||
def irc_ERR_PASSWDMISMATCH(self, prefix, params):
|
||||
print(locals())
|
||||
print(globals())
|
||||
log("%s: password mismatch" % self.name)
|
||||
sendAll("%s: password mismatch" % self.name)
|
||||
log("%s - %i: password mismatch" % (self.net, self.num))
|
||||
sendAll("%s - %i: password mismatch" % (self.net, self.num))
|
||||
|
||||
def _who(self, channel):
|
||||
d = Deferred()
|
||||
|
@ -378,9 +378,9 @@ class IRCBot(IRCClient):
|
|||
|
||||
def signedOn(self):
|
||||
self.connected = True
|
||||
log("signed on: %s" % self.name)
|
||||
log("signed on: %s - %i" % (self.net, self.num))
|
||||
#self.event(type="conn", status="connected")
|
||||
sendRelayNotification({"type": "conn", "name": self.name, "status": "signedon"})
|
||||
sendRelayNotification({"type": "conn", "net": self.net, "num": self.num, "status": "signedon"})
|
||||
|
||||
def joined(self, channel):
|
||||
if not channel in self.channels:
|
||||
|
@ -426,7 +426,9 @@ class IRCBot(IRCClient):
|
|||
|
||||
def chanlessEvent(self, cast):
|
||||
cast["nick"], cast["ident"], cast["host"] = self.parsen(cast["muser"])
|
||||
if dedup(self.name, cast):
|
||||
if dedup(self.name, cast): # Needs to be kept self.name until the dedup
|
||||
# function is converted to the new net, num
|
||||
# format
|
||||
return # stop right there sir!
|
||||
chans = userinfo.getChanList(self.net, cast["nick"])
|
||||
if chans == None:
|
||||
|
@ -456,7 +458,7 @@ class IRCBotFactory(ReconnectingClientFactory):
|
|||
def __init__(self, net, num=None, relayCommands=None, user=None, stage2=None):
|
||||
if net == None:
|
||||
self.num = num
|
||||
self.name = "Relay to %i" % num
|
||||
self.name = "relay - %i" % num
|
||||
self.relay = True
|
||||
else:
|
||||
self.name = net+str(num)
|
||||
|
@ -488,10 +490,10 @@ class IRCBotFactory(ReconnectingClientFactory):
|
|||
self.client.connected = False
|
||||
self.client.channels = []
|
||||
error = reason.getErrorMessage()
|
||||
log("%s: connection lost: %s" % (self.name, error))
|
||||
log("%s - %i: connection lost: %s" % (self.net, self.num, error))
|
||||
if not self.relay:
|
||||
sendAll("%s: connection lost: %s" % (self.name, error))
|
||||
sendRelayNotification({"type": "conn", "name": self.name, "status": "lost", "message": 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})
|
||||
self.retry(connector)
|
||||
#ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
|
||||
|
||||
|
@ -500,10 +502,10 @@ class IRCBotFactory(ReconnectingClientFactory):
|
|||
self.client.connected = False
|
||||
self.client.channels = []
|
||||
error = reason.getErrorMessage()
|
||||
log("%s: connection failed: %s" % (self.name, error))
|
||||
log("%s - %i: connection failed: %s" % (self.net, self.num, error))
|
||||
if not self.relay:
|
||||
sendAll("%s: connection failed: %s" % (self.name, error))
|
||||
sendRelayNotification({"type": "conn", "name": self.name, "status": "failed", "message": 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})
|
||||
self.retry(connector)
|
||||
#ReconnectingClientFactory.clientConnectionFailed(self, connector, reason)
|
||||
|
||||
|
|
Loading…
Reference in New Issue