Implemented channel communication. You may now addcom/delcom and talk over channels. See @clist for master channel list, and comlist for your personal list. Still tons of work and cleanup to do, but it's in functional in its simplest form.

This commit is contained in:
Greg Taylor 2007-05-16 20:01:54 +00:00
parent 17bbc4c3b3
commit 107bd6d71a
7 changed files with 139 additions and 26 deletions

View file

@ -34,6 +34,43 @@ class PlayerSession(async_chat):
self.conn_time = time.time()
self.channels_subscribed = {}
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.