eris  1.4.0
A WorldForge client library.
Lobby.h
1 #ifndef ERIS_LOBBY_H
2 #define ERIS_LOBBY_H
3 
4 #include <memory>
5 #include "Room.h"
6 
7 namespace Eris
8 {
9 
10 class Account;
11 class Person;
12 class Connection;
13 class OOGRouter;
14 
26 class Lobby : public Room
27 {
28 public:
31  explicit Lobby(Account &acc);
32 
34  ~Lobby() override;
35 
38  Room* join(const std::string &roomID);
39 
41  Person* getPerson(const std::string &acc);
42 
47  Room* getRoom(const std::string &id);
48 
51  {
52  return m_account;
53  }
54 
56  Connection& getConnection() const;
57 
58 // callbacks
60  sigc::signal<void, Person*> SightPerson;
61 
67  sigc::signal<void, Person*, const std::string&> PrivateTalk;
68 
69 protected:
70  friend class Room;
71  friend class OOGRouter;
72 
73  void look(const std::string &id);
74 
75  void sightPerson(const Atlas::Objects::Entity::Account &ac);
76  Router::RouterResult recvTalk(const Atlas::Objects::Operation::Talk& tk);
77  void recvInitialSight(const Atlas::Objects::Entity::RootEntity& ent);
78 
79  void recvAppearance(const Atlas::Objects::Root& obj);
80  void recvDisappearance(const Atlas::Objects::Root& obj);
81 
82  Router::RouterResult recvImaginary(const Atlas::Objects::Operation::Imaginary& im);
83 
84 private:
85  void onLoggedIn();
86  void onLogout(bool clean);
87 
88  Account& m_account;
89  IdPersonMap m_people;
90 
91  std::unordered_map<std::string, std::unique_ptr<Room>> m_rooms;
92 
93  std::unique_ptr<OOGRouter> m_router;
94 };
95 
96 } // of namespace Eris
97 
98 #endif
Eris::Lobby::~Lobby
~Lobby() override
Definition: Lobby.cpp:135
Eris::Lobby
Definition: Lobby.h:27
Eris::Room
Definition: Room.h:26
Eris::OOGRouter
Definition: Lobby.cpp:34
Eris::Lobby::SightPerson
sigc::signal< void, Person * > SightPerson
Emitted when sight of a person is received.
Definition: Lobby.h:60
Eris::Lobby::getPerson
Person * getPerson(const std::string &acc)
obtain a person's info, given their account ID; may return nullptr
Definition: Lobby.cpp:197
Eris::Lobby::getConnection
Connection & getConnection() const
Helper method to access the underlying Connection from the Account.
Definition: Lobby.cpp:192
Eris::Person
Definition: Person.h:16
Eris::Lobby::getAccount
Account & getAccount() const
Retrive the Account which this lobbby is bound to.
Definition: Lobby.h:50
Eris::Account
Encapsulates all the state of an Atlas Account, and methods that operation on that state.
Definition: Account.h:42
Eris::Lobby::getRoom
Room * getRoom(const std::string &id)
Definition: Lobby.cpp:210
Eris
Definition: Account.cpp:33
Eris::Lobby::PrivateTalk
sigc::signal< void, Person *, const std::string & > PrivateTalk
Definition: Lobby.h:67
Eris::Lobby::join
Room * join(const std::string &roomID)
Definition: Lobby.cpp:165
Eris::Connection
Definition: Connection.h:45