Fixes to player creation that may not actually do anything. Also add default flagged channels with the default alias being the first three characters of the channel's name.

This commit is contained in:
Greg Taylor 2009-01-22 03:50:16 +00:00
parent 4c562cd6ce
commit f0c129f730
3 changed files with 22 additions and 3 deletions

View file

@ -10,13 +10,14 @@ from twisted.conch.telnet import StatefulTelnetProtocol
from django.contrib.auth.models import User
from src.objects.models import Object
from src.objects.models import Object, CommChannel
from src.config.models import ConnectScreen, ConfigValue
from util import functions_general
import src.comsys
import cmdhandler
import logger
import session_mgr
import ansi
from util import functions_general
class SessionProtocol(StatefulTelnetProtocol):
"""
@ -133,7 +134,7 @@ class SessionProtocol(StatefulTelnetProtocol):
result = Object.objects.get(id=self.uid)
return result
except:
logger.log_errmsg("No session match for object: #%s" % self.uid)
logger.log_errmsg("No pobject match for session uid: %s" % self.uid)
return None
def game_connect_screen(self):
@ -186,6 +187,15 @@ class SessionProtocol(StatefulTelnetProtocol):
message = message.encode("utf-8")
self.sendLine("%s" % (message,))
def add_default_channels(self):
"""
Adds the player to the default channels.
"""
# Add the default channels.
for chan in CommChannel.objects.filter(is_joined_by_default=True):
chan_alias = chan.get_default_chan_alias()
src.comsys.plr_set_channel(self, chan_alias, chan.name, True)
def __str__(self):
"""
String representation of the user session class. We use