diff --git a/Subscription.cpp b/Subscription.cpp index 210c162..e3df1a8 100644 --- a/Subscription.cpp +++ b/Subscription.cpp @@ -70,4 +70,12 @@ namespace core { return 0; } + void Subscription::sendToAll(std::stringstream &data, TCPSession &sender) { + for (auto session : subscribers) + if (session != &sender) + session->write(data.str()); + data.str(""); + } + + } diff --git a/Subscription.h b/Subscription.h index 524e5c3..3845dd7 100644 --- a/Subscription.h +++ b/Subscription.h @@ -32,6 +32,8 @@ namespace core bool subInvite(TCPSession &session); + void sendToAll(std::stringstream &data, TCPSession &sender); + std::string id; std::string mode; TCPSession *owner;