ManaPlus
playerrelations.cpp
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2008-2009 The Mana World Development Team
4  * Copyright (C) 2009-2010 The Mana Developers
5  * Copyright (C) 2011-2019 The ManaPlus Developers
6  *
7  * This file is part of The ManaPlus Client.
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <http://www.gnu.org/licenses/>.
21  */
22 
23 #include "being/playerrelations.h"
24 
25 #include "actormanager.h"
26 #include "configuration.h"
27 #include "logger.h"
28 
29 #include "being/localplayer.h"
31 #include "being/playerrelation.h"
32 
33 #include "utils/dtor.h"
34 #include "utils/foreach.h"
35 #include "utils/gettext.h"
36 
38 
39 #include "debug.h"
40 
41 static const unsigned int FIRST_IGNORE_EMOTE = 14;
42 
43 typedef std::map<std::string, PlayerRelation *> PlayerRelations;
44 typedef PlayerRelations::const_iterator PlayerRelationsCIter;
45 typedef std::list<PlayerRelationsListener *> PlayerRelationListeners;
46 typedef PlayerRelationListeners::const_iterator PlayerRelationListenersCIter;
47 
48 static const char *const PLAYER_IGNORE_STRATEGY_NOP = "nop";
49 static const char *const PLAYER_IGNORE_STRATEGY_EMOTE0 = "emote0";
50 static const char *const DEFAULT_IGNORE_STRATEGY =
52 
53 static const char *const NAME = "name";
54 static const char *const RELATION = "relation";
55 
56 static const unsigned int IGNORE_EMOTE_TIME = 100;
57 
58 namespace
59 {
61  {
62  public:
64  { }
65 
67 
68  bool operator() (const std::string &str1,
69  const std::string &str2) const
70  {
71  std::string s1 = str1;
72  std::string s2 = str2;
73  toLower(s1);
74  toLower(s2);
75  if (s1 == s2)
76  return str1 < str2;
77  return s1 < s2;
78  }
80 
81  // (De)serialisation class
83  public ConfigurationListManager<std::pair<std::string,
84  PlayerRelation *>, std::map<std::string, PlayerRelation *> *>
85  {
86  public:
88  { }
89 
91 
92  ConfigurationObject *writeConfigItem(
93  const std::pair<std::string, PlayerRelation *> &value,
94  ConfigurationObject *const cobj) const override final
95  {
96  if (cobj == nullptr ||
97  value.second == nullptr)
98  {
99  return nullptr;
100  }
101  cobj->setValue(NAME, value.first);
102  cobj->setValue(RELATION, toString(
103  CAST_S32(value.second->mRelation)));
104 
105  return cobj;
106  }
107 
108  std::map<std::string, PlayerRelation *> *
110  std::map<std::string, PlayerRelation *>
111  *const container) const override final
112  {
113  if (cobj == nullptr ||
114  container == nullptr)
115  {
116  return container;
117  }
118  const std::string name = cobj->getValue(NAME, "");
119  if (name.empty())
120  return container;
121 
122  if ((*container)[name] == nullptr)
123  {
124  const int v = cobj->getValueInt(RELATION,
126 
127  (*container)[name] = new PlayerRelation(
128  static_cast<RelationT>(v));
129  }
130  // otherwise ignore the duplicate entry
131 
132  return container;
133  }
134  };
135 } // namespace
136 
137 static PlayerConfSerialiser player_conf_serialiser; // stateless singleton
138 
139 const unsigned int PlayerRelation::RELATION_PERMISSIONS[RELATIONS_NR] =
140 {
141  /* NEUTRAL */ 0, // we always fall back to the defaults anyway
142  /* FRIEND */ EMOTE | SPEECH_FLOAT | SPEECH_LOG | WHISPER | TRADE,
143  /* DISREGARDED*/ EMOTE | SPEECH_FLOAT,
144  /* IGNORED */ 0,
145  /* ERASED */ INVISIBLE,
146  /* BLACKLISTED */ SPEECH_LOG | WHISPER,
147  /* ENEMY2 */ EMOTE | SPEECH_FLOAT | SPEECH_LOG | WHISPER | TRADE
148 };
149 
151  mPersistIgnores(false),
152  mDefaultPermissions(PlayerRelation::DEFAULT),
153  mIgnoreStrategy(nullptr),
154  mRelations(),
155  mListeners(),
156  mIgnoreStrategies()
157 {
158 }
159 
161 {
163 
165  delete it->second;
166  mRelations.clear();
167 }
168 
170 {
171  StringVect *const names = getPlayers();
172  FOR_EACHP (StringVectCIter, it, names)
173  removePlayer(*it);
174  delete names;
175 }
176 
177 static const char *const PERSIST_IGNORE_LIST = "persistent-player-list";
178 static const char *const PLAYER_IGNORE_STRATEGY = "player-ignore-strategy";
179 static const char *const DEFAULT_PERMISSIONS = "default-player-permissions";
180 
182  const std::string &name)
183 {
184  const STD_VECTOR<PlayerIgnoreStrategy *> *const strategies
186 
187  if (strategies == nullptr)
188  return -1;
189 
190  const size_t sz = strategies->size();
191  for (size_t i = 0; i < sz; i++)
192  {
193  if ((*strategies)[i]->mShortName == name)
194  return CAST_S32(i);
195  }
196 
197  return -1;
198 }
199 
201 {
202  Configuration *const cfg = &serverConfig;
203  clear();
204 
205  mPersistIgnores = (cfg->getValue(PERSIST_IGNORE_LIST, 1) != 0);
208 
209  const std::string ignore_strategy_name = cfg->getValue(
211  const int ignore_strategy_index = getPlayerIgnoreStrategyIndex(
212  ignore_strategy_name);
213 
214  if (ignore_strategy_index >= 0)
215  {
217  [ignore_strategy_index]);
218  }
219 
220  cfg->getList<std::pair<std::string, PlayerRelation *>,
221  std::map<std::string, PlayerRelation *> *>
222  ("player", &(mRelations), &player_conf_serialiser);
223 }
224 
225 
227 {
228  load();
229 
230  if (!mPersistIgnores)
231  {
232  clear(); // Yes, we still keep them around in the config file
233  // until the next update.
234  }
235 
237  (*it)->updateAll();
238 }
239 
241 {
242  serverConfig.setList<std::map<std::string,
243  PlayerRelation *>::const_iterator,
244  std::pair<std::string, PlayerRelation *>,
245  std::map<std::string, PlayerRelation *> *>
246  ("player", mRelations.begin(), mRelations.end(),
248 
254 
256 }
257 
258 void PlayerRelationsManager::signalUpdate(const std::string &name)
259 {
261  (*it)->updatedPlayer(name);
262 
263  if (actorManager != nullptr)
264  {
265  Being *const being = actorManager->findBeingByName(
266  name, ActorType::Player);
267 
268  if (being != nullptr &&
269  being->getType() == ActorType::Player)
270  {
271  being->updateColors();
272  }
273  }
274 }
275 
277  const std::string &player_name, const unsigned int flags) const
278 {
279  const std::map<std::string, PlayerRelation *>::const_iterator
280  it = mRelations.find(player_name);
281  if (it == mRelations.end())
282  {
283  return mDefaultPermissions & flags;
284  }
285 
286  const PlayerRelation *const r = (*it).second;
287  unsigned int permissions = PlayerRelation::RELATION_PERMISSIONS[
288  CAST_S32(r->mRelation)];
289 
290  switch (r->mRelation)
291  {
292  case Relation::NEUTRAL:
293  permissions = mDefaultPermissions;
294  break;
295 
296  case Relation::FRIEND:
297  permissions |= mDefaultPermissions; // widen
298  break;
299 
301  case Relation::IGNORED:
302  case Relation::ERASED:
304  case Relation::ENEMY2:
305  default:
306  permissions &= mDefaultPermissions; // narrow
307  break;
308  }
309 
310  return permissions & flags;
311 }
312 
314  const unsigned int flags) const
315 {
316  if (being == nullptr)
317  return false;
318 
319  if (being->getType() == ActorType::Player)
320  {
321  return static_cast<unsigned int>(hasPermission(
322  being->getName(), flags)) == flags;
323  }
324  return true;
325 }
326 
327 bool PlayerRelationsManager::hasPermission(const std::string &name,
328  const unsigned int flags) const
329 {
330  if (actorManager == nullptr)
331  return false;
332 
333  const unsigned int rejections = flags
334  & ~checkPermissionSilently(name, flags);
335  const bool permitted = (rejections == 0);
336 
337  if (!permitted)
338  {
339  // execute `ignore' strategy, if possible
340  if (mIgnoreStrategy != nullptr)
341  {
342  Being *const b = actorManager->findBeingByName(
343  name, ActorType::Player);
344 
345  if ((b != nullptr) && b->getType() == ActorType::Player)
346  mIgnoreStrategy->ignore(b, rejections);
347  }
348  }
349 
350  return permitted;
351 }
352 
353 void PlayerRelationsManager::setRelation(const std::string &player_name,
354  const RelationT relation)
355 {
356  if (localPlayer == nullptr ||
357  (relation != Relation::NEUTRAL &&
358  localPlayer->getName() == player_name))
359  {
360  return;
361  }
362 
363  PlayerRelation *const r = mRelations[player_name];
364  if (r == nullptr)
365  mRelations[player_name] = new PlayerRelation(relation);
366  else
367  r->mRelation = relation;
368 
369  signalUpdate(player_name);
370  store();
371 }
372 
374 {
375  StringVect *const retval = new StringVect;
376 
378  {
379  if (it->second != nullptr)
380  retval->push_back(it->first);
381  }
382 
383  std::sort(retval->begin(), retval->end(), playersRelSorter);
384 
385  return retval;
386 }
387 
389  const RelationT rel) const
390 {
391  StringVect *const retval = new StringVect;
392 
394  {
395  if ((it->second != nullptr) &&
396  it->second->mRelation == rel)
397  {
398  retval->push_back(it->first);
399  }
400  }
401 
402  std::sort(retval->begin(), retval->end(), playersRelSorter);
403 
404  return retval;
405 }
406 
407 void PlayerRelationsManager::removePlayer(const std::string &name)
408 {
409  delete mRelations[name];
410  mRelations.erase(name);
411  signalUpdate(name);
412 }
413 
414 
416  const std::string &name) const
417 {
418  const std::map<std::string, PlayerRelation *>::const_iterator
419  it = mRelations.find(name);
420  if (it != mRelations.end())
421  return (*it).second->mRelation;
422 
423  return Relation::NEUTRAL;
424 }
425 
427 // defaults
428 
430 {
431  return mDefaultPermissions;
432 }
433 
434 void PlayerRelationsManager::setDefault(const unsigned int permissions)
435 {
436  mDefaultPermissions = permissions;
437 
438  store();
439  signalUpdate("");
440 }
441 
442 void PlayerRelationsManager::ignoreTrade(const std::string &name) const
443 {
444  if (name.empty())
445  return;
446 
447  const RelationT relation = getRelation(name);
448 
449  if (relation == Relation::IGNORED ||
450  relation == Relation::DISREGARDED ||
451  relation == Relation::BLACKLISTED ||
452  relation == Relation::ERASED)
453  {
454  return;
455  }
457 }
458 
459 bool PlayerRelationsManager::checkBadRelation(const std::string &name) const
460 {
461  if (name.empty())
462  return true;
463 
464  const RelationT relation = getRelation(name);
465 
466  if (relation == Relation::IGNORED ||
467  relation == Relation::DISREGARDED ||
468  relation == Relation::BLACKLISTED ||
469  relation == Relation::ERASED ||
470  relation == Relation::ENEMY2)
471  {
472  return true;
473  }
474  return false;
475 }
476 
478 // ignore strategies
479 
480 
482 {
483  public:
486  {
487  // TRANSLATORS: ignore/unignore action
488  mDescription = _("Completely ignore");
490  }
491 
493 
494  void ignore(Being *const being A_UNUSED,
495  const unsigned int flags A_UNUSED) const override final
496  {
497  }
498 };
499 
501 {
502  public:
505  {
506  // TRANSLATORS: ignore/unignore action
507  mDescription = _("Print '...'");
508  mShortName = "dotdotdot";
509  }
510 
512 
513  void ignore(Being *const being,
514  const unsigned int flags A_UNUSED) const override final
515  {
516  if (being == nullptr)
517  return;
518 
519  logger->log("ignoring: " + being->getName());
520  being->setSpeech("...");
521  }
522 };
523 
524 
526 {
527  public:
530  {
531  // TRANSLATORS: ignore/unignore action
532  mDescription = _("Blink name");
533  mShortName = "blinkname";
534  }
535 
537 
538  void ignore(Being *const being,
539  const unsigned int flags A_UNUSED) const override final
540  {
541  if (being == nullptr)
542  return;
543 
544  logger->log("ignoring: " + being->getName());
545  being->flashName(200);
546  }
547 };
548 
550 {
551  public:
552  PIS_emote(const uint8_t emote_nr,
553  const std::string &description,
554  const std::string &shortname) :
556  mEmotion(emote_nr)
557  {
558  mDescription = description;
559  mShortName = shortname;
560  }
561 
563 
564  void ignore(Being *const being,
565  const unsigned int flags A_UNUSED) const override final
566  {
567  if (being == nullptr)
568  return;
569 
570  being->setEmote(mEmotion, IGNORE_EMOTE_TIME);
571  }
572  uint8_t mEmotion;
573 };
574 
575 STD_VECTOR<PlayerIgnoreStrategy *> *
577 {
578  if (mIgnoreStrategies.empty())
579  {
580  // not initialised yet?
582  // TRANSLATORS: ignore strategi
583  _("Floating '...' bubble"),
586  // TRANSLATORS: ignore strategi
587  _("Floating bubble"),
588  "emote1"));
589  mIgnoreStrategies.push_back(new PIS_nothing);
590  mIgnoreStrategies.push_back(new PIS_dotdotdot);
591  mIgnoreStrategies.push_back(new PIS_blinkname);
592  }
593  return &mIgnoreStrategies;
594 }
595 
596 bool PlayerRelationsManager::isGoodName(const std::string &name) const
597 {
598  const size_t size = name.size();
599 
600  if (size < 3)
601  return true;
602 
603  const std::map<std::string, PlayerRelation *>::const_iterator
604  it = mRelations.find(name);
605  if (it != mRelations.end())
606  return true;
607 
608  return checkName(name);
609 }
610 
612 {
613  if (being == nullptr)
614  return false;
615  if (being->getGoodStatus() != -1)
616  return being->getGoodStatus() == 1;
617 
618  const std::string &name = being->getName();
619  const size_t size = name.size();
620 
621  if (size < 3)
622  return true;
623 
624  const std::map<std::string, PlayerRelation *>::const_iterator
625  it = mRelations.find(name);
626  if (it != mRelations.end())
627  return true;
628 
629  const bool status = checkName(name);
630  being->setGoodStatus(status ? 1 : 0);
631  return status;
632 }
633 
634 bool PlayerRelationsManager::checkName(const std::string &name)
635 {
636  const size_t size = name.size();
637  const std::string check = config.getStringValue("unsecureChars");
638  const std::string lastChar = name.substr(size - 1, 1);
639 
640  if (name.substr(0, 1) == " " ||
641  lastChar == " " ||
642  lastChar == "." ||
643  name.find(" ") != std::string::npos)
644  {
645  return false;
646  }
647  else if (check.empty())
648  {
649  return true;
650  }
651  else if (name.find_first_of(check) != std::string::npos)
652  {
653  return false;
654  }
655  else
656  {
657  return true;
658  }
659 }
660 
PlayerRelationsManager::isGoodName
bool isGoodName(Being *const being) const
Definition: playerrelations.cpp:611
PlayerRelationsManager::mPersistIgnores
bool mPersistIgnores
Definition: playerrelations.h:196
ActorManager::findBeingByName
Being * findBeingByName(const std::string &name, const ActorTypeT type) const
Definition: actormanager.cpp:869
DEFAULT_IGNORE_STRATEGY
static const char *const DEFAULT_IGNORE_STRATEGY
Definition: playerrelations.cpp:50
PlayerIgnoreStrategy
Definition: playerignorestrategy.h:35
PlayerRelationsManager::getPlayersByRelation
StringVect * getPlayersByRelation(const RelationT rel) const
Definition: playerrelations.cpp:388
ConfigurationObject::getValue
std::string getValue(const std::string &key, const std::string &deflt) const
Definition: configuration.cpp:268
PlayerRelationsManager::getDefault
unsigned int getDefault() const
Definition: playerrelations.cpp:429
Being::setGoodStatus
void setGoodStatus(const int n)
Definition: being.h:802
PIS_nothing::PIS_nothing
PIS_nothing()
Definition: playerrelations.cpp:484
playerrelation.h
PlayerRelationsManager::store
void store() const
Definition: playerrelations.cpp:240
FOR_EACHP
#define FOR_EACHP(type, iter, array)
Definition: foreach.h:30
PlayerRelationsManager::mDefaultPermissions
unsigned int mDefaultPermissions
Definition: playerrelations.h:198
PlayerRelationsManager::PlayerRelationsManager
PlayerRelationsManager()
Definition: playerrelations.cpp:150
PlayerRelationsManager::mIgnoreStrategies
std::vector< PlayerIgnoreStrategy * > mIgnoreStrategies
Definition: playerrelations.h:205
PlayerRelationsManager::setRelation
void setRelation(const std::string &name, const RelationT relation)
Definition: playerrelations.cpp:353
Relation::FRIEND
@ FRIEND
Definition: relation.h:31
logger.h
IGNORE_EMOTE_TIME
static const unsigned int IGNORE_EMOTE_TIME
Definition: playerrelations.cpp:56
PLAYER_IGNORE_STRATEGY
static const char *const PLAYER_IGNORE_STRATEGY
Definition: playerrelations.cpp:178
playerrelationslistener.h
playerignorestrategy.h
PIS_nothing::ignore
void ignore(Being *const being, const unsigned int flags) const
Definition: playerrelations.cpp:494
PlayerRelationsManager::removePlayer
void removePlayer(const std::string &name)
Definition: playerrelations.cpp:407
PlayerRelationsManager::init
void init()
Definition: playerrelations.cpp:226
Being::updateColors
void updateColors()
Definition: being.cpp:2660
anonymous_namespace{playerrelations.cpp}::SortPlayersFunctor
Definition: playerrelations.cpp:60
A_DELETE_COPY
#define A_DELETE_COPY(func)
Definition: localconsts.h:52
PlayerRelations
std::map< std::string, PlayerRelation * > PlayerRelations
Definition: playerrelations.cpp:43
anonymous_namespace{playerrelations.cpp}::SortPlayersFunctor::SortPlayersFunctor
SortPlayersFunctor()
Definition: playerrelations.cpp:63
DEFAULT_PERMISSIONS
static const char *const DEFAULT_PERMISSIONS
Definition: playerrelations.cpp:179
Catch::toLower
std::string toLower(std::string const &s)
Relation::DISREGARDED
@ DISREGARDED
Definition: relation.h:32
actorManager
ActorManager * actorManager
Definition: actormanager.cpp:80
PlayerRelationsManager::mRelations
std::map< std::string, PlayerRelation * > mRelations
Definition: playerrelations.h:203
anonymous_namespace{playerrelations.cpp}::playersRelSorter
class anonymous_namespace{playerrelations.cpp}::SortPlayersFunctor playersRelSorter
StringVect
std::vector< std::string > StringVect
Definition: stringvector.h:28
RelationT
Relation ::T RelationT
Definition: relation.h:38
PIS_nothing
Definition: playerrelations.cpp:481
ConfigurationObject
Definition: configuration.h:87
A_UNUSED
#define A_UNUSED
Definition: localconsts.h:159
PIS_emote
Definition: playerrelations.cpp:549
PlayerRelationsManager::getPlayers
StringVect * getPlayers() const
Definition: playerrelations.cpp:373
Being::getGoodStatus
int getGoodStatus() const
Definition: being.h:799
PLAYER_IGNORE_STRATEGY_EMOTE0
static const char *const PLAYER_IGNORE_STRATEGY_EMOTE0
Definition: playerrelations.cpp:49
Relation::BLACKLISTED
@ BLACKLISTED
Definition: relation.h:35
PlayerRelationListenersCIter
PlayerRelationListeners::const_iterator PlayerRelationListenersCIter
Definition: playerrelations.cpp:46
ActorType::Player
@ Player
Definition: actortype.h:30
A_DEFAULT_COPY
#define A_DEFAULT_COPY(func)
Definition: localconsts.h:40
bool
Catch::toString
std::string toString(T const &value)
converts any type to a string
Definition: catch.hpp:1774
logger
Logger * logger
Definition: logger.cpp:88
PlayerIgnoreStrategy::ignore
virtual void ignore(Being *const being, const unsigned int flags) const =0
Configuration::setValue
void setValue(const std::string &key, const std::string &value)
Definition: configuration.cpp:238
localplayer.h
Relation::NEUTRAL
@ NEUTRAL
Definition: relation.h:30
localPlayer
LocalPlayer * localPlayer
Definition: localplayer.cpp:108
final
#define final
Definition: localconsts.h:45
RELATION
static const char *const RELATION
Definition: playerrelations.cpp:54
PlayerRelationsManager::clear
void clear()
Definition: playerrelations.cpp:169
PlayerRelationsManager::checkPermissionSilently
unsigned int checkPermissionSilently(const std::string &player_name, const unsigned int flags) const
Definition: playerrelations.cpp:276
PlayerRelationsManager::setPlayerIgnoreStrategy
void setPlayerIgnoreStrategy(PlayerIgnoreStrategy *const strategy)
Definition: playerrelations.h:137
PlayerRelationsManager::signalUpdate
void signalUpdate(const std::string &name)
Definition: playerrelations.cpp:258
PlayerRelationsManager::checkName
static bool checkName(const std::string &name)
Definition: playerrelations.cpp:634
nullptr
#define nullptr
Definition: localconsts.h:44
Being::getName
const std::string & getName() const
Definition: being.h:231
Relation::ENEMY2
@ ENEMY2
Definition: relation.h:36
PlayerRelationsManager::getPlayerIgnoreStrategyIndex
int getPlayerIgnoreStrategyIndex(const std::string &shortname)
Definition: playerrelations.cpp:181
PlayerRelationsManager::setDefault
void setDefault(const unsigned int permissions)
Definition: playerrelations.cpp:434
PlayerIgnoreStrategy::mDescription
std::string mDescription
Definition: playerignorestrategy.h:38
Relation::ERASED
@ ERASED
Definition: relation.h:34
PlayerRelationsManager
Definition: playerrelations.h:46
PlayerRelationsManager::mIgnoreStrategy
PlayerIgnoreStrategy * mIgnoreStrategy
Definition: playerrelations.h:202
ChatTabType::TRADE
@ TRADE
Definition: chattabtype.h:41
gettext.h
actormanager.h
PIS_blinkname::ignore
void ignore(Being *const being, const unsigned int flags) const
Definition: playerrelations.cpp:538
PIS_emote::mEmotion
uint8_t mEmotion
Definition: playerrelations.cpp:572
PlayerRelationsManager::hasPermission
bool hasPermission(const Being *const being, const unsigned int flags) const
Definition: playerrelations.cpp:313
Being
Definition: being.h:93
Relation::IGNORED
@ IGNORED
Definition: relation.h:33
Configuration::getStringValue
std::string getStringValue(const std::string &key) const
Definition: configuration.cpp:487
PIS_emote::ignore
void ignore(Being *const being, const unsigned int flags) const
Definition: playerrelations.cpp:564
serverConfig
Configuration serverConfig
Definition: configuration.cpp:52
PlayerRelationListeners
std::list< PlayerRelationsListener * > PlayerRelationListeners
Definition: playerrelations.cpp:45
PlayerRelationsManager::getPlayerIgnoreStrategies
std::vector< PlayerIgnoreStrategy * > * getPlayerIgnoreStrategies()
Definition: playerrelations.cpp:576
PlayerRelationsCIter
PlayerRelations::const_iterator PlayerRelationsCIter
Definition: playerrelations.cpp:44
PlayerIgnoreStrategy::mShortName
std::string mShortName
Definition: playerignorestrategy.h:39
config
Configuration config
Definition: configuration.cpp:51
playerRelations
PlayerRelationsManager playerRelations
Definition: playerrelations.cpp:661
PIS_emote::PIS_emote
PIS_emote(const uint8_t emote_nr, const std::string &description, const std::string &shortname)
Definition: playerrelations.cpp:552
ChatTabType::WHISPER
@ WHISPER
Definition: chattabtype.h:37
ConfigurationObject::setList
void setList(const std::string &name, IT begin, IT end, ConfigurationListManager< T, CONT > *manager)
Definition: configuration.h:145
delete_all
void delete_all(Container &c)
Definition: dtor.h:55
foreach.h
EmoteDB::size
int size()
Definition: emotedb.cpp:305
Configuration::write
void write()
Definition: configuration.cpp:858
Configuration
Definition: configuration.h:235
Being::getType
ActorTypeT getType() const
Definition: being.h:115
InputCondition::DEFAULT
@ DEFAULT
Definition: inputcondition.h:28
FIRST_IGNORE_EMOTE
static const unsigned int FIRST_IGNORE_EMOTE
Definition: playerrelations.cpp:41
PIS_dotdotdot
Definition: playerrelations.cpp:500
override
#define override
Definition: localconsts.h:46
std
Definition: mseprimitives.h:398
InputAction::EMOTE
@ EMOTE
Definition: inputaction.h:114
PlayerRelationsManager::getRelation
RelationT getRelation(const std::string &name) const
Definition: playerrelations.cpp:415
anonymous_namespace{playerrelations.cpp}::PlayerConfSerialiser::readConfigItem
std::map< std::string, PlayerRelation * > * readConfigItem(const ConfigurationObject *const cobj, std::map< std::string, PlayerRelation * > *const container) const
Definition: playerrelations.cpp:109
configuration.h
PlayerRelationsManager::mListeners
std::list< PlayerRelationsListener * > mListeners
Definition: playerrelations.h:204
anonymous_namespace{playerrelations.cpp}::PlayerConfSerialiser
Definition: playerrelations.cpp:82
PERSIST_IGNORE_LIST
static const char *const PERSIST_IGNORE_LIST
Definition: playerrelations.cpp:177
StringVectCIter
StringVect::const_iterator StringVectCIter
Definition: stringvector.h:30
PlayerRelationsManager::checkBadRelation
bool checkBadRelation(const std::string &name) const
Definition: playerrelations.cpp:459
CAST_S32
#define CAST_S32
Definition: cast.h:29
PlayerRelationsManager::load
void load()
Definition: playerrelations.cpp:200
PlayerRelationsManager::~PlayerRelationsManager
~PlayerRelationsManager()
Definition: playerrelations.cpp:160
PlayerRelation::mRelation
RelationT mRelation
Definition: playerrelation.h:54
player_conf_serialiser
static PlayerConfSerialiser player_conf_serialiser
Definition: playerrelations.cpp:137
PIS_dotdotdot::PIS_dotdotdot
PIS_dotdotdot()
Definition: playerrelations.cpp:503
ConfigurationListManager
Definition: configuration.h:47
PIS_blinkname::PIS_blinkname
PIS_blinkname()
Definition: playerrelations.cpp:528
NAME
static const char *const NAME
Definition: playerrelations.cpp:53
PIS_dotdotdot::ignore
void ignore(Being *const being, const unsigned int flags) const
Definition: playerrelations.cpp:513
dtor.h
_
#define _(s)
Definition: gettext.h:34
PlayerRelation
Definition: playerrelation.h:30
PlayerRelationsManager::ignoreTrade
void ignoreTrade(const std::string &name) const
Definition: playerrelations.cpp:442
PlayerRelation::RELATION_PERMISSIONS
static const unsigned int RELATION_PERMISSIONS[RELATIONS_NR]
Definition: playerrelation.h:42
PLAYER_IGNORE_STRATEGY_NOP
static const char *const PLAYER_IGNORE_STRATEGY_NOP
Definition: playerrelations.cpp:48
Logger::log
void log(const char *const log_text,...)
Definition: logger.cpp:268
FOR_EACH
#define FOR_EACH(type, iter, array)
Definition: foreach.h:24
debug.h
ConfigurationObject::getList
CONT getList(const std::string &name, CONT empty, ConfigurationListManager< T, CONT > *manager)
Definition: configuration.h:181
playerrelations.h
PIS_blinkname
Definition: playerrelations.cpp:525
anonymous_namespace{playerrelations.cpp}::PlayerConfSerialiser::PlayerConfSerialiser
PlayerConfSerialiser()
Definition: playerrelations.cpp:87