To create new wiki account, please join us on #znc at Libera.Chat and ask admins to create a wiki account for you. You can say thanks to spambots for this inconvenience.
Version: Difference between revisions
Jump to navigation
Jump to search
>Nero Created page with "{{External Module}} Stores CTCP Replies and compares them with older ones for recognizing Users on IRC == Usage == Just do an CTCP VERSION request on other Users, *version wil..." |
>Nero No edit summary |
||
Line 12: | Line 12: | ||
*list <search term> | *list <search term> | ||
Searches for substring in List or Lists all | Searches for substring in List or Lists all | ||
===Example=== | |||
<pre> | |||
[18:45:04] >draggy< CTCP VERSION | |||
[18:45:05] <*version> (notice) VERSION: fsb wee | |||
[18:45:05] <draggy> (notice) VERSION irssi v0.8.15 | |||
</pre> | |||
== Sourcecode == | == Sourcecode == | ||
<pre>/* | <pre>/* | ||
* Fuck that Copyright shit. Here is your Code. Do what you want. | * Fuck that Copyright shit. Here is your Code. Do what you want. | ||
* Made by Nero | * Made by [[User:Nero]] | ||
*/ | */ | ||
Line 49: | Line 55: | ||
virtual EModRet OnStatusCommand(CString& sCommand) { | virtual EModRet OnStatusCommand(CString& sCommand) { | ||
CString sCmdName = sCommand.Token(0).AsLower(); | CString sCmdName = sCommand.Token(0).AsLower(); | ||
if (sCmdName == "rdata") { | if (sCmdName == "rdata") { // If other Modueles are requesting a VERSION string | ||
CString sName = sCommand.Token(1).AsLower(); | CString sName = sCommand.Token(1).AsLower(); | ||
sCommand = GetNV(sName); | sCommand = GetNV(sName); |
Revision as of 16:45, 24 August 2012
This is an external module. Please note that it may or may not work with the current release (1.9.1). This module is not included in the default ZNC installation, and you will need to manually compile it before you can load this module. Contact the author if you have any questions, but feel free to ask in #znc on Libera.Chat. Someone might be able to help you there. |
Stores CTCP Replies and compares them with older ones for recognizing Users on IRC
Usage
Just do an CTCP VERSION request on other Users, *version will add an notice if the reply is know from formerly requests.
Commands
- get <name>
Gets the stored Version of an user (Case insensitive)
- del <name>
Deletes above
- clear
Deletes all
- list <search term>
Searches for substring in List or Lists all
Example
[18:45:04] >draggy< CTCP VERSION [18:45:05] <*version> (notice) VERSION: fsb wee [18:45:05] <draggy> (notice) VERSION irssi v0.8.15
Sourcecode
/* * Fuck that Copyright shit. Here is your Code. Do what you want. * Made by [[User:Nero]] */ #include "User.h" #include "Nick.h" class CVersion : public CModule { public: MODCONSTRUCTOR(CVersion) { } virtual ~CVersion() { } virtual EModRet OnCTCPReply(CNick& Nick, CString& sMessage) { if (sMessage.Equals("VERSION", false, 7)) { SetNV(Nick.GetNick().AsLower(),sMessage); CString sNicks = ""; for (MCString::iterator it = BeginNV(); it != EndNV(); ++it) { if ((it->second).AsLower() == sMessage.AsLower() && it->first != Nick.GetNick().AsLower()) sNicks = sNicks + it->first + " "; } if (sNicks.size()>2) { PutModNotice("VERSION: " + sNicks); } } return CONTINUE; } virtual EModRet OnStatusCommand(CString& sCommand) { CString sCmdName = sCommand.Token(0).AsLower(); if (sCmdName == "rdata") { // If other Modueles are requesting a VERSION string CString sName = sCommand.Token(1).AsLower(); sCommand = GetNV(sName); return HALT; } return CONTINUE; } virtual void OnModCommand(const CString& sCommand) { CString sCmdName = sCommand.Token(0).AsLower(); CString sArg = sCommand.Token(1,true).AsLower(); if (sCmdName == "del") { DelNV(sCommand.Token(1).AsLower()); PutModule("Deleted " + sCommand.Token(1)); } else if (sCmdName == "get") { PutModule(GetNV(sArg)); PutModule("--- End of List"); } else if (sCmdName == "clear") { int i = 0; for (MCString::iterator it = BeginNV(); it != EndNV(); ++it) { DelNV(it->first); i++; } PutModule(CString(i) + " entries deleted"); } else if (sCmdName == "list") { for (MCString::iterator it = BeginNV(); it != EndNV(); ++it) { if ((it->second).AsLower().find(sArg) != CString::npos || sArg.empty()) PutModule("\002" + it->first + "\002: " + it->second); } PutModule("--- End of List"); } else { PutModule("Commands: del <name>, get <name>, list, clear"); } } }; MODULEDEFS(CVersion, "Stores VERSION-Replies")