mirror of https://github.com/SeanOMik/znc-push.git
Fix #191: ZNC < 0.090 does not support IsIRCAway()
To maintain compatibility with ZNC < 0.090 (such as 0.078 used by Ubuntu), we need to conditionally disable the away_only condition when compiled against versions that don't support CUser->IsIRCAway().
This commit is contained in:
parent
de4c84a36b
commit
d4fd3ce741
14
README.md
14
README.md
|
@ -9,6 +9,11 @@ for everyday usage. Users are more than welcome to submit feature requests or p
|
||||||
discussion or inclusion. Bug reports and feature requests can be submitted to
|
discussion or inclusion. Bug reports and feature requests can be submitted to
|
||||||
[my bug tracker][mantis] or sent via email.
|
[my bug tracker][mantis] or sent via email.
|
||||||
|
|
||||||
|
For full functionality, this module requires ZNC version 0.090 or newer, but should compile
|
||||||
|
and run with a reduced feature set on versions as old as 0.078, the current version used by
|
||||||
|
Ubuntu. However, development and testing is done exclusively against the latest source
|
||||||
|
distribution, so feedback on older releases of ZNC is needed to continue supporting them.
|
||||||
|
|
||||||
ZNC to Notifo was created by [John Reese](http://johnmreese.com) and designed to fill a
|
ZNC to Notifo was created by [John Reese](http://johnmreese.com) and designed to fill a
|
||||||
personal need. It may not fit your use cases, but any and all feedback would be greatly
|
personal need. It may not fit your use cases, but any and all feedback would be greatly
|
||||||
appreciated.
|
appreciated.
|
||||||
|
@ -17,6 +22,12 @@ appreciated.
|
||||||
Compiling
|
Compiling
|
||||||
---------
|
---------
|
||||||
|
|
||||||
|
If you have installed ZNC from a Linux distribution's repository, you will most likely
|
||||||
|
need to install the development package before building this module. On Ubuntu, this can
|
||||||
|
be installed with:
|
||||||
|
|
||||||
|
$ sudo aptitude install znc-dev
|
||||||
|
|
||||||
If you have `make` installed, you can compile the module with:
|
If you have `make` installed, you can compile the module with:
|
||||||
|
|
||||||
$ make
|
$ make
|
||||||
|
@ -86,6 +97,9 @@ Configuration
|
||||||
|
|
||||||
If set to "yes", notifications will only be sent if the user has set their `/away` status.
|
If set to "yes", notifications will only be sent if the user has set their `/away` status.
|
||||||
|
|
||||||
|
This condition requires version 0.090 of ZNC to operate, and will be disabled when
|
||||||
|
compiled against older versions.
|
||||||
|
|
||||||
* `client_count_less_than = 0`
|
* `client_count_less_than = 0`
|
||||||
|
|
||||||
Notifications will only be sent if the number of connected IRC clients is less than this
|
Notifications will only be sent if the number of connected IRC clients is less than this
|
||||||
|
|
13
notifo.cpp
13
notifo.cpp
|
@ -20,6 +20,11 @@
|
||||||
#error This module needs ZNC 0.072 or newer.
|
#error This module needs ZNC 0.072 or newer.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Handle versions of ZNC older than 0.090 by disabling the away_only condition
|
||||||
|
#if VERSION_MAJOR == 0 && VERSION_MINOR >= 90
|
||||||
|
#define NOTIFO_AWAY
|
||||||
|
#endif
|
||||||
|
|
||||||
class CNotifoMod : public CModule
|
class CNotifoMod : public CModule
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
@ -76,7 +81,9 @@ class CNotifoMod : public CModule
|
||||||
defaults["secret"] = "";
|
defaults["secret"] = "";
|
||||||
|
|
||||||
// Notification conditions
|
// Notification conditions
|
||||||
|
#ifdef NOTIFO_AWAY
|
||||||
defaults["away_only"] = "no";
|
defaults["away_only"] = "no";
|
||||||
|
#endif
|
||||||
defaults["client_count_less_than"] = "0";
|
defaults["client_count_less_than"] = "0";
|
||||||
defaults["idle"] = "0";
|
defaults["idle"] = "0";
|
||||||
defaults["last_active"] = "180";
|
defaults["last_active"] = "180";
|
||||||
|
@ -168,8 +175,12 @@ class CNotifoMod : public CModule
|
||||||
*/
|
*/
|
||||||
bool away_only()
|
bool away_only()
|
||||||
{
|
{
|
||||||
|
#ifdef NOTIFO_AWAY
|
||||||
CString value = options["away_only"].AsLower();
|
CString value = options["away_only"].AsLower();
|
||||||
return value != "yes" || user->IsIRCAway();
|
return value != "yes" || user->IsIRCAway();
|
||||||
|
#else
|
||||||
|
return true
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -612,9 +623,11 @@ class CNotifoMod : public CModule
|
||||||
table.AddColumn("Condition");
|
table.AddColumn("Condition");
|
||||||
table.AddColumn("Status");
|
table.AddColumn("Status");
|
||||||
|
|
||||||
|
#ifdef NOTIFO_AWAY
|
||||||
table.AddRow();
|
table.AddRow();
|
||||||
table.SetCell("Condition", "away");
|
table.SetCell("Condition", "away");
|
||||||
table.SetCell("Status", user->IsIRCAway() ? "yes" : "no");
|
table.SetCell("Status", user->IsIRCAway() ? "yes" : "no");
|
||||||
|
#endif
|
||||||
|
|
||||||
table.AddRow();
|
table.AddRow();
|
||||||
table.SetCell("Condition", "client_count");
|
table.SetCell("Condition", "client_count");
|
||||||
|
|
Loading…
Reference in New Issue