1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-07 10:13:12 +02:00

Add function to get plugin name (return "core" for WeeChat core)

This commit is contained in:
Sebastien Helleu
2008-10-08 19:04:05 +02:00
parent 0e053e072b
commit 5d07aa14ed
16 changed files with 435 additions and 245 deletions
+36
View File
@@ -219,6 +219,40 @@ weechat_tcl_api_register (ClientData clientData, Tcl_Interp *interp, int objc,
TCL_RETURN_OK;
}
/*
* weechat::plugin_get_name: get name of plugin (return "core" for WeeChat core)
*/
static int
weechat_tcl_api_plugin_get_name (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj* objp;
char *result, *plugin;
int i;
/* make C compiler happy */
(void) clientData;
if (!tcl_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("plugin_get_name");
TCL_RETURN_EMPTY;
}
if (objc < 2)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("plugin_get_name");
TCL_RETURN_EMPTY;
}
plugin = Tcl_GetStringFromObj (objv[1], &i);
result = weechat_plugin_get_name (script_str2ptr (plugin));
TCL_RETURN_STRING(result);
}
/*
* weechat::charset_set: set script charset
*/
@@ -4951,6 +4985,8 @@ void weechat_tcl_api_init (Tcl_Interp *interp) {
/* interface functions */
Tcl_CreateObjCommand (interp,"weechat::register",
weechat_tcl_api_register, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp,"weechat::plugin_get_name",
weechat_tcl_api_plugin_get_name, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp,"weechat::charset_set",
weechat_tcl_api_charset_set, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp,"weechat::iconv_to_internal",