Update modtcl -> adding GetServerName function and network varia… (#1658)

Update modtcl -> adding GetServerName function and network variable with network name value.

Modification to have the variable ::network such as an eggdrop.

Example usage:
<MalaGaM> return $network
<*modtcl> artis
<MalaGaM> return $::network
<*modtcl> artis
<MalaGaM> return [GetServerName]
<*modtcl> artis
This commit is contained in:
MalaGaM @ ARTiSPRETiS
2019-05-19 09:33:23 +02:00
committed by Alexey Sokolov
parent 09a514ba02
commit d7c5eecfe5
2 changed files with 10 additions and 0 deletions

View File

@@ -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<CModTcl*>(cd);
Tcl_SetResult(irp, (char*)mod->GetNetwork()->GetName().c_str(),
TCL_VOLATILE);
return TCL_OK;
}
static int tcl_GetRealName STDVAR {
CModTcl* mod = static_cast<CModTcl*>(cd);
Tcl_SetResult(irp, (char*)mod->GetUser()->GetRealName().c_str(),

View File

@@ -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}