aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorGravatar Sadie Powell2021-03-30 18:48:16 +0100
committerGravatar Sadie Powell2021-03-30 19:05:21 +0100
commitd121f8d4cfdd422c0cff2201bd344d4ad3027878 (patch)
treebabccb9a51259412694b8c51968186318f1e343a /include
parentFix a compiler warning caused by an unused variable. (diff)
Fix the setter and set time of list modes being lost on netburst.
Closes #1812.
Diffstat (limited to 'include')
-rw-r--r--include/modechange.h25
1 files changed, 22 insertions, 3 deletions
diff --git a/include/modechange.h b/include/modechange.h
index 3b02b0dd6..1bd0cd053 100644
--- a/include/modechange.h
+++ b/include/modechange.h
@@ -33,18 +33,36 @@ struct Modes::Change
bool adding;
ModeHandler* mh;
std::string param;
+ std::optional<std::string> set_by;
+ std::optional<time_t> set_at;
/**
* @param handler Mode handler
* @param add True if this mode is being set, false if removed
* @param parameter Mode parameter
*/
- Change(ModeHandler* handler, bool add, const std::string& parameter)
+ Change(ModeHandler* handler, bool add, const std::string& parameter = "")
: adding(add)
, mh(handler)
, param(parameter)
{
}
+
+ /**
+ * @param handler Mode handler
+ * @param add True if this mode is being set, false if removed
+ * @param parameter Mode parameter
+ * @param setby Who the mode change was originally performed by.
+ * @param setat When the mode change was originally made.
+ */
+ Change(ModeHandler* handler, bool add, const std::string& parameter, const std::string& setby, time_t setat)
+ : adding(add)
+ , mh(handler)
+ , param(parameter)
+ , set_by(setby)
+ , set_at(setat)
+ {
+ }
};
/** A list of mode changes that can be applied on a Channel or User
@@ -76,9 +94,10 @@ class Modes::ChangeList
* @param adding True if this mode is being set, false if removed
* @param param Mode parameter
*/
- void push(ModeHandler* mh, bool adding, const std::string& param = std::string())
+ template <typename... Args>
+ void push(Args&&... args)
{
- items.push_back(Change(mh, adding, param));
+ items.emplace_back(std::forward<Args>(args)...);
}
/** Add a new mode to this ChangeList which will be set on the target