summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2021-03-09 10:26:19 +0000
committerSadie Powell <sadie@witchery.services>2021-03-09 10:27:53 +0000
commitba501ffb59ec5b147bfdcdc89a20b6ed2acaba70 (patch)
treefed47fc5f19e8e7a487a50bc7e5136e253a80b2d
parentb3449b8763139602efc568f46631299476d5979f (diff)
Add a human-readable version of the cloak list.
-rw-r--r--src/modules/m_cloaking.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp
index 1e266908c..b964dedca 100644
--- a/src/modules/m_cloaking.cpp
+++ b/src/modules/m_cloaking.cpp
@@ -81,13 +81,25 @@ struct CloakInfo
typedef std::vector<std::string> CloakList;
-/** Handles user mode +x
- */
+class CloakExtItem : public SimpleExtItem<CloakList>
+{
+ public:
+ CloakExtItem(Module* Creator)
+ : SimpleExtItem("cloaks", ExtensionItem::EXT_USER, Creator)
+ {
+ }
+
+ std::string ToHuman(const Extensible* container, void* item) const override
+ {
+ return stdalgo::string::join(*static_cast<CloakList*>(item), ' ');
+ }
+};
+
class CloakUser : public ModeHandler
{
public:
bool active;
- SimpleExtItem<CloakList> ext;
+ CloakExtItem ext;
std::string debounce_uid;
time_t debounce_ts;
int debounce_count;
@@ -95,7 +107,7 @@ class CloakUser : public ModeHandler
CloakUser(Module* source)
: ModeHandler(source, "cloak", 'x', PARAM_NONE, MODETYPE_USER)
, active(false)
- , ext("cloaked_host", ExtensionItem::EXT_USER, source)
+ , ext(source)
, debounce_ts(0)
, debounce_count(0)
{