Fixing loopholes

This commit is contained in:
Firepup Sixfifty 2023-11-04 21:45:21 -05:00
parent 69d601042e
commit a45581bb0a

View file

@ -257,7 +257,7 @@ def op(name, chan):
def main(): def main():
try: try:
global ircmsg, channels, e, gmode, prefix, rebt, gblrebt, lrebt, lgblrebt, blanks global channels, e, gmode, prefix, rebt, gblrebt, lrebt, lgblrebt, blanks
log("Starting connection..", server) log("Starting connection..", server)
joinserver() joinserver()
if "pass" in servers[server]: if "pass" in servers[server]:
@ -266,19 +266,19 @@ def main():
for chan in channels: for chan in channels:
joinchan(chan, "null", channels, False) joinchan(chan, "null", channels, False)
while 1: while 1:
global ircmsg, gmode global gmode
raw = recv() raw = recv()
ircmsg = raw.decode() ircmsg = raw.decode()
if ircmsg == "": if ircmsg == "":
exit("Probably a netsplit") exit("Probably a netsplit")
else: else:
print(raw.lazy_decode(), sep="\n") print(raw.lazy_decode(), sep="\n")
if ircmsg.find("PRIVMSG") != -1: action = "Unknown"
try: try:
ircmsg.split("PRIVMSG", 1)[1] action = ircmsg.split(" ", 2)[1].strip()
except IndexError: except IndexError:
log("Fake message recieved", server, "WARN") pass
continue if action == "PRIVMSG":
# Format of ":[Nick]![ident]@[host|vhost] PRIVMSG [channel] :[message]” # Format of ":[Nick]![ident]@[host|vhost] PRIVMSG [channel] :[message]”
name = ircmsg.split("!", 1)[0][1:] name = ircmsg.split("!", 1)[0][1:]
helpErr = False helpErr = False