comparison 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
comparison
equal deleted inserted replaced
15686:7639029f1bf4 15687:d79c9952f6bb
910 gaim_notify_message(_tcl_plugin, optind[type], title, msg1, msg2, NULL, NULL); 910 gaim_notify_message(_tcl_plugin, optind[type], title, msg1, msg2, NULL, NULL);
911 911
912 return TCL_OK; 912 return TCL_OK;
913 } 913 }
914 914
915 int tcl_cmd_plugins(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
916 {
917 Tcl_Obj *result = Tcl_GetObjResult(interp);
918 const char *cmds[] = { "handle", NULL };
919 enum { CMD_PLUGINS_HANDLE } cmd;
920 int error;
921
922 if (objc < 2) {
923 Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?");
924 return TCL_ERROR;
925 }
926
927 if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK)
928 return error;
929
930 switch (cmd) {
931 case CMD_PLUGINS_HANDLE:
932 if (objc != 2) {
933 Tcl_WrongNumArgs(interp, 2, objv, "");
934 return TCL_ERROR;
935 }
936 Tcl_SetIntObj(result, (int)gaim_plugins_get_handle());
937 break;
938 }
939
940 return TCL_OK;
941 }
942
915 int tcl_cmd_prefs(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) 943 int tcl_cmd_prefs(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
916 { 944 {
917 Tcl_Obj *result, *list, *elem, **elems; 945 Tcl_Obj *result, *list, *elem, **elems;
918 const char *cmds[] = { "get", "set", "type", NULL }; 946 const char *cmds[] = { "get", "set", "type", NULL };
919 enum { CMD_PREFS_GET, CMD_PREFS_SET, CMD_PREFS_TYPE } cmd; 947 enum { CMD_PREFS_GET, CMD_PREFS_SET, CMD_PREFS_TYPE } cmd;