diff --git a/README.md b/README.md index 528857e..a17f0ef 100644 --- a/README.md +++ b/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 [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 personal need. It may not fit your use cases, but any and all feedback would be greatly appreciated. @@ -17,6 +22,12 @@ appreciated. 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: $ make @@ -86,6 +97,9 @@ Configuration 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` Notifications will only be sent if the number of connected IRC clients is less than this diff --git a/notifo.cpp b/notifo.cpp index a250e80..ecdb426 100644 --- a/notifo.cpp +++ b/notifo.cpp @@ -20,6 +20,11 @@ #error This module needs ZNC 0.072 or newer. #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 { protected: @@ -76,7 +81,9 @@ class CNotifoMod : public CModule defaults["secret"] = ""; // Notification conditions +#ifdef NOTIFO_AWAY defaults["away_only"] = "no"; +#endif defaults["client_count_less_than"] = "0"; defaults["idle"] = "0"; defaults["last_active"] = "180"; @@ -168,8 +175,12 @@ class CNotifoMod : public CModule */ bool away_only() { +#ifdef NOTIFO_AWAY CString value = options["away_only"].AsLower(); return value != "yes" || user->IsIRCAway(); +#else + return true +#endif } /** @@ -612,9 +623,11 @@ class CNotifoMod : public CModule table.AddColumn("Condition"); table.AddColumn("Status"); +#ifdef NOTIFO_AWAY table.AddRow(); table.SetCell("Condition", "away"); table.SetCell("Status", user->IsIRCAway() ? "yes" : "no"); +#endif table.AddRow(); table.SetCell("Condition", "client_count");