From 100cb2c7e3c0f27d0edffa7df1da3405d99b1378 Mon Sep 17 00:00:00 2001 From: blackwind Date: Mon, 16 Apr 2012 05:11:40 -0600 Subject: [PATCH] Added support for bind msg/msgm. --- modules/modtcl.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/modules/modtcl.cpp b/modules/modtcl.cpp index 9b3d913c..6d5179fc 100644 --- a/modules/modtcl.cpp +++ b/modules/modtcl.cpp @@ -79,6 +79,7 @@ public: interp = Tcl_CreateInterp(); Tcl_Init(interp); Tcl_CreateCommand(interp, "Binds::ProcessPubm", tcl_Bind, this, NULL); + Tcl_CreateCommand(interp, "Binds::ProcessMsgm", tcl_Bind, this, NULL); Tcl_CreateCommand(interp, "Binds::ProcessTime", tcl_Bind, this, NULL); Tcl_CreateCommand(interp, "Binds::ProcessEvnt", tcl_Bind, this, NULL); Tcl_CreateCommand(interp, "Binds::ProcessNick", tcl_Bind, this, NULL); @@ -186,6 +187,19 @@ public: return CONTINUE; } + virtual EModRet OnPrivMsg(CNick& Nick, CString& sMessage) { + CString sMes = TclEscape(sMessage); + CString sNick = TclEscape(CString(Nick.GetNick())); + CString sHost = TclEscape(CString(Nick.GetIdent() + "@" + Nick.GetHost())); + + CString sCommand = "Binds::ProcessMsgm {" + sNick + "} {" + sHost + "} - {" + sMes + "}"; + i = Tcl_Eval(interp, sCommand.c_str()); + if (i != TCL_OK) { + PutModule(Tcl_GetStringResult(interp)); + } + return CONTINUE; + } + virtual void OnNick(const CNick& OldNick, const CString& sNewNick, const vector& vChans) { CString sOldNick = TclEscape(CString(OldNick.GetNick())); CString sNewNickTmp = TclEscape(sNewNick);