From 3620d533ee88a8804317d2745320c0186192ddaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Wed, 5 Oct 2016 00:17:22 +0200 Subject: Avoid sending PART command for unjoined channels fix #3205 --- src/irc/irc_channel.cpp | 6 ------ src/irc/irc_channel.hpp | 15 +++++++++------ 2 files changed, 9 insertions(+), 12 deletions(-) (limited to 'src/irc') diff --git a/src/irc/irc_channel.cpp b/src/irc/irc_channel.cpp index e769245..40d7f54 100644 --- a/src/irc/irc_channel.cpp +++ b/src/irc/irc_channel.cpp @@ -1,12 +1,6 @@ #include #include -IrcChannel::IrcChannel(): - joined(false), - self(nullptr) -{ -} - void IrcChannel::set_self(const std::string& name) { this->self = std::make_unique(name); diff --git a/src/irc/irc_channel.hpp b/src/irc/irc_channel.hpp index 2bcefaf..7c269b9 100644 --- a/src/irc/irc_channel.hpp +++ b/src/irc/irc_channel.hpp @@ -14,16 +14,19 @@ class IrcChannel { public: - explicit IrcChannel(); + IrcChannel() = default; IrcChannel(const IrcChannel&) = delete; IrcChannel(IrcChannel&&) = delete; IrcChannel& operator=(const IrcChannel&) = delete; IrcChannel& operator=(IrcChannel&&) = delete; - bool joined; - std::string topic; - std::string topic_author; + bool joined{false}; + // Set to true if we sent a PART but didn’t yet receive the PART ack from + // the server + bool parting{false}; + std::string topic{}; + std::string topic_author{}; void set_self(const std::string& name); IrcUser* get_self() const; IrcUser* add_user(const std::string& name, @@ -35,8 +38,8 @@ public: { return this->users; } protected: - std::unique_ptr self; - std::vector> users; + std::unique_ptr self{}; + std::vector> users{}; }; /** -- cgit v1.2.3