Mercurial > pidgin.yaz
diff libpurple/plugins/tcl/tcl_cmds.c @ 15687:d79c9952f6bb
gaim::plugin Tcl command, thanks to Dossy Shiobara
author | Ethan Blanton <elb@pidgin.im> |
---|---|
date | Fri, 23 Feb 2007 16:49:32 +0000 |
parents | 5fe8042783c1 |
children | 31a6bfedf7be |
line wrap: on
line diff
--- a/libpurple/plugins/tcl/tcl_cmds.c Fri Feb 23 16:45:42 2007 +0000 +++ b/libpurple/plugins/tcl/tcl_cmds.c Fri Feb 23 16:49:32 2007 +0000 @@ -912,6 +912,34 @@ return TCL_OK; } +int tcl_cmd_plugins(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) +{ + Tcl_Obj *result = Tcl_GetObjResult(interp); + const char *cmds[] = { "handle", NULL }; + enum { CMD_PLUGINS_HANDLE } cmd; + int error; + + if (objc < 2) { + Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); + return TCL_ERROR; + } + + if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) + return error; + + switch (cmd) { + case CMD_PLUGINS_HANDLE: + if (objc != 2) { + Tcl_WrongNumArgs(interp, 2, objv, ""); + return TCL_ERROR; + } + Tcl_SetIntObj(result, (int)gaim_plugins_get_handle()); + break; + } + + return TCL_OK; +} + int tcl_cmd_prefs(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { Tcl_Obj *result, *list, *elem, **elems;