Added setjob() command.
authorTim Potter <tpot@samba.org>
Wed, 8 May 2002 04:26:22 +0000 (04:26 +0000)
committerTim Potter <tpot@samba.org>
Wed, 8 May 2002 04:26:22 +0000 (04:26 +0000)
(This used to be commit 02c63de9e58f9806e58d3862391e05e9b9cdb8fc)

source3/python/py_spoolss.c
source3/python/py_spoolss_jobs.c
source3/python/py_spoolss_proto.h

index b1c70f9d4e120d2ea204a3e5b7154cad92502604..51e128ecc03809acac9f24abe6449ed2c48e6c89 100644 (file)
@@ -191,6 +191,9 @@ Set the form given by the dictionary argument.
         { "enumjobs", spoolss_enumjobs, METH_VARARGS | METH_KEYWORDS,
           "Enumerate jobs" },
 
+        { "setjob", spoolss_setjob, METH_VARARGS | METH_KEYWORDS,
+          "Set job command" },
+
        { NULL }
 
 };
@@ -325,6 +328,14 @@ struct spoolss_const {
        { "WERR_PRINTER_DRIVER_IN_USE", 3001 },
        { "WERR_STATUS_MORE_ENTRIES  ", 0x0105 },
 
+       /* Job control constants */
+
+       { "JOB_CONTROL_PAUSE", JOB_CONTROL_PAUSE },
+       { "JOB_CONTROL_RESUME", JOB_CONTROL_RESUME },
+       { "JOB_CONTROL_CANCEL", JOB_CONTROL_CANCEL },
+       { "JOB_CONTROL_RESTART", JOB_CONTROL_RESTART },
+       { "JOB_CONTROL_DELETE", JOB_CONTROL_DELETE },
+
        { NULL },
 };
 
index e049d82a33a5b61b4894bce80566f9ab909e3807..3e436849b16db13087672e95b4360470cecdead8 100644 (file)
@@ -84,3 +84,33 @@ PyObject *spoolss_enumjobs(PyObject *self, PyObject *args, PyObject *kw)
        Py_INCREF(result);
        return result;
 }
+
+/* Set job command */
+
+PyObject *spoolss_setjob(PyObject *self, PyObject *args, PyObject *kw)
+{
+       spoolss_policy_hnd_object *hnd = (spoolss_policy_hnd_object *)self;
+       WERROR werror;
+       PyObject *result;
+       uint32 level = 0, command, jobid;
+       static char *kwlist[] = {"jobid", "command", "level", NULL};
+
+       /* Parse parameters */
+
+       if (!PyArg_ParseTupleAndKeywords(args, kw, "ii|i", kwlist, &jobid,
+                                        &command, &level))
+               return NULL;
+       
+       /* Call rpc function */
+       
+       werror = cli_spoolss_setjob(hnd->cli, hnd->mem_ctx, &hnd->pol,
+                                   jobid, level, command);
+
+       if (!W_ERROR_IS_OK(werror)) {
+               PyErr_SetObject(spoolss_werror, py_werror_tuple(werror));
+               return NULL;
+       }
+       
+       Py_INCREF(Py_None);
+       return Py_None;
+}
index 81d34a2c2d8bc0edb605fc33ed09e2e9fd13107e..913b7822c270fdd5e7b8a39066c76a742184e442 100644 (file)
@@ -48,6 +48,7 @@ BOOL py_to_FORM(FORM *form, PyObject *dict);
 /* The following definitions come from python/py_spoolss_jobs.c  */
 
 PyObject *spoolss_enumjobs(PyObject *self, PyObject *args, PyObject *kw);
+PyObject *spoolss_setjob(PyObject *self, PyObject *args, PyObject *kw);
 
 /* The following definitions come from python/py_spoolss_jobs_conv.c  */