diff options
author | Tim Potter <tpot@samba.org> | 2002-05-08 05:50:12 +0000 |
---|---|---|
committer | Tim Potter <tpot@samba.org> | 2002-05-08 05:50:12 +0000 |
commit | 5e723ce3c089f118e66f55ef78832421531265f8 (patch) | |
tree | b6b5c54bf289c53ab190f6980778fbd1588ddc46 /source3/python | |
parent | 26b0e0b478da99f4296c99c6e55ced26b44e591b (diff) | |
download | samba-5e723ce3c089f118e66f55ef78832421531265f8.tar.gz samba-5e723ce3c089f118e66f55ef78832421531265f8.tar.bz2 samba-5e723ce3c089f118e66f55ef78832421531265f8.zip |
Added commands for startpageprinter, endpageprinter, setjob and getjob.
(This used to be commit 3da89aa8e45d08444bfcddb145264bfcd6f6d768)
Diffstat (limited to 'source3/python')
-rw-r--r-- | source3/python/py_spoolss.c | 13 | ||||
-rw-r--r-- | source3/python/py_spoolss_jobs.c | 101 | ||||
-rw-r--r-- | source3/python/py_spoolss_proto.h | 3 |
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 */ |