Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial.

  • Loading branch information...
commit 4d158c59837d529dec9ef8e0e145ba400e3a93ca 0 parents
@kvs authored
Showing with 56 additions and 0 deletions.
  1. +27 −0 README.md
  2. +29 −0 offlinemarker.cpp
27 README.md
@@ -0,0 +1,27 @@
+# ZNC OfflineMarker
+
+A (very) simple module, which when loaded will insert a "-- MARK --" line
+in all channel-logs when a client disconnects.
+
+## Compiling and installing
+
+Run the following on the box where ZNC is installed:
+
+ $ znc-build offlinemarker.cpp
+ $ cp offlinemarker.so ~/.zsh/modules/
+
+Run the following from within your IRC program, which should be
+connected to ZNC:
+
+ /msg *status loadmod offlinemarker
+
+That's it.
+
+## Bugs/TODO
+
+* Configurable mark-message
+* Don't log until all clients have disconnected
+
+## License
+
+This project is licensed under the MIT license.
29 offlinemarker.cpp
@@ -0,0 +1,29 @@
+#include <znc/Chan.h>
+#include <znc/User.h>
+#include <znc/IRCNetwork.h>
+#include <znc/Modules.h>
+
+class COfflineMarkerMod : public CModule {
+public:
+ MODCONSTRUCTOR(COfflineMarkerMod) {}
+ virtual ~COfflineMarkerMod() {}
+
+ void AddBuffer(CChan& Channel, const CString& sMessage) {
+ // If they have keep buffer disabled, only add messages if no client is connected
+ if (!Channel.KeepBuffer() && m_pNetwork->IsUserOnline())
+ return;
+
+ Channel.AddBuffer(":" + GetModNick() + "!" + GetModName() + "@znc.in PRIVMSG " + _NAMEDFMT(Channel.GetName()) + " :{text}", sMessage);
+ }
+
+ virtual void OnClientDisconnect() {
+ // Loop through all networks, and all channels/buffers. Put a "-- MARK --" into each buffer.
+ const vector<CChan *>& vChans = m_pNetwork->GetChans();
+ vector<CChan*>::const_iterator it;
+ for (it = vChans.begin(); it != vChans.end(); ++it) {
+ AddBuffer(**it, "-- MARK --");
+ }
+ }
+};
+
+MODULEDEFS(COfflineMarkerMod, "Put a mark in all logged buffers when client disconnects.")
Please sign in to comment.
Something went wrong with that request. Please try again.