Page 1 of 2
Add /ignore Command
Posted: Tue Jan 08, 2013 6:25 am
by Slyph
I would kindly like to ask why no one has emplimented an /ignore Command. This has been one thing I've hated about Aos, is no /ignore command.
So is it possiable to implement?
Fyi:obviously this would work well for ignore the 60% population of kids on Aos.
-Slyph
Re: Add /ignore Command
Posted: Tue Jan 08, 2013 7:04 am
by Sasquatch
Would be nice but you would have to type a lost of people you want to ignore each game. Maybe an option on the controls file where you can add names that you can ignore?
Re: Add /ignore Command
Posted: Tue Jan 08, 2013 7:38 am
by Slyph
Sasquatch wrote:Would be nice but you would have to type a lost of people you want to ignore each game. Maybe an option on the controls file where you can add names that you can ignore?
Ya, like a text documents listing people who you ignored.
Re: Add /ignore Command
Posted: Tue Jan 08, 2013 8:03 am
by GreaseMonkey
How about /ignorefrom? That would make it much easier.
Re: Add /ignore Command
Posted: Tue Jan 08, 2013 5:17 pm
by Sasquatch
GreaseMonkey wrote:How about /ignorefrom? That would make it much easier.
elaborate
Re: Add /ignore Command
Posted: Tue Jan 08, 2013 6:15 pm
by mr.f
Slyph wrote:Sasquatch wrote:Would be nice but you would have to type a lost of people you want to ignore each game. Maybe an option on the controls file where you can add names that you can ignore?
Ya, like a text documents listing people who you ignored.
I don't think this is possible currently.. cause the server would need access to a client-side text document. Maybe a client-side hack would work. But I don't really know what I'm talking about haha
I did whip up a server-side script for this, but it ended up being really ugly. There was no good way to intercept the chats without making it so that no one got them. I ended up overriding send_contained.. which is bad.
Well it seems to work anyway, but someone else should probably take a look over to make sure. And maybe see if there's a better way to implement the actual ignoring part, while you're at it.
Code: Select all"""
ignore.py
Adds the ability to 'ignore' certain players (all their chats will not be
received). Use the command again to unignore. No arguments returns the list
of people you're currently ignoring.
Author: mr.f
"""
from pyspades import contained as loaders
from functools import partial
from twisted.internet import reactor
from commands import add, get_player
S_IGNORE = "You're now ignoring {player}"
S_UNIGNORE = "You've unignored {player}"
S_IGNORED = "{player} is ignoring you"
S_IGNORE_LIST = "You're currently ignoring: "
NOTIFY_IGNORED_PLAYER = True
ANON_NOTIFICATION = True
def ignore(connection, player = None):
#no args tells you everyone you're ingoring
if player is None:
return S_IGNORE_LIST + ", ".join(connection.ignoreList)
player = get_player(connection.protocol, player)
## if player is connection: return
#optionally notify ignored player
name = "Anon" if ANON_NOTIFICATION else connection.name
if NOTIFY_IGNORED_PLAYER:
player.send_chat(S_IGNORED.format(player = name))
if connection.add_ignore(player.name):
return S_IGNORE.format(player = player.name)
return S_UNIGNORE.format(player = player.name)
add(ignore)
def apply_script(protocol, connection, config):
class IgnoreConnection(connection):
def __init__(self, *arg, **kw):
connection.__init__(self, *arg, **kw)
self.ignoreList = [] #names of people this player is ignoring
def add_ignore(self, player_name):
if player_name not in self.ignoreList:
self.ignoreList.append(player_name)
return True
self.ignoreList.remove(player_name)
return False
class IgnoreProtocol(protocol):
def can_hear(self, target,chatter):
return chatter.name not in target.ignoreList
#copied from BaseProtocol
def send_contained(self, contained, unsequenced = False, sender = None,
team = None, save = False, rule = None):
if contained.id == loaders.ChatMessage.id:
chatter = self.players[contained.player_id]
rule = partial(self.can_hear, chatter)
protocol.send_contained(self,contained,unsequenced,sender,
team,save,rule)
return IgnoreProtocol, IgnoreConnection
Re: Add /ignore Command
Posted: Tue Jan 08, 2013 8:51 pm
by rakiru
Rather than copy-pasting send_contained and modifying it, I'd suggest checking if it's a chat packet, and if not, passing it on to the regular send_contained function.
Re: Add /ignore Command
Posted: Tue Jan 08, 2013 9:16 pm
by mr.f
Thanks for the tip. Ended up using the rule parameter for send_contained.. much cleaner now.
Re: Add /ignore Command
Posted: Tue Jan 08, 2013 9:18 pm
by Jdrew
I don't think it is needed because most people never PM anyone let alone spam there PMs.
Re: Add /ignore Command
Posted: Tue Jan 08, 2013 9:21 pm
by mr.f
jdrew wrote:I don't think it is needed because most people never PM anyone let alone spam there PMs.
It ignores certain people in the main chat. At least that's what I assume everyone was talking about.
Re: Add /ignore Command
Posted: Tue Jan 08, 2013 10:02 pm
by Jdrew
mr.f wrote:jdrew wrote:I don't think it is needed because most people never PM anyone let alone spam there PMs.
It ignores certain people in the main chat. At least that's what I assume everyone was talking about.
Ohh I get it so like a local mute thing for chat? It probably isn't posable but maybe?
Re: Add /ignore Command
Posted: Wed Jan 09, 2013 1:44 am
by White Hot
I think it could be possible if the script worked so that it could detect when players talked, and check who had them local muted, (locally muted?) and not display the text for them. Would probably cause chat lag though.
Re: Add /ignore Command
Posted: Wed Jan 09, 2013 1:50 am
by rakiru
jdrew wrote:mr.f wrote:jdrew wrote:I don't think it is needed because most people never PM anyone let alone spam there PMs.
It ignores certain people in the main chat. At least that's what I assume everyone was talking about.
Ohh I get it so like a local mute thing for chat? It probably isn't posable but maybe?
Of course it's fucking possible. Ignoring the fact that he just wrote a script to do exactly that, the server is in complete control of who gets sent to what. Something as simple as allowing users to ignore other users is easy.
Re: Add /ignore Command
Posted: Wed Jan 09, 2013 12:14 pm
by White Hot
rakiru wrote:jdrew wrote:
Ohh I get it so like a local mute thing for chat? It probably isn't posable but maybe?
Of course it's fucking possible. Ignoring the fact that he just wrote a script to do exactly that, the server is in complete control of who gets sent to what. Something as simple as allowing users to ignore other users is easy.
No, Rakiru, he said it's not posable. He's right, you can't really make a script pose.

Re: Add /ignore Command
Posted: Wed Jan 09, 2013 7:43 pm
by mr.f
White Hot wrote:rakiru wrote:jdrew wrote:
Ohh I get it so like a local mute thing for chat? It probably isn't posable but maybe?
Of course it's fucking possible. Ignoring the fact that he just wrote a script to do exactly that, the server is in complete control of who gets sent to what. Something as simple as allowing users to ignore other users is easy.
No, Rakiru, he said it's not posable. He's right, you can't really make a script pose. 
Hmm.. I'll have to make some modifications...
EDIT:
Code: Select all"""
O
/|\/
/ |
/\
/ \
ignore.py
Adds the ability to 'ignore' certain players (all their chats will not be
received). Use the command again to unignore. No arguments returns the list
of people you're currently ignoring.
Author: mr.f
"""
from pyspades import contained as loaders
from functools import partial
from twisted.internet import reactor
from commands import add, get_player
S_IGNORE = "You're now ignoring {player}"
S_UNIGNORE = "You've unignored {player}"
S_IGNORED = "{player} is ignoring you"
S_IGNORE_LIST = "You're currently ignoring: "
NOTIFY_IGNORED_PLAYER = True
ANON_NOTIFICATION = True
def ignore(connection, player = None):
#no args tells you everyone you're ingoring
if player is None:
return S_IGNORE_LIST + ", ".join(connection.ignoreList)
player = get_player(connection.protocol, player)
## if player is connection: return
#optionally notify ignored player
name = "Anon" if ANON_NOTIFICATION else connection.name
if NOTIFY_IGNORED_PLAYER:
player.send_chat(S_IGNORED.format(player = name))
if connection.add_ignore(player.name):
return S_IGNORE.format(player = player.name)
return S_UNIGNORE.format(player = player.name)
add(ignore)
def apply_script(protocol, connection, config):
class IgnoreConnection(connection):
def __init__(self, *arg, **kw):
connection.__init__(self, *arg, **kw)
self.ignoreList = [] #names of people this player is ignoring
def add_ignore(self, player_name):
if player_name not in self.ignoreList:
self.ignoreList.append(player_name)
return True
self.ignoreList.remove(player_name)
return False
class IgnoreProtocol(protocol):
def can_hear(self, target,chatter):
return chatter.name not in target.ignoreList
#copied from BaseProtocol
def send_contained(self, contained, unsequenced = False, sender = None,
team = None, save = False, rule = None):
if contained.id == loaders.ChatMessage.id:
chatter = self.players[contained.player_id]
rule = partial(self.can_hear, chatter)
protocol.send_contained(self,contained,unsequenced,sender,
team,save,rule)
return IgnoreProtocol, IgnoreConnection
There. Now fully posable.
