MumbleChannelJoiner.cpp 743 B

12345678910111213141516171819202122232425
  1. #include "MumbleChannelJoiner.hpp"
  2. #include <boost/algorithm/string.hpp>
  3. using namespace std;
  4. mumble::MumbleChannelJoiner::MumbleChannelJoiner(std::string channelNameRegex) : channelNameRegex(boost::regex(channelNameRegex)),
  5. logger(log4cpp::Category::getInstance("MumbleChannelJoiner")){
  6. }
  7. void mumble::MumbleChannelJoiner::checkChannel(std::string channel_name, int channel_id) {
  8. boost::smatch s;
  9. logger.debug("Channel %s available (%d)", channel_name.c_str(), channel_id);
  10. if(boost::regex_match(channel_name, s, channelNameRegex)) {
  11. this->channel_id = channel_id;
  12. }
  13. }
  14. void mumble::MumbleChannelJoiner::maybeJoinChannel(mumble::MumbleCommunicator *mc) {
  15. if(channel_id > -1) {
  16. mc->joinChannel(channel_id);
  17. }
  18. }