@@ -359,8 +359,16 @@ void Bridge::leave_irc_channel(Iid&& iid, const std::string& status_message, con
|
|||||||
|
|
||||||
const auto resources = this->number_of_resources_in_chan(key);
|
const auto resources = this->number_of_resources_in_chan(key);
|
||||||
if (resources == 1)
|
if (resources == 1)
|
||||||
|
{
|
||||||
|
// Do not send a PART message if we actually are not in that channel
|
||||||
|
// or if we already sent a PART but we are just waiting for the
|
||||||
|
// acknowledgment from the server
|
||||||
|
IrcChannel* channel = irc->get_channel(iid.get_local());
|
||||||
|
if (channel->joined && !channel->parting)
|
||||||
{
|
{
|
||||||
irc->send_part_command(iid.get_local(), status_message);
|
irc->send_part_command(iid.get_local(), status_message);
|
||||||
|
channel->parting = true;
|
||||||
|
}
|
||||||
// Since there are no resources left in that channel, we don't
|
// Since there are no resources left in that channel, we don't
|
||||||
// want to receive private messages using this room's JID
|
// want to receive private messages using this room's JID
|
||||||
this->remove_all_preferred_from_jid_of_room(iid.get_local());
|
this->remove_all_preferred_from_jid_of_room(iid.get_local());
|
||||||
|
|||||||
@@ -1,12 +1,6 @@
|
|||||||
#include <irc/irc_channel.hpp>
|
#include <irc/irc_channel.hpp>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
IrcChannel::IrcChannel():
|
|
||||||
joined(false),
|
|
||||||
self(nullptr)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void IrcChannel::set_self(const std::string& name)
|
void IrcChannel::set_self(const std::string& name)
|
||||||
{
|
{
|
||||||
this->self = std::make_unique<IrcUser>(name);
|
this->self = std::make_unique<IrcUser>(name);
|
||||||
|
|||||||
@@ -14,16 +14,19 @@
|
|||||||
class IrcChannel
|
class IrcChannel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit IrcChannel();
|
IrcChannel() = default;
|
||||||
|
|
||||||
IrcChannel(const IrcChannel&) = delete;
|
IrcChannel(const IrcChannel&) = delete;
|
||||||
IrcChannel(IrcChannel&&) = delete;
|
IrcChannel(IrcChannel&&) = delete;
|
||||||
IrcChannel& operator=(const IrcChannel&) = delete;
|
IrcChannel& operator=(const IrcChannel&) = delete;
|
||||||
IrcChannel& operator=(IrcChannel&&) = delete;
|
IrcChannel& operator=(IrcChannel&&) = delete;
|
||||||
|
|
||||||
bool joined;
|
bool joined{false};
|
||||||
std::string topic;
|
// Set to true if we sent a PART but didn’t yet receive the PART ack from
|
||||||
std::string topic_author;
|
// the server
|
||||||
|
bool parting{false};
|
||||||
|
std::string topic{};
|
||||||
|
std::string topic_author{};
|
||||||
void set_self(const std::string& name);
|
void set_self(const std::string& name);
|
||||||
IrcUser* get_self() const;
|
IrcUser* get_self() const;
|
||||||
IrcUser* add_user(const std::string& name,
|
IrcUser* add_user(const std::string& name,
|
||||||
@@ -35,8 +38,8 @@ public:
|
|||||||
{ return this->users; }
|
{ return this->users; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::unique_ptr<IrcUser> self;
|
std::unique_ptr<IrcUser> self{};
|
||||||
std::vector<std::unique_ptr<IrcUser>> users;
|
std::vector<std::unique_ptr<IrcUser>> users{};
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user