diff options
author | Sadie Powell <sadie@witchery.services> | 2025-03-26 11:05:28 +0000 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2025-03-26 11:08:02 +0000 |
commit | b5213d5a81bc8685e317913a1d2cfdcd5d92ebd5 (patch) | |
tree | e68582bad87730a461e2432740b94b5f2d4a58e5 | |
parent | dc09408f1a68356ee21969cb4f4fb28e94bf6512 (diff) |
Initialize Channel in the Modern C++ way.
-rw-r--r-- | include/channels.h | 18 | ||||
-rw-r--r-- | src/channels.cpp | 11 |
2 files changed, 12 insertions, 17 deletions
diff --git a/include/channels.h b/include/channels.h index 8bea70fc9..08f8756db 100644 --- a/include/channels.h +++ b/include/channels.h @@ -50,9 +50,9 @@ public: /* When the channel was created */ time_t creation_time; /* If the channel has just been created in a netjoin */ - bool syncing; + bool syncing = false; /* Is configured in the conf as a channel bots should be in */ - bool botchannel; + bool botchannel = false; /* Users in the channel */ typedef std::map<User *, ChanUserContainer *> ChanUserList; @@ -66,15 +66,15 @@ public: * This is the time the topic was *originally set*. When we restore the topic we want to change the TS back * to this, but we can only do this on certain IRCds. */ - time_t topic_ts; + time_t topic_ts = 0; /* The actual time the topic was set, probably close to Anope::CurTime */ - time_t topic_time; + time_t topic_time = 0; - time_t server_modetime; /* Time of last server MODE */ - time_t chanserv_modetime; /* Time of last check_modes() */ - int16_t server_modecount; /* Number of server MODEs this second */ - int16_t chanserv_modecount; /* Number of check_mode()'s this sec */ - int16_t bouncy_modes; /* Did we fail to set modes here? */ + time_t server_modetime = 0; /* Time of last server MODE */ + time_t chanserv_modetime = 0; /* Time of last check_modes() */ + int16_t server_modecount = 0; /* Number of server MODEs this second */ + int16_t chanserv_modecount = 0; /* Number of check_mode()'s this sec */ + bool bouncy_modes = false; /* Did we fail to set modes here? */ private: /** Constructor diff --git a/src/channels.cpp b/src/channels.cpp index c3eb2bedf..3e7fb6e50 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -29,17 +29,12 @@ channel_map ChannelList; std::vector<Channel *> Channel::deleting; Channel::Channel(const Anope::string &nname, time_t ts) + : name(nname) + , creation_time(ts) { if (nname.empty()) throw CoreException("A channel without a name ?"); - this->name = nname; - - this->creation_time = ts; - this->syncing = this->botchannel = false; - this->server_modetime = this->chanserv_modetime = 0; - this->server_modecount = this->chanserv_modecount = this->bouncy_modes = this->topic_ts = this->topic_time = 0; - this->ci = ChannelInfo::Find(this->name); if (this->ci) this->ci->c = this; @@ -111,7 +106,7 @@ void Channel::CheckModes() if (this->chanserv_modetime == Anope::CurTime && this->server_modetime == Anope::CurTime && this->server_modecount >= 3 && this->chanserv_modecount >= 3) { Log() << "Warning: unable to set modes on channel " << this->name << ". Are your servers' U:lines configured correctly?"; - this->bouncy_modes = 1; + this->bouncy_modes = true; return; } |