summaryrefslogtreecommitdiff
path: root/src/irc
diff options
context:
space:
mode:
Diffstat (limited to 'src/irc')
-rw-r--r--src/irc/client.cpp5
-rw-r--r--src/irc/client.hpp4
-rw-r--r--src/irc/message.cpp6
-rw-r--r--src/irc/message.hpp14
4 files changed, 16 insertions, 13 deletions
diff --git a/src/irc/client.cpp b/src/irc/client.cpp
index 2d07070..e08d243 100644
--- a/src/irc/client.cpp
+++ b/src/irc/client.cpp
@@ -11,7 +11,7 @@
#include "message.hpp"
-using namespace RedpilledBot::IRC;
+using namespace bot::irc;
Client::Client(std::string username, std::string password) {
this->username = username;
@@ -30,7 +30,8 @@ void Client::run() {
case ix::WebSocketMessageType::Message: {
std::cout << "Got a message: " << msg->str << std::endl;
- std::vector<std::string> lines = split_text(msg->str, '\n');
+ std::vector<std::string> lines =
+ utils::string::split_text(msg->str, '\n');
for (std::string &line : lines) {
line.erase(std::remove_if(line.begin(), line.end(),
diff --git a/src/irc/client.hpp b/src/irc/client.hpp
index 6f0791f..eec233c 100644
--- a/src/irc/client.hpp
+++ b/src/irc/client.hpp
@@ -6,8 +6,8 @@
#include "message.hpp"
-namespace RedpilledBot {
- namespace IRC {
+namespace bot {
+ namespace irc {
class Client {
public:
Client(std::string username, std::string password);
diff --git a/src/irc/message.cpp b/src/irc/message.cpp
index 123a0da..569e691 100644
--- a/src/irc/message.cpp
+++ b/src/irc/message.cpp
@@ -4,10 +4,10 @@
#include <string>
#include <vector>
-namespace RedpilledBot {
- namespace IRC {
+namespace bot {
+ namespace irc {
std::optional<MessageType> define_message_type(const std::string &msg) {
- std::vector<std::string> parts = split_text(msg, ' ');
+ std::vector<std::string> parts = utils::string::split_text(msg, ' ');
int i;
if (msg[0] == '@') {
diff --git a/src/irc/message.hpp b/src/irc/message.hpp
index 23bbe29..94541a6 100644
--- a/src/irc/message.hpp
+++ b/src/irc/message.hpp
@@ -8,8 +8,8 @@
#include "../utils/string.hpp"
-namespace RedpilledBot {
- namespace IRC {
+namespace bot {
+ namespace irc {
enum MessageType { Privmsg, Notice };
std::optional<MessageType> define_message_type(const std::string &msg);
@@ -38,7 +38,7 @@ namespace RedpilledBot {
template <MessageType T>
std::optional<Message<T>> parse_message(const std::string &msg) {
- std::vector<std::string> parts = split_text(msg, ' ');
+ std::vector<std::string> parts = utils::string::split_text(msg, ' ');
if (T == MessageType::Privmsg) {
MessageSender sender;
@@ -53,7 +53,8 @@ namespace RedpilledBot {
std::string user = parts[0];
user = user.substr(1, user.length());
- std::vector<std::string> user_parts = split_text(user, '!');
+ std::vector<std::string> user_parts =
+ utils::string::split_text(user, '!');
sender.login = user_parts[0];
@@ -64,10 +65,11 @@ namespace RedpilledBot {
parts.erase(parts.begin());
- std::string chat_message = join_vector(parts, ' ');
+ std::string chat_message = utils::string::join_vector(parts, ' ');
message.message = chat_message.substr(1, chat_message.length());
- std::vector<std::string> tags_parts = split_text(tags, ';');
+ std::vector<std::string> tags_parts =
+ utils::string::split_text(tags, ';');
for (const std::string &tag : tags_parts) {
std::istringstream iss(tag);