From ba23c2b115ad3bf2632179d283165c1579332fd8 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Sun, 12 Aug 2018 14:56:27 +0100 Subject: Convert AWAY to use cross-module events and clean up slightly. OnSetAway has been replaced with four events. OnUserPreAway and OnUserPreBack can be used to deny an away state change and/or change the away message of a local user. OnUserAway and OnUserBack allow modules to be notified that a user's away state has changed. --- src/modules/m_spanningtree/main.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/modules/m_spanningtree/main.cpp') diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index c7e55c66c..3c9089115 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -37,7 +37,8 @@ #include "translate.h" ModuleSpanningTree::ModuleSpanningTree() - : Stats::EventListener(this) + : Away::EventListener(this) + , Stats::EventListener(this) , rconnect(this) , rsquit(this) , map(this) @@ -718,12 +719,16 @@ void ModuleSpanningTree::OnDelLine(User* user, XLine *x) params.Broadcast(); } -ModResult ModuleSpanningTree::OnSetAway(User* user, const std::string &awaymsg) +void ModuleSpanningTree::OnUserAway(User* user) { if (IS_LOCAL(user)) - CommandAway::Builder(user, awaymsg).Broadcast(); + CommandAway::Builder(user).Broadcast(); +} - return MOD_RES_PASSTHRU; +void ModuleSpanningTree::OnUserBack(User* user) +{ + if (IS_LOCAL(user)) + CommandAway::Builder(user).Broadcast(); } void ModuleSpanningTree::OnMode(User* source, User* u, Channel* c, const Modes::ChangeList& modes, ModeParser::ModeProcessFlag processflags, const std::string& output_mode) -- cgit v1.3.1-10-gc9f91