Commit fbec16f1 authored by louiz’'s avatar louiz’

Possibility to change a channel's topic

parent e840704b
...@@ -156,6 +156,13 @@ void Bridge::send_irc_kick(const Iid& iid, const std::string& target, const std: ...@@ -156,6 +156,13 @@ void Bridge::send_irc_kick(const Iid& iid, const std::string& target, const std:
irc->send_kick_command(iid.chan, target, reason); irc->send_kick_command(iid.chan, target, reason);
} }
void Bridge::set_channel_topic(const Iid& iid, const std::string& subject)
{
IrcClient* irc = this->get_irc_client(iid.server);
if (irc)
irc->send_topic_command(iid.chan, subject);
}
void Bridge::send_message(const Iid& iid, const std::string& nick, const std::string& body, const bool muc) void Bridge::send_message(const Iid& iid, const std::string& nick, const std::string& body, const bool muc)
{ {
if (muc) if (muc)
......
...@@ -49,6 +49,7 @@ public: ...@@ -49,6 +49,7 @@ public:
void leave_irc_channel(Iid&& iid, std::string&& status_message); void leave_irc_channel(Iid&& iid, std::string&& status_message);
void send_irc_nick_change(const Iid& iid, const std::string& new_nick); void send_irc_nick_change(const Iid& iid, const std::string& new_nick);
void send_irc_kick(const Iid& iid, const std::string& target, const std::string& reason); void send_irc_kick(const Iid& iid, const std::string& target, const std::string& reason);
void set_channel_topic(const Iid& iid, const std::string& subject);
/*** /***
** **
......
...@@ -122,6 +122,11 @@ void IrcClient::send_kick_command(const std::string& chan_name, const std::strin ...@@ -122,6 +122,11 @@ void IrcClient::send_kick_command(const std::string& chan_name, const std::strin
this->send_message(IrcMessage("KICK", {chan_name, target, reason})); this->send_message(IrcMessage("KICK", {chan_name, target, reason}));
} }
void IrcClient::send_topic_command(const std::string& chan_name, const std::string& topic)
{
this->send_message(IrcMessage("TOPIC", {chan_name, topic}));
}
void IrcClient::send_quit_command() void IrcClient::send_quit_command()
{ {
this->send_message(IrcMessage("QUIT", {"gateway shutdown"})); this->send_message(IrcMessage("QUIT", {"gateway shutdown"}));
......
...@@ -97,6 +97,7 @@ public: ...@@ -97,6 +97,7 @@ public:
* Send the KICK irc command * Send the KICK irc command
*/ */
void send_kick_command(const std::string& chan_name, const std::string& target, const std::string& reason); void send_kick_command(const std::string& chan_name, const std::string& target, const std::string& reason);
void send_topic_command(const std::string& chan_name, const std::string& topic);
/** /**
* Send the QUIT irc command * Send the QUIT irc command
*/ */
......
...@@ -217,6 +217,9 @@ void XmppComponent::handle_message(const Stanza& stanza) ...@@ -217,6 +217,9 @@ void XmppComponent::handle_message(const Stanza& stanza)
if (to.resource.empty()) if (to.resource.empty())
if (body && !body->get_inner().empty()) if (body && !body->get_inner().empty())
bridge->send_channel_message(iid, body->get_inner()); bridge->send_channel_message(iid, body->get_inner());
XmlNode* subject = stanza.get_child(COMPONENT_NS":subject");
if (subject)
bridge->set_channel_topic(iid, subject->get_inner());
} }
else else
{ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment