Permalink
Browse files

Added support for bind msg/msgm.

  • Loading branch information...
blackwind committed Apr 16, 2012
1 parent c48a686 commit 100cb2c7e3c0f27d0edffa7df1da3405d99b1378
Showing with 14 additions and 0 deletions.
  1. +14 −0 modules/modtcl.cpp
View
@@ -79,6 +79,7 @@ class CModTcl : public CModule {
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 @@ class CModTcl : public CModule {
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<CChan*>& vChans) {
CString sOldNick = TclEscape(CString(OldNick.GetNick()));
CString sNewNickTmp = TclEscape(sNewNick);

0 comments on commit 100cb2c

Please sign in to comment.