Skip to content

Commit

Permalink
Fix connections being logged as characters, resulting in log spam. Cl…
Browse files Browse the repository at this point in the history
…oses #44
  • Loading branch information
Crystalwarrior committed Mar 9, 2022
1 parent 46bc64a commit 81ecbd9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions server/area.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,8 @@ def save(self):
def new_client(self, client):
"""Add a client to the area."""
self.clients.add(client)
database.log_area("area.join", client, self)
if client.char_id != None:
database.log_area("area.join", client, self)

if self.music_autoplay:
client.send_command(
Expand Down Expand Up @@ -696,7 +697,8 @@ def remove_client(self, client):
self.remove_jukebox_vote(client, True)
if len(self.clients) == 0:
self.change_status("IDLE")
database.log_area("area.leave", client, self)
if client.char_id != None:
database.log_area("area.leave", client, self)
if not client.hidden:
self.area_manager.send_arup_players()

Expand Down
4 changes: 3 additions & 1 deletion server/client_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def __init__(self, server, transport, user_id, ipid):
self.transport = transport
self.hdid = ""
self.id = user_id
self.char_id = -1
self.char_id = None
self.area = server.hub_manager.default_hub().default_area()
self.server = server
self.name = ""
Expand Down Expand Up @@ -1304,6 +1304,8 @@ def ip(self):
@property
def char_name(self):
"""Get the name of the character that the client is using."""
if self.char_id is None:
return "Connection"
if self.char_id == -1:
return "Spectator"
return self.server.char_list[self.char_id]
Expand Down

0 comments on commit 81ecbd9

Please sign in to comment.