mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Fixed missing variable in formatting of disconnect string in delcom, made display of @channels more legible and display when someone is Muted rather than not subscribed. Refactored the 'who' list for channels to now be a property of the channel that returns a string of all the subscribers separated by commas, with those who are actively listening (not muted) in bold, and made both '@cwho' and 'allcom who' call to it.
This commit is contained in:
parent
951cd60a6d
commit
c32920999b
2 changed files with 23 additions and 14 deletions
|
|
@ -176,7 +176,7 @@ class CmdDelCom(COMMAND_DEFAULT_CLASS):
|
|||
disconnect = channel.disconnect(player)
|
||||
if disconnect:
|
||||
wipednicks = " Eventual aliases were removed." if delnicks else ""
|
||||
self.msg("You stop listening to channel '%s'.%s" % channel.key)
|
||||
self.msg("You stop listening to channel '%s'.%s" % (channel.key, wipednicks))
|
||||
return
|
||||
else:
|
||||
# we are removing a channel nick
|
||||
|
|
@ -249,12 +249,7 @@ class CmdAllCom(COMMAND_DEFAULT_CLASS):
|
|||
if not channels:
|
||||
string += "No channels."
|
||||
for channel in channels:
|
||||
string += "\n{w%s:{n\n" % channel.key
|
||||
subs = channel.db_subscriptions.all()
|
||||
if subs:
|
||||
string += " " + ", ".join([player.key for player in subs])
|
||||
else:
|
||||
string += " <None>"
|
||||
string += "\n{w%s:{n\n %s" % (channel.key, channel.wholist)
|
||||
self.msg(string.strip())
|
||||
else:
|
||||
# wrong input
|
||||
|
|
@ -317,13 +312,21 @@ class CmdChannels(COMMAND_DEFAULT_CLASS):
|
|||
clower = chan.key.lower()
|
||||
nicks = caller.nicks.get(category="channel", return_obj=True)
|
||||
nicks = nicks or []
|
||||
comtable.add_row(*[chan in subs and "{gYes{n" or "{rNo{n",
|
||||
if chan not in subs:
|
||||
substatus = "{rNo{n"
|
||||
elif caller in chan.mutelist:
|
||||
substatus = "{rMuted{n"
|
||||
else:
|
||||
substatus = "{gYes{n"
|
||||
comtable.add_row(*[substatus,
|
||||
"%s%s" % (chan.key, chan.aliases.all() and
|
||||
"(%s)" % ",".join(chan.aliases.all()) or ""),
|
||||
"%s" % ",".join(nick.db_key for nick in make_iter(nicks)
|
||||
if nick.value[3].lower() == clower),
|
||||
str(chan.locks),
|
||||
chan.db.desc])
|
||||
comtable.reformat_column(0, width=9)
|
||||
comtable.reformat_column(3, width=14)
|
||||
caller.msg("\n{wAvailable channels{n (use {wcomlist{n,{waddcom{n and {wdelcom{n to manage subscriptions):\n%s" % comtable)
|
||||
|
||||
|
||||
|
|
@ -511,12 +514,7 @@ class CmdCWho(COMMAND_DEFAULT_CLASS):
|
|||
self.msg(string)
|
||||
return
|
||||
string = "\n{CChannel subscriptions{n"
|
||||
string += "\n{w%s:{n\n" % channel.key
|
||||
subs = channel.db_subscriptions.all()
|
||||
if subs:
|
||||
string += " " + ", ".join([player.key for player in subs])
|
||||
else:
|
||||
string += " <None>"
|
||||
string += "\n{w%s:{n\n %s" % (channel.key, channel.wholist)
|
||||
self.msg(string.strip())
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -83,6 +83,17 @@ class DefaultChannel(with_metaclass(TypeclassBase, ChannelDB)):
|
|||
def mutelist(self):
|
||||
return self.db.mute_list or []
|
||||
|
||||
@property
|
||||
def wholist(self):
|
||||
subs = self.db_subscriptions.all()
|
||||
listening = [ob for ob in subs if ob.is_connected and ob not in self.mutelist]
|
||||
if subs:
|
||||
# display listening subscribers in bold
|
||||
string = ", ".join([player.key if player not in listening else "{w%s{n" % player.key for player in subs])
|
||||
else:
|
||||
string = "<None>"
|
||||
return string
|
||||
|
||||
def mute(self, subscriber):
|
||||
"""
|
||||
Adds an entity to the list of muted subscribers.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue