summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/irc/irc_client.cpp24
-rw-r--r--src/irc/irc_client.hpp4
2 files changed, 28 insertions, 0 deletions
diff --git a/src/irc/irc_client.cpp b/src/irc/irc_client.cpp
index e3d7653..8de7c8f 100644
--- a/src/irc/irc_client.cpp
+++ b/src/irc/irc_client.cpp
@@ -89,6 +89,8 @@ void IrcClient::parse_in_buffer()
this->on_welcome_message(message);
else if (message.command == "PART")
this->on_part(message);
+ else if (message.command == "QUIT")
+ this->on_quit(message);
}
}
@@ -257,3 +259,25 @@ void IrcClient::on_part(const IrcMessage& message)
channel->joined = false;
}
}
+
+void IrcClient::on_quit(const IrcMessage& message)
+{
+ std::string txt;
+ if (message.arguments.size() >= 1)
+ txt = message.arguments[0];
+ for (auto it = this->channels.begin(); it != this->channels.end(); ++it)
+ {
+ const std::string chan_name = it->first;
+ IrcChannel* channel = it->second.get();
+ const IrcUser* user = channel->find_user(message.prefix);
+ if (user)
+ {
+ std::string nick = user->nick;
+ channel->remove_user(user);
+ Iid iid;
+ iid.chan = chan_name;
+ iid.server = this->hostname;
+ this->bridge->send_muc_leave(std::move(iid), std::move(nick), std::move(txt), false);
+ }
+ }
+}
diff --git a/src/irc/irc_client.hpp b/src/irc/irc_client.hpp
index e58ffbc..33ab894 100644
--- a/src/irc/irc_client.hpp
+++ b/src/irc/irc_client.hpp
@@ -114,6 +114,10 @@ public:
* When a PART message is received
*/
void on_part(const IrcMessage& message);
+ /**
+ * When a QUIT message is received
+ */
+ void on_quit(const IrcMessage& message);
private:
/**