Include an info command to get info
authorKyle Fuller <redacted>
Fri, 27 Sep 2013 06:45:09 +0000 (07:45 +0100)
committerKyle Fuller <redacted>
Fri, 27 Sep 2013 12:45:33 +0000 (13:45 +0100)
palaver.cpp

index 8515bc725b36dc0c3f396c7ed20d1cf6b1178cea..fffd03710f0129be2a738f764fef4e6c6efc11b0 100644 (file)
 #include <znc/FileUtils.h>
 
 
+#ifndef PALAVER_VERSION
+       #define PALAVER_VERSION "unknown"
+#endif
+
 
 const char *kPLVCapability = "palaverapp.com";
 const char *kPLVCommand = "PALAVER";
@@ -559,6 +563,8 @@ public:
                        "", "Send notifications to registered devices");
                AddCommand("list", static_cast<CModCommand::ModCmdFunc>(&CPalaverMod::HandleListCommand),
                        "", "List all registered devices");
+               AddCommand("info", static_cast<CModCommand::ModCmdFunc>(&CPalaverMod::HandleInfoCommand),
+                       "", "Show's module information");
        }
 
        virtual bool OnLoad(const CString& sArgs, CString& sMessage) {
@@ -935,6 +941,21 @@ public:
                }
        }
 
+       void HandleInfoCommand(const CString &sLine) {
+               PutModule("Please contact support@palaverapp.com if you have any troubles with this module.");
+               PutModule("Be sure to include all information from this command so we can try and debug any issues.");
+               PutModule("--");
+
+               PutModule("Palaver ZNC: " + CString(PALAVER_VERSION) + " -- http://palaverapp.com/");
+               CDevice *pDevice = DeviceForClient(*m_pClient);
+               if (pDevice) {
+                       PutModule("Current device: (" + pDevice->GetToken() + ")");
+               }
+               PutModule(CString(m_vDevices.size()) + " registered devices");
+
+               PutStatus(CZNC::GetTag());
+               PutStatus(CZNC::GetCompileOptionsString());
+       }
 private:
 
        std::vector<CDevice*> m_vDevices;
@@ -945,3 +966,4 @@ template<> void TModInfo<CPalaverMod>(CModInfo& Info) {
 }
 
 GLOBALMODULEDEFS(CPalaverMod, "Palaver support module")
+
git clone https://git.99rst.org/PROJECT