Lots of re-arranging of the comsys and near completion of comsys player commands. I'm going to halt further progres on this long enough for me to take a second look at my code and re-factor some things, then go on to work on some of the lesser-used commands. New in this revision: on, off, last, who for channels (pub who, etc.). Make sure you nuke all of your comsys-related tables and re-sync.

This commit is contained in:
Greg Taylor 2007-05-25 03:24:23 +00:00
parent 49b6a0ba57
commit c7f32f904d
6 changed files with 249 additions and 77 deletions

View file

@ -60,57 +60,8 @@ class SessionProtocol(StatefulTelnetProtocol):
"""
Execute this when a client abruplty loses their connection.
"""
print "DISCONNECT:", reason.getErrorMessage()
def has_user_channel(self, cname, alias_search=False, return_muted=False):
"""
Is this session subscribed to the named channel?
return_muted: (bool) Take the user's enabling/disabling of the channel
into consideration?
"""
has_channel = False
if alias_search:
# Search by aliases only.
cdat = self.channels_subscribed.get(cname, False)
# No key match, fail immediately.
if not cdat:
return False
# If channel status is taken into consideration, see if the user
# has the channel muted or not.
if return_muted:
return cdat[1]
else:
return True
else:
# Search by complete channel name.
chan_list = self.channels_subscribed.values()
for chan in chan_list:
# Check for a name match
if cname == chan[0]:
has_channel = True
# If channel status is taken into consideration, see if the user
# has the channel muted or not.
if return_muted is False and not chan[1]:
has_channel = False
break
return has_channel
def set_user_channel(self, alias, cname, listening):
"""
Add a channel to a session's channel list.
"""
self.channels_subscribed[alias] = [cname, listening]
self.get_pobject().set_attribute("CHANLIST", pickle.dumps(self.channels_subscribed))
def del_user_channel(self, alias):
"""
Remove a channel from a session's channel list.
"""
del self.channels_subscribed[alias]
functions_general.log_infomsg('Disconnect: %s' % (self,))
functions_general.log_infomsg('Sessions active: %d' % (len(session_mgr.get_session_list()),))
def load_user_channels(self):
"""