| 64 | } |
| 65 | |
| 66 | void deliver(const std::string& msg) |
| 67 | { |
| 68 | recent_msgs_.push_back(msg); |
| 69 | while (recent_msgs_.size() > max_recent_msgs) |
| 70 | recent_msgs_.pop_front(); |
| 71 | |
| 72 | for (auto participant: participants_) |
| 73 | participant->deliver(msg); |
| 74 | } |
| 75 | |
| 76 | private: |
| 77 | std::set<chat_participant_ptr> participants_; |