From d7c5eecfe5cf35fa40c3a36ba34a5a359465a7de Mon Sep 17 00:00:00 2001 From: "MalaGaM @ ARTiSPRETiS" Date: Sun, 19 May 2019 09:33:23 +0200 Subject: [PATCH] =?UTF-8?q?Update=20modtcl=20->=20adding=20GetServerName?= =?UTF-8?q?=20function=20and=20network=20varia=E2=80=A6=20(#1658)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update modtcl -> adding GetServerName function and network variable with network name value. Modification to have the variable ::network such as an eggdrop. Example usage: return $network <*modtcl> artis return $::network <*modtcl> artis return [GetServerName] <*modtcl> artis --- modules/modtcl.cpp | 9 +++++++++ modules/modtcl/modtcl.tcl | 1 + 2 files changed, 10 insertions(+) diff --git a/modules/modtcl.cpp b/modules/modtcl.cpp index 8a3452d3..4f3900b7 100644 --- a/modules/modtcl.cpp +++ b/modules/modtcl.cpp @@ -116,6 +116,8 @@ class CModTcl : public CModule { Tcl_CreateCommand(interp, "GetCurNick", tcl_GetCurNick, this, nullptr); Tcl_CreateCommand(interp, "GetUsername", tcl_GetUsername, this, nullptr); + Tcl_CreateCommand(interp, "GetNetworkName", tcl_GetNetworkName, this, + nullptr); Tcl_CreateCommand(interp, "GetRealName", tcl_GetRealName, this, nullptr); Tcl_CreateCommand(interp, "GetVHost", tcl_GetBindHost, this, nullptr); @@ -305,6 +307,13 @@ class CModTcl : public CModule { return TCL_OK; } + static int tcl_GetNetworkName STDVAR { + CModTcl* mod = static_cast(cd); + Tcl_SetResult(irp, (char*)mod->GetNetwork()->GetName().c_str(), + TCL_VOLATILE); + return TCL_OK; + } + static int tcl_GetRealName STDVAR { CModTcl* mod = static_cast(cd); Tcl_SetResult(irp, (char*)mod->GetUser()->GetRealName().c_str(), diff --git a/modules/modtcl/modtcl.tcl b/modules/modtcl/modtcl.tcl index 06d0e3ea..e3f24438 100644 --- a/modules/modtcl/modtcl.tcl +++ b/modules/modtcl/modtcl.tcl @@ -34,6 +34,7 @@ set ::botnet-nick ZNC_[GetUsername] set ::botnick [GetCurNick] set ::server [GetServer] set ::server-online [expr [GetServerOnline] / 1000] +set ::network [GetNetworkName] # add some eggdrop style procs proc putlog message {PutModule $message}