| 135 | } |
| 136 | |
| 137 | static void parseSource(const std::string &rawSourceComponent, |
| 138 | IRCMessage &message) |
| 139 | { |
| 140 | if (rawSourceComponent.empty()) { |
| 141 | return; |
| 142 | } |
| 143 | size_t nickPos = 0; |
| 144 | size_t nickEndPos = rawSourceComponent.find('!'); |
| 145 | |
| 146 | if (nickEndPos != std::string::npos) { |
| 147 | message.source.nick = rawSourceComponent.substr( |
| 148 | nickPos, nickEndPos - nickPos); |
| 149 | message.source.host = rawSourceComponent.substr(nickEndPos + 1); |
| 150 | } else { |
| 151 | // Assume the entire source is the host if no '!' is found |
| 152 | message.source.host = rawSourceComponent; |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | static void parseCommand(const std::string &rawCommandComponent, |
| 157 | IRCMessage &message) |
no test coverage detected