summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/python/py_spoolss.c4
-rw-r--r--source3/python/py_spoolss_jobs.c31
-rw-r--r--source3/python/py_spoolss_proto.h1
3 files changed, 36 insertions, 0 deletions
diff --git a/source3/python/py_spoolss.c b/source3/python/py_spoolss.c
index b209e6243b..ef61d02db6 100644
--- a/source3/python/py_spoolss.c
+++ b/source3/python/py_spoolss.c
@@ -225,6 +225,10 @@ Set the form given by the dictionary argument.
METH_VARARGS | METH_KEYWORDS,
"Notify spooler that a document is about to be printed." },
+ { "writeprinter", (PyCFunction)spoolss_writeprinter,
+ METH_VARARGS | METH_KEYWORDS,
+ "Write job data to a printer." },
+
/* Printer data */
{ "getprinterdata", (PyCFunction)spoolss_getprinterdata,
diff --git a/source3/python/py_spoolss_jobs.c b/source3/python/py_spoolss_jobs.c
index 3d2295b88e..6951ebab9a 100644
--- a/source3/python/py_spoolss_jobs.c
+++ b/source3/python/py_spoolss_jobs.c
@@ -349,3 +349,34 @@ PyObject *spoolss_enddocprinter(PyObject *self, PyObject *args, PyObject *kw)
Py_INCREF(Py_None);
return Py_None;
}
+
+/* Write data to a printer */
+
+PyObject *spoolss_writeprinter(PyObject *self, PyObject *args, PyObject *kw)
+{
+ spoolss_policy_hnd_object *hnd = (spoolss_policy_hnd_object *)self;
+ WERROR werror;
+ static char *kwlist[] = { "data", NULL };
+ PyObject *data;
+ uint32 num_written;
+
+ /* Parse parameters */
+
+ if (!PyArg_ParseTupleAndKeywords(args, kw, "O!", kwlist,
+ &PyString_Type, &data))
+ return NULL;
+
+ /* Call rpc function */
+
+ werror = cli_spoolss_writeprinter(
+ hnd->cli, hnd->mem_ctx, &hnd->pol, PyString_Size(data),
+ PyString_AsString(data), &num_written);
+
+ 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 1f08b1b615..c56b8f7095 100644
--- a/source3/python/py_spoolss_proto.h
+++ b/source3/python/py_spoolss_proto.h
@@ -54,6 +54,7 @@ PyObject *spoolss_startpageprinter(PyObject *self, PyObject *args, PyObject *kw)
PyObject *spoolss_endpageprinter(PyObject *self, PyObject *args, PyObject *kw);
PyObject *spoolss_startdocprinter(PyObject *self, PyObject *args, PyObject *kw);
PyObject *spoolss_enddocprinter(PyObject *self, PyObject *args, PyObject *kw);
+PyObject *spoolss_writeprinter(PyObject *self, PyObject *args, PyObject *kw);
/* The following definitions come from python/py_spoolss_jobs_conv.c */