summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/python/py_spoolss.c13
-rw-r--r--source3/python/py_spoolss_jobs.c101
-rw-r--r--source3/python/py_spoolss_proto.h3
3 files changed, 115 insertions, 2 deletions
diff --git a/source3/python/py_spoolss.c b/source3/python/py_spoolss.c
index 51e128ecc0..323b3c3b6f 100644
--- a/source3/python/py_spoolss.c
+++ b/source3/python/py_spoolss.c
@@ -192,7 +192,18 @@ Set the form given by the dictionary argument.
"Enumerate jobs" },
{ "setjob", spoolss_setjob, METH_VARARGS | METH_KEYWORDS,
- "Set job command" },
+ "Set job information" },
+
+ { "getjob", spoolss_getjob, METH_VARARGS | METH_KEYWORDS,
+ "Get job information" },
+
+ { "startpageprinter", spoolss_startpageprinter,
+ METH_VARARGS | METH_KEYWORDS,
+ "Notify spooler that a page is about to be printed." },
+
+ { "endpageprinter", spoolss_endpageprinter,
+ METH_VARARGS | METH_KEYWORDS,
+ "Notify spooler that a page is about to be printed." },
{ NULL }
diff --git a/source3/python/py_spoolss_jobs.c b/source3/python/py_spoolss_jobs.c
index 3e436849b1..2cab6c0b28 100644
--- a/source3/python/py_spoolss_jobs.c
+++ b/source3/python/py_spoolss_jobs.c
@@ -91,7 +91,6 @@ 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};
@@ -114,3 +113,103 @@ PyObject *spoolss_setjob(PyObject *self, PyObject *args, PyObject *kw)
Py_INCREF(Py_None);
return Py_None;
}
+
+/* Get job */
+
+PyObject *spoolss_getjob(PyObject *self, PyObject *args, PyObject *kw)
+{
+ spoolss_policy_hnd_object *hnd = (spoolss_policy_hnd_object *)self;
+ WERROR werror;
+ PyObject *result;
+ uint32 level = 1, jobid, needed;
+ static char *kwlist[] = {"jobid", "level", NULL};
+ JOB_INFO_CTR ctr;
+
+ /* Parse parameters */
+
+ if (!PyArg_ParseTupleAndKeywords(args, kw, "i|i", kwlist, &jobid,
+ &level))
+ return NULL;
+
+ /* Call rpc function */
+
+ werror = cli_spoolss_getjob(hnd->cli, hnd->mem_ctx, 0, &needed,
+ &hnd->pol, jobid, level, &ctr);
+
+ if (W_ERROR_V(werror) == ERRinsufficientbuffer)
+ werror = cli_spoolss_getjob(
+ hnd->cli, hnd->mem_ctx, needed, NULL, &hnd->pol,
+ jobid, level, &ctr);
+
+ if (!W_ERROR_IS_OK(werror)) {
+ PyErr_SetObject(spoolss_werror, py_werror_tuple(werror));
+ return NULL;
+ }
+
+ switch(level) {
+ case 1:
+ py_from_JOB_INFO_1(&result, ctr.job.job_info_1);
+ break;
+ case 2:
+ py_from_JOB_INFO_2(&result, ctr.job.job_info_2);
+ break;
+ }
+
+ return result;
+}
+
+/* Start page printer. This notifies the spooler that a page is about to be
+ printed on the specified printer. */
+
+PyObject *spoolss_startpageprinter(PyObject *self, PyObject *args, PyObject *kw)
+{
+ spoolss_policy_hnd_object *hnd = (spoolss_policy_hnd_object *)self;
+ WERROR werror;
+ static char *kwlist[] = { NULL };
+
+ /* Parse parameters */
+
+ if (!PyArg_ParseTupleAndKeywords(args, kw, "", kwlist))
+ return NULL;
+
+ /* Call rpc function */
+
+ werror = cli_spoolss_startpageprinter(
+ hnd->cli, hnd->mem_ctx, &hnd->pol);
+
+ if (!W_ERROR_IS_OK(werror)) {
+ PyErr_SetObject(spoolss_werror, py_werror_tuple(werror));
+ return NULL;
+ }
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+/* End page printer. This notifies the spooler that a page has finished
+ being printed on the specified printer. */
+
+PyObject *spoolss_endpageprinter(PyObject *self, PyObject *args, PyObject *kw)
+{
+ spoolss_policy_hnd_object *hnd = (spoolss_policy_hnd_object *)self;
+ WERROR werror;
+ static char *kwlist[] = { NULL };
+
+ /* Parse parameters */
+
+ if (!PyArg_ParseTupleAndKeywords(args, kw, "", kwlist))
+ return NULL;
+
+ /* Call rpc function */
+
+ werror = cli_spoolss_endpageprinter(
+ hnd->cli, hnd->mem_ctx, &hnd->pol);
+
+ if (!W_ERROR_IS_OK(werror)) {
+ PyErr_SetObject(spoolss_werror, py_werror_tuple(werror));
+ return NULL;
+ }
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
diff --git a/source3/python/py_spoolss_proto.h b/source3/python/py_spoolss_proto.h
index 913b7822c2..bd54030551 100644
--- a/source3/python/py_spoolss_proto.h
+++ b/source3/python/py_spoolss_proto.h
@@ -49,6 +49,9 @@ BOOL py_to_FORM(FORM *form, PyObject *dict);
PyObject *spoolss_enumjobs(PyObject *self, PyObject *args, PyObject *kw);
PyObject *spoolss_setjob(PyObject *self, PyObject *args, PyObject *kw);
+PyObject *spoolss_getjob(PyObject *self, PyObject *args, PyObject *kw);
+PyObject *spoolss_startpageprinter(PyObject *self, PyObject *args, PyObject *kw);
+PyObject *spoolss_endpageprinter(PyObject *self, PyObject *args, PyObject *kw);
/* The following definitions come from python/py_spoolss_jobs_conv.c */