diff options
author | Rasmus Eskola <fruitiex@gmail.com> | 2013-08-09 00:03:14 +0300 |
---|---|---|
committer | Rasmus Eskola <fruitiex@gmail.com> | 2013-08-09 00:03:14 +0300 |
commit | d9920d9dca267720f8fa7b67b27ce190dac84f7e (patch) | |
tree | 2244d359be0f74a7e7ec512cba06fa489a6d5256 /backlog.cpp | |
parent | 7191fca5b7ca651bc8df660c2a67f7f0dcd0059e (diff) |
take in a file path as command and echo the file's contents
Diffstat (limited to 'backlog.cpp')
-rw-r--r-- | backlog.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/backlog.cpp b/backlog.cpp index 1d44a1e..219e1ec 100644 --- a/backlog.cpp +++ b/backlog.cpp @@ -14,6 +14,7 @@ * limitations under the License. */ +#include <znc/FileUtils.h> #include <znc/Client.h> #include <znc/Chan.h> #include <znc/Modules.h> @@ -44,12 +45,26 @@ public: virtual void OnModCommand(const CString& sCommand) { + /* if (sCommand.Equals("TIMERS")) { ListTimers(); } - } + */ + // TODO: sanity check on file path, see log.cpp + + CFile LogFile(sCommand); + CString Line; - + if (LogFile.Open()) { + while (LogFile.ReadLine(Line)) { + PutModule(Line); + } + } else { + PutModule("Could not open log file"); // [" << sCommand << "]: " << strerror(errno)); + } + + LogFile.Close(); + } }; template<> void TModInfo<CBacklogMod>(CModInfo& Info) { |