Permalink
Browse files

Merge commit 'refs/pull/310/head' of github.com:znc/znc

  • Loading branch information...
DarthGandalf committed Jun 20, 2013
2 parents d0a3fdd + e13fdf2 commit 25cc51ac7c75b2339accc1bdf2b05a60ddcfdab8
Showing with 17 additions and 4 deletions.
  1. +17 −4 modules/crypt.cpp
View
@@ -35,14 +35,20 @@
#include <znc/IRCNetwork.h>
#define REQUIRESSL 1
+#define NICK_PREFIX_KEY "[nick-prefix]"
class CCryptMod : public CModule {
+ CString NickPrefix() {
+ MCString::iterator it = FindNV(NICK_PREFIX_KEY);
+ return it != EndNV() ? it->second : "*";
+ }
+
public:
MODCONSTRUCTOR(CCryptMod) {}
virtual ~CCryptMod() {}
virtual EModRet OnUserMsg(CString& sTarget, CString& sMessage) {
- sTarget.TrimLeft("\244");
+ sTarget.TrimLeft(NickPrefix());
if (sMessage.Left(2) == "``") {
sMessage.LeftChomp(2);
@@ -55,8 +61,8 @@ class CCryptMod : public CModule {
CChan* pChan = m_pNetwork->FindChan(sTarget);
if (pChan) {
if (!pChan->AutoClearChanBuffer())
- pChan->AddBuffer(":\244" + _NAMEDFMT(m_pNetwork->GetIRCNick().GetNickMask()) + " PRIVMSG " + _NAMEDFMT(sTarget) + " :" + _NAMEDFMT(sMessage));
- m_pUser->PutUser(":\244" + m_pNetwork->GetIRCNick().GetNickMask() + " PRIVMSG " + sTarget + " :" + sMessage, NULL, m_pClient);
+ pChan->AddBuffer(":" + NickPrefix() + _NAMEDFMT(m_pNetwork->GetIRCNick().GetNickMask()) + " PRIVMSG " + _NAMEDFMT(sTarget) + " :{text}", sMessage);
+ m_pUser->PutUser(":" + NickPrefix() + m_pNetwork->GetIRCNick().GetNickMask() + " PRIVMSG " + sTarget + " :" + sMessage, NULL, m_pClient);
}
CString sMsg = MakeIvec() + sMessage;
@@ -91,7 +97,7 @@ class CCryptMod : public CModule {
sMessage.Decrypt(it->second);
sMessage.LeftChomp(8);
sMessage = sMessage.c_str();
- Nick.SetNick("\244" + Nick.GetNick());
+ Nick.SetNick(NickPrefix() + Nick.GetNick());
}
}
@@ -139,6 +145,13 @@ class CCryptMod : public CModule {
Table.SetCell("Key", it->second);
}
+ MCString::iterator it = FindNV(NICK_PREFIX_KEY);
+ if (it == EndNV()) {
+ Table.AddRow();
+ Table.SetCell("Target", NICK_PREFIX_KEY);
+ Table.SetCell("Key", NickPrefix());
+ }
+
PutModule(Table);
}
} else if (sCmd.Equals("HELP")) {

0 comments on commit 25cc51a

Please sign in to comment.