diff options
author | Tim Potter <tpot@samba.org> | 2002-05-14 06:09:59 +0000 |
---|---|---|
committer | Tim Potter <tpot@samba.org> | 2002-05-14 06:09:59 +0000 |
commit | 2e6939cf0b16055bae6eba6b3d3404164833c459 (patch) | |
tree | ed80e2919ae338e8f1885abda9dd5a0986c4cf88 /source3 | |
parent | 4deb5612549d927988474c5c84251f6fec7edc78 (diff) | |
download | samba-2e6939cf0b16055bae6eba6b3d3404164833c459.tar.gz samba-2e6939cf0b16055bae6eba6b3d3404164833c459.tar.bz2 samba-2e6939cf0b16055bae6eba6b3d3404164833c459.zip |
Added writeprinter command.
(This used to be commit 307788d0b823f228c718b2a186fc66144fd55717)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/python/py_spoolss.c | 4 | ||||
-rw-r--r-- | source3/python/py_spoolss_jobs.c | 31 | ||||
-rw-r--r-- | source3/python/py_spoolss_proto.h | 1 |
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 */ |