54static constexpr const char *DEFAULT_IGNORE_STRATEGY =
"nop";
117 bool hasPermission(
const std::string &being,
unsigned int flags);
Ignore strategy: describes how we should handle ignores.
virtual void ignore(Being *being, unsigned int flags)=0
Handle the ignoring of the indicated action by the indicated player.
virtual ~PlayerIgnoreStrategy()=default
PlayerRelationsListener()=default
virtual void playerRelationsUpdated()=0
virtual ~PlayerRelationsListener()=default
Player relations class, represents any particular relations and/or preferences the user of the local ...
void store()
Save configuration to our config file.
std::vector< PlayerIgnoreStrategy * > mIgnoreStrategies
PlayerIgnoreStrategy * mIgnoreStrategy
void init()
Initialise player relations manager (load config file etc.)
std::vector< std::string > getPlayers() const
Retrieves a sorted vector of all players for which we have any relations recorded.
PlayerRelationsManager()=default
PlayerRelation getRelation(const std::string &name) const
Updates the relationship with this player.
std::map< std::string, PlayerRelation > mRelations
unsigned int getDefault() const
Retrieves the default permissions.
bool hasPermission(Being *being, unsigned int flags)
Tests whether the player in question is being ignored for any of the actions in the specified flags.
~PlayerRelationsManager()
void removeListener(PlayerRelationsListener *listener)
void addListener(PlayerRelationsListener *listener)
std::vector< PlayerIgnoreStrategy * > & getPlayerIgnoreStrategies()
Retrieves all known player ignore strategies.
void setDefault(unsigned int permissions)
Sets the default permissions.
PlayerIgnoreStrategy * getPlayerIgnoreStrategy() const
Return the current player ignore strategy.
int getPlayerIgnoreStrategyIndex(const std::string &shortName)
For a given ignore strategy short name, find the appropriate index in the ignore strategies vector.
void setPlayerIgnoreStrategy(PlayerIgnoreStrategy *strategy)
Sets the strategy to call when ignoring players.
void setRelation(const std::string &name, PlayerRelation relation)
Updates the relationship with this player.
void removePlayer(const std::string &name)
Deletes the information recorded for a player.
unsigned int checkPermissionSilently(const std::string &player_name, unsigned int flags)
Determines whether the player in question is being ignored, filtered by the specified flags.
std::list< PlayerRelationsListener * > mListeners
constexpr unsigned int RELATIONS_NR
PlayerRelationsManager player_relations