Update server.py
This commit is contained in:
parent
d9dbc242ef
commit
495659069a
1 changed files with 3 additions and 1 deletions
|
@ -35,6 +35,7 @@ def session(connection, client):
|
||||||
finished = False # If the server gave the client its information, indicating it's ready.
|
finished = False # If the server gave the client its information, indicating it's ready.
|
||||||
username = "oreo"
|
username = "oreo"
|
||||||
hostname = ""
|
hostname = ""
|
||||||
|
realname = "realname"
|
||||||
try:
|
try:
|
||||||
print("Connected to client IP: {}".format(client))
|
print("Connected to client IP: {}".format(client))
|
||||||
connection.sendall(bytes(f":{server} NOTICE * :*** Looking for your hostname...\r\n","UTF-8"))
|
connection.sendall(bytes(f":{server} NOTICE * :*** Looking for your hostname...\r\n","UTF-8"))
|
||||||
|
@ -66,16 +67,17 @@ def session(connection, client):
|
||||||
else:
|
else:
|
||||||
if not already_set:
|
if not already_set:
|
||||||
nickname_list[pending] = connection
|
nickname_list[pending] = connection
|
||||||
property_list[pending] = {"host": hostname}
|
|
||||||
already_set = True
|
already_set = True
|
||||||
elif command == "USER":
|
elif command == "USER":
|
||||||
if not ready:
|
if not ready:
|
||||||
username = text.split(" ")[1]
|
username = text.split(" ")[1]
|
||||||
|
realname = " ".join(text.split(" ")[4:])[1:]
|
||||||
ready = True
|
ready = True
|
||||||
elif command == "CAP":
|
elif command == "CAP":
|
||||||
if args[0] == "LS":
|
if args[0] == "LS":
|
||||||
connection.sendall(bytes(f":{server} CAP * LS :\r\n", "UTF-8"))
|
connection.sendall(bytes(f":{server} CAP * LS :\r\n", "UTF-8"))
|
||||||
elif (ready and already_set) and not finished:
|
elif (ready and already_set) and not finished:
|
||||||
|
property_list[pending] = {"host": hostname, "username": username, "realname": realname}
|
||||||
connection.sendall(bytes(f":{server} 001 {pending} :Welcome to the {displayname} Internet Relay Chat Network {pending}\r\n", "UTF-8"))
|
connection.sendall(bytes(f":{server} 001 {pending} :Welcome to the {displayname} Internet Relay Chat Network {pending}\r\n", "UTF-8"))
|
||||||
connection.sendall(bytes(f":{server} 002 {pending} :Your host is {server}[{ip}/6667], running version IRCat-v{__version__}\r\n", "UTF-8"))
|
connection.sendall(bytes(f":{server} 002 {pending} :Your host is {server}[{ip}/6667], running version IRCat-v{__version__}\r\n", "UTF-8"))
|
||||||
connection.sendall(bytes(f":{server} 004 {pending} {server} IRCat-{__version__} iow ovmsitnlbkq\r\n", "UTF-8"))
|
connection.sendall(bytes(f":{server} 004 {pending} {server} IRCat-{__version__} iow ovmsitnlbkq\r\n", "UTF-8"))
|
||||||
|
|
Loading…
Reference in a new issue