From d14b014611dbfed250cd0f605dfe348fb5bcac3d Mon Sep 17 00:00:00 2001 From: Griatch Date: Wed, 12 Dec 2012 22:57:03 +0100 Subject: [PATCH] Fixed the auto-subscription to channels by non-superusers. Resolves Issue 336. Removed a spurious print statement in the unloggedin create command. --- src/commands/default/unloggedin.py | 1 - src/comms/models.py | 10 +++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/commands/default/unloggedin.py b/src/commands/default/unloggedin.py index 1d6662b6a8..1d0c1bfd23 100644 --- a/src/commands/default/unloggedin.py +++ b/src/commands/default/unloggedin.py @@ -132,7 +132,6 @@ class CmdUnconnectedCreate(MuxCommand): session.msg(string) return playername, password = parts - print "playername '%s', password: '%s'" % (playername, password) # sanity checks if not re.findall('^[\w. @+-]+$', playername) or not (0 < len(playername) <= 30): diff --git a/src/comms/models.py b/src/comms/models.py index 952a30413b..9efc65df6f 100644 --- a/src/comms/models.py +++ b/src/comms/models.py @@ -30,7 +30,6 @@ from src.utils.utils import is_iter, to_str, crop, make_iter __all__ = ("Msg", "TempMsg", "Channel", "PlayerChannelConnection", "ExternalChannelConnection") - #------------------------------------------------------------ # # Msg @@ -546,6 +545,15 @@ class Channel(SharedMemoryModel): Checks so this player is actually listening to this channel. """ + # also handle object.player calls + player, typ = identify_object(player) + if typ == 'object': + player = player.player + player, typ = identify_object(player) + if player and not typ == "player": + logger.log_errmsg("Channel.has_connection received object of type '%s'. It only accepts players/characters." % typ) + return + # do the check return PlayerChannelConnection.objects.has_player_connection(player, self) def msg(self, msgobj, header=None, senders=None, persistent=True):