1 #include "ChatRoom.hpp" 2 #include "ChatRoomArray.hpp" 3 #include "ChatMessage.hpp" 5 #include "ChatUser.hpp" 6 #include "ChatClient.hpp" 7 #include "ChatService.hpp" 9 #include <samchon/library/XML.hpp> 10 #include <samchon/protocol/Invoke.hpp> 34 sendData(shared_ptr<Invoke>(
new Invoke(
"handleRoom",
toXML())));
42 sendData(shared_ptr<Invoke>(
new Invoke(
"handleRoom",
toXML())));
50 void ChatRoom::replyData(shared_ptr<Invoke> invoke)
52 if(invoke->getListener() ==
"sendMessage")
54 shared_ptr<Invoke> ivk(
new Invoke(
"handleMessage"));
55 ivk->at(0) = invoke->at(0);
60 void ChatRoom::sendData(shared_ptr<Invoke> invoke)
64 if(invoke->getListener() ==
"handleMessage")
67 message.
construct(invoke->at(0)->getValueAsXML());
71 (*it)->sendData(invoke);
74 if((*it)->getClient()->getUser()->getID() == message.
getListener())
75 (*it)->sendData(invoke);
79 (*it)->sendData(invoke);
88 xml->setProperty(
"name",
name);
93 shared_ptr<XML> participant(
new XML());
94 participant->setTag(
"participant");
95 participant->setValue((*it)->getClient()->getUser()->getID());
97 xml->push_back(participant);
An entity, a standard data class.
virtual auto toXML() const -> std::shared_ptr< library::XML >
Get an XML object represents the Entity.
A chat service inherited from cloud service.
ChatUser * host
A host, who established the room.
auto getID() const -> std::string
Get user's account id.
virtual void construct(std::shared_ptr< library::XML >)
Construct data of the Entity from an XML object.
void registerClient(ChatService *)
Register a participant client.
library::CriticalSet< ChatService * > participants
Participants, ChatUser(s) in the room.
auto getListener() const -> std::string
Get listener.
Package of network protocol and libraries.
ChatRoomArray * roomArray
All rooms that the room is belonged to.
An interface of Invoke message chain.
Standard message of network I/O.
virtual auto toXML() const -> std::shared_ptr< library::XML > override
Get an XML object represents the Entity.
void notify()
Notify changes of chat rooms.
XML is a class representing xml object.
std::string name
Name of the room.
void eraseClient(ChatService *)
Erase a participant client.