Update server.py
This commit is contained in:
parent
b9859c7fa2
commit
158ebd7ffe
1 changed files with 11 additions and 0 deletions
11
server.py
11
server.py
|
@ -62,6 +62,7 @@ with open(sys.argv[1], 'r') as file:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
file.close()
|
file.close()
|
||||||
print("Successfully loaded config!")
|
print("Successfully loaded config!")
|
||||||
|
=
|
||||||
for mod in modules:
|
for mod in modules:
|
||||||
i = mod
|
i = mod
|
||||||
if not os.path.isabs(i):
|
if not os.path.isabs(i):
|
||||||
|
@ -87,6 +88,8 @@ for mod in modules:
|
||||||
print(f"Module {i} failed to load.")
|
print(f"Module {i} failed to load.")
|
||||||
print(traceback.format_exc())
|
print(traceback.format_exc())
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
global topic_list
|
||||||
|
topic_list = {}
|
||||||
if mods["sql_provider"] == None:
|
if mods["sql_provider"] == None:
|
||||||
print("IRCat needs an SQL provider.")
|
print("IRCat needs an SQL provider.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
@ -102,6 +105,8 @@ for i in mods['allsocket']:
|
||||||
requires[j.replace("-", "_")] = data[j]
|
requires[j.replace("-", "_")] = data[j]
|
||||||
if "sql" in i.__ircat_giveme__:
|
if "sql" in i.__ircat_giveme__:
|
||||||
requires["sql"] = config
|
requires["sql"] = config
|
||||||
|
if __ircat_fakechannels__ in i:
|
||||||
|
topic_list = topic_list | i.__ircat_fakechannels__
|
||||||
socketListeners.append(i.IRCatModule(**requires))
|
socketListeners.append(i.IRCatModule(**requires))
|
||||||
commandProviders = []
|
commandProviders = []
|
||||||
for i in mods['command']:
|
for i in mods['command']:
|
||||||
|
@ -256,6 +261,12 @@ def session(connection, client, ip, ssl=False):
|
||||||
e = text.split(" ")[1]
|
e = text.split(" ")[1]
|
||||||
print("Replying with \"" + str([f":{server} PONG {server} :{e}\r\n"]) + "\"")
|
print("Replying with \"" + str([f":{server} PONG {server} :{e}\r\n"]) + "\"")
|
||||||
connection.sendall(bytes(f":{server} PONG {server} :{e}\r\n","UTF-8"))
|
connection.sendall(bytes(f":{server} PONG {server} :{e}\r\n","UTF-8"))
|
||||||
|
elif command == "LIST":
|
||||||
|
connection.sendall(bytes(f":{server} 321 {pending} Channel :Users Name","UTF-8"))
|
||||||
|
for key, value in topic_list.items():
|
||||||
|
usersin = len(channels_list[key])
|
||||||
|
connection.sendall(bytes(f":{server} 322 {pending} {key} {usersin} :{value}","UTF-8"))
|
||||||
|
connection.sendall(bytes(f":{server} 323 {pending} :End of /LIST","UTF-8"))
|
||||||
elif command == "MOTD":
|
elif command == "MOTD":
|
||||||
if motd_file != None:
|
if motd_file != None:
|
||||||
motd = open(motd_file).read()
|
motd = open(motd_file).read()
|
||||||
|
|
Loading…
Add table
Reference in a new issue