Permalink
Browse files

simple_away: check if the network is attached instead of the user

Also make simple_away a network module, so that when the timer fires we
have a network to send the AWAY lines

Fixes #77
  • Loading branch information...
1 parent 9c86f08 commit a8cb7697cf3d1cf4da607106632c581dcf0353e5 @kylef kylef committed Oct 19, 2011
Showing with 4 additions and 3 deletions.
  1. +4 −3 modules/simple_away.cpp
View
@@ -7,6 +7,7 @@
*/
#include <znc/User.h>
+#include <znc/IRCNetwork.h>
#define SIMPLE_AWAY_DEFAULT_REASON "Auto away at %s"
#define SIMPLE_AWAY_DEFAULT_TIME 60
@@ -73,7 +74,7 @@ class CSimpleAway : public CModule {
}
virtual void OnIRCConnected() {
- if (m_pUser->IsUserAttached())
+ if (m_pNetwork->IsUserAttached())
SetBack();
else
SetAway(false);
@@ -85,7 +86,7 @@ class CSimpleAway : public CModule {
virtual void OnClientDisconnect() {
/* There might still be other clients */
- if (!m_pUser->IsUserAttached())
+ if (!m_pNetwork->IsUserAttached())
SetAway();
}
@@ -220,4 +221,4 @@ template<> void TModInfo<CSimpleAway>(CModInfo& Info) {
Info.SetWikiPage("simple_away");
}
-MODULEDEFS(CSimpleAway, "Auto away when last client disconnects")
+NETWORKMODULEDEFS(CSimpleAway, "Auto away when last client disconnects")

0 comments on commit a8cb769

Please sign in to comment.