Mercurial > pidgin
comparison libpurple/plugins/tcl/tcl_cmds.c @ 15696:31a6bfedf7be
Tcl savedstatus command, again from Dossy Shiobara. Dossy is on fire.
author | Ethan Blanton <elb@pidgin.im> |
---|---|
date | Sun, 25 Feb 2007 02:48:52 +0000 |
parents | d79c9952f6bb |
children | 32c366eeeb99 |
comparison
equal
deleted
inserted
replaced
15695:79808b1a237f | 15696:31a6bfedf7be |
---|---|
27 #include "connection.h" | 27 #include "connection.h" |
28 #include "account.h" | 28 #include "account.h" |
29 #include "server.h" | 29 #include "server.h" |
30 #include "notify.h" | 30 #include "notify.h" |
31 #include "blist.h" | 31 #include "blist.h" |
32 #include "savedstatuses.h" | |
32 #include "debug.h" | 33 #include "debug.h" |
33 #include "prefs.h" | 34 #include "prefs.h" |
34 #include "core.h" | 35 #include "core.h" |
35 | 36 |
36 #include "tcl_gaim.h" | 37 #include "tcl_gaim.h" |
1272 } | 1273 } |
1273 | 1274 |
1274 return TCL_OK; | 1275 return TCL_OK; |
1275 } | 1276 } |
1276 | 1277 |
1278 int tcl_cmd_savedstatus(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) | |
1279 { | |
1280 Tcl_Obj *result = Tcl_GetObjResult(interp); | |
1281 const char *cmds[] = { "current", "handle", NULL }; | |
1282 enum { CMD_SAVEDSTATUS_CURRENT, CMD_SAVEDSTATUS_HANDLE } cmd; | |
1283 int error; | |
1284 GaimSavedStatus *saved_status; | |
1285 | |
1286 if (objc < 2) { | |
1287 Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); | |
1288 return TCL_ERROR; | |
1289 } | |
1290 | |
1291 if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) | |
1292 return error; | |
1293 | |
1294 switch (cmd) { | |
1295 case CMD_SAVEDSTATUS_CURRENT: | |
1296 if (objc != 2) { | |
1297 Tcl_WrongNumArgs(interp, 2, objv, ""); | |
1298 return TCL_ERROR; | |
1299 } | |
1300 if ((saved_status = gaim_savedstatus_get_current()) == NULL) | |
1301 return TCL_ERROR; | |
1302 Tcl_ListObjAppendElement(interp, result, Tcl_NewStringObj(gaim_savedstatus_get_title(saved_status), -1)); | |
1303 Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj(gaim_savedstatus_get_type(saved_status))); | |
1304 Tcl_ListObjAppendElement(interp, result, Tcl_NewStringObj(gaim_savedstatus_get_message(saved_status), -1)); | |
1305 break; | |
1306 case CMD_SAVEDSTATUS_HANDLE: | |
1307 if (objc != 2) { | |
1308 Tcl_WrongNumArgs(interp, 2, objv, ""); | |
1309 return TCL_ERROR; | |
1310 } | |
1311 Tcl_SetIntObj(result, (int)gaim_savedstatuses_get_handle()); | |
1312 break; | |
1313 } | |
1314 | |
1315 return TCL_OK; | |
1316 } | |
1317 | |
1277 int tcl_cmd_send_im(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) | 1318 int tcl_cmd_send_im(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) |
1278 { | 1319 { |
1279 GaimConnection *gc; | 1320 GaimConnection *gc; |
1280 char *who, *text; | 1321 char *who, *text; |
1281 | 1322 |