From e2f4bf3a135e6b23fea21b2628c2c830de29cdec Mon Sep 17 00:00:00 2001 From: w00t Date: Sun, 30 Mar 2008 14:26:01 +0000 Subject: Merge OnCancelAway and OnSetAway, add param awaymsg to OnSetAway (blank when cancelling), and change return type to int so modules can block away messages by returning nonzero. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9223 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_spanningtree/main.cpp | 29 +++++++++++++++-------------- src/modules/m_spanningtree/main.h | 3 +-- 2 files changed, 16 insertions(+), 16 deletions(-) (limited to 'src/modules') diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index b37edf583..84771901e 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -52,7 +52,7 @@ ModuleSpanningTree::ModuleSpanningTree(InspIRCd* Me) I_OnUserJoin, I_OnChangeHost, I_OnChangeName, I_OnUserPart, I_OnPostConnect, I_OnUserQuit, I_OnUserPostNick, I_OnUserKick, I_OnRemoteKill, I_OnRehash, I_OnOper, I_OnAddLine, I_OnDelLine, I_ProtoSendMode, I_OnMode, - I_OnStats, I_ProtoSendMetaData, I_OnEvent, I_OnSetAway, I_OnCancelAway, I_OnPostCommand + I_OnStats, I_ProtoSendMetaData, I_OnEvent, I_OnSetAway, I_OnPostCommand }; ServerInstance->Modules->Attach(eventlist, this, 29); @@ -817,24 +817,25 @@ void ModuleSpanningTree::OnMode(User* user, void* dest, int target_type, const s } } -void ModuleSpanningTree::OnSetAway(User* user) +int ModuleSpanningTree::OnSetAway(User* user, const std::string &awaymsg) { if (IS_LOCAL(user)) { - std::deque params; - params.push_back(":"+std::string(user->awaymsg)); - Utils->DoOneToMany(user->uuid,"AWAY",params); + if (awaymsg.empty()) + { + std::deque params; + params.clear(); + Utils->DoOneToMany(user->uuid,"AWAY",params); + } + else + { + std::deque params; + params.push_back(":" + awaymsg); + Utils->DoOneToMany(user->uuid,"AWAY",params); + } } -} -void ModuleSpanningTree::OnCancelAway(User* user) -{ - if (IS_LOCAL(user)) - { - std::deque params; - params.clear(); - Utils->DoOneToMany(user->uuid,"AWAY",params); - } + return 0; } void ModuleSpanningTree::ProtoSendMode(void* opaque, int target_type, void* target, const std::string &modeline) diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h index a3d249a51..cfdec9131 100644 --- a/src/modules/m_spanningtree/main.h +++ b/src/modules/m_spanningtree/main.h @@ -173,8 +173,7 @@ class ModuleSpanningTree : public Module virtual void OnDelLine(User *u, XLine *x); virtual void OnMode(User* user, void* dest, int target_type, const std::string &text); virtual int OnStats(char statschar, User* user, string_list &results); - virtual void OnSetAway(User* user); - virtual void OnCancelAway(User* user); + virtual int OnSetAway(User* user, const std::string &awaymsg); virtual void ProtoSendMode(void* opaque, int target_type, void* target, const std::string &modeline); virtual void ProtoSendMetaData(void* opaque, int target_type, void* target, const std::string &extname, const std::string &extdata); virtual void OnEvent(Event* event); -- cgit v1.2.3