Do not make WHOIS, PRIVMSG, etc caps sensitive
This commit is contained in:
parent
fbd340a097
commit
bde7b78f88
1 changed files with 9 additions and 4 deletions
13
server.py
13
server.py
|
@ -28,10 +28,9 @@ tcp_socket.bind(server_address)
|
||||||
tcp_socket.listen(1)
|
tcp_socket.listen(1)
|
||||||
reserved = ["nickserv", "chanserv", "gitserv"] # Reserved nicknames
|
reserved = ["nickserv", "chanserv", "gitserv"] # Reserved nicknames
|
||||||
nickname_list = {} # Stores nicknames and the respective sockets
|
nickname_list = {} # Stores nicknames and the respective sockets
|
||||||
lower_nicks = {} # Nicknames in lowercase
|
lower_nicks = {"gitserv": "GitServ"} # Nicknames in lowercase
|
||||||
channels_list = {} # Store channels and their user lists
|
channels_list = {} # Store channels and their user lists
|
||||||
flags_list = {} # Stores flags for channels and users
|
property_list = {"GitServ": {"host": "IRCatCore", "username": "IRCat", "realname": "Codename IRCat Integrated services - Updates bot"}} # Stores properties for active users and channels
|
||||||
property_list = {} # Stores properties (hostname) for users
|
|
||||||
print("Now listening on port 6667")
|
print("Now listening on port 6667")
|
||||||
def pinger(nick, connection):
|
def pinger(nick, connection):
|
||||||
while nick in property_list:
|
while nick in property_list:
|
||||||
|
@ -184,11 +183,13 @@ def session(connection, client):
|
||||||
connection.sendall(bytes(f":{server} {pending} 461 {command} :Not enough parameters\r\n","UTF-8"))
|
connection.sendall(bytes(f":{server} {pending} 461 {command} :Not enough parameters\r\n","UTF-8"))
|
||||||
else:
|
else:
|
||||||
target = text.split(" ")[1]
|
target = text.split(" ")[1]
|
||||||
|
if target.lower() in lower_nicks:
|
||||||
|
target = lower_nicks[target.lower()]
|
||||||
if target in property_list:
|
if target in property_list:
|
||||||
who_user = property_list[target]["username"]
|
who_user = property_list[target]["username"]
|
||||||
who_realname = property_list[target]["realname"]
|
who_realname = property_list[target]["realname"]
|
||||||
who_host = property_list[target]["host"]
|
who_host = property_list[target]["host"]
|
||||||
connection.sendall(bytes(f":{server} 311 {pending} {target} {who_user} {who_host} * :{who_realname}\r\n","UTF-8"))
|
connection.sendall(bytes(f":{server} 311 {pending} {target} ~{who_user} {who_host} * :{who_realname}\r\n","UTF-8"))
|
||||||
connection.sendall(bytes(f":{server} 312 {pending} {target} {server} :{identifier}\r\n","UTF-8"))
|
connection.sendall(bytes(f":{server} 312 {pending} {target} {server} :{identifier}\r\n","UTF-8"))
|
||||||
#connection.sendall(bytes(f":{server} 313 {target} :is an IRC operator\r\n","UTF-8")) # I haven't implemented modes yet.
|
#connection.sendall(bytes(f":{server} 313 {target} :is an IRC operator\r\n","UTF-8")) # I haven't implemented modes yet.
|
||||||
#connection.sendall(bytes(f":{server} 317 {target} {time} :seconds idle\r\n","UTF-8")) # I haven't implemented idle time yet.
|
#connection.sendall(bytes(f":{server} 317 {target} {time} :seconds idle\r\n","UTF-8")) # I haven't implemented idle time yet.
|
||||||
|
@ -208,6 +209,8 @@ def session(connection, client):
|
||||||
elif command == "PRIVMSG":
|
elif command == "PRIVMSG":
|
||||||
if len(args) >= 2:
|
if len(args) >= 2:
|
||||||
target = text.split(" ")[1]
|
target = text.split(" ")[1]
|
||||||
|
if target.lower() in lower_nicks:
|
||||||
|
target = lower_nicks[target.lower()]
|
||||||
if target in channels_list:
|
if target in channels_list:
|
||||||
if pending in channels_list[target]:
|
if pending in channels_list[target]:
|
||||||
for i in channels_list[channel]:
|
for i in channels_list[channel]:
|
||||||
|
@ -225,6 +228,8 @@ def session(connection, client):
|
||||||
elif command == "NOTICE":
|
elif command == "NOTICE":
|
||||||
if len(args) >= 2:
|
if len(args) >= 2:
|
||||||
target = text.split(" ")[1]
|
target = text.split(" ")[1]
|
||||||
|
if target.lower() in lower_nicks:
|
||||||
|
target = lower_nicks[target.lower()]
|
||||||
if target in channels_list:
|
if target in channels_list:
|
||||||
if pending in channels_list[target]:
|
if pending in channels_list[target]:
|
||||||
for i in channels_list[channel]:
|
for i in channels_list[channel]:
|
||||||
|
|
Loading…
Reference in a new issue