--- cups-pk-helper-0.0.4/src/cups.c 2010-03-22 15:41:36.000000000 +0100
+++ cups-pk-helper-0.0.4/src/cups.c 2010-03-22 15:41:36.000000000 +0100
@@ -1726,8 +1726,11 @@ cph_cups_server_set_settings (CphCups
gboolean
cph_cups_job_cancel (CphCups *cups,
int job_id,
+ gboolean purge_job,
const char *user_name)
{
+ ipp_t *request;
+
g_return_val_if_fail (CPH_IS_CUPS (cups), FALSE);
if (!_cph_cups_is_job_id_valid (cups, job_id))
@@ -1735,10 +1738,19 @@ cph_cups_job_cancel (CphCups *cups,
/* we don't check if the user name is valid or not because it comes
* from getpwuid(), and not dbus */
- return _cph_cups_send_new_simple_job_request (cups, IPP_CANCEL_JOB,
- job_id,
- user_name,
- CPH_RESOURCE_JOBS);
+ request = ippNewRequest (IPP_CANCEL_JOB);
+ _cph_cups_add_job_uri (request, job_id);
+
+ if (user_name != NULL)
+ ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_NAME,
+ "requesting-user-name", NULL, user_name);
+
+#if (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 4) || CUPS_VERSION_MAJOR > 1
+ if (purge_job)
+ ippAddBoolean (request, IPP_TAG_OPERATION, "purge-job", 1);
+#endif
+
+ return _cph_cups_send_request (cups, request, CPH_RESOURCE_JOBS);
}
gboolean
--- cups-pk-helper-0.0.4/src/cups.h 2010-03-22 15:41:36.000000000 +0100
+++ cups-pk-helper-0.0.4/src/cups.h 2010-03-22 15:41:36.000000000 +0100
@@ -169,6 +169,7 @@ gboolean cph_cups_is_printer_uri_local (
gboolean cph_cups_job_cancel (CphCups *cups,
int job_id,
+ gboolean purge_job,
const char *user_name);
gboolean cph_cups_job_restart (CphCups *cups,
--- cups-pk-helper-0.0.4/src/cups-pk-helper-mechanism.c 2010-03-22 15:41:36.000000000 +0100
+++ cups-pk-helper-0.0.4/src/cups-pk-helper-mechanism.c 2010-03-22 15:43:33.000000000 +0100
@@ -988,6 +988,15 @@ cph_mechanism_job_cancel (CphMechanism
int id,
DBusGMethodInvocation *context)
{
+ return cph_mechanism_job_cancel_purge (mechanism, id, FALSE, context);
+}
+
+gboolean
+cph_mechanism_job_cancel_purge (CphMechanism *mechanism,
+ int id,
+ gboolean purge,
+ DBusGMethodInvocation *context)
+{
CphJobStatus job_status;
gboolean ret;
char *user_name;
@@ -1023,7 +1032,7 @@ cph_mechanism_job_cancel (CphMechanism
}
}
- ret = cph_cups_job_cancel (mechanism->priv->cups, id, user_name);
+ ret = cph_cups_job_cancel (mechanism->priv->cups, id, purge, user_name);
_cph_mechanism_return_error (mechanism, context, !ret);
g_free (user_name);
--- cups-pk-helper-0.0.4/src/cups-pk-helper-mechanism.h 2010-03-22 15:41:36.000000000 +0100
+++ cups-pk-helper-0.0.4/src/cups-pk-helper-mechanism.h 2010-03-22 15:41:36.000000000 +0100
@@ -226,6 +226,12 @@ cph_mechanism_job_cancel (CphMechanism
DBusGMethodInvocation *context);
gboolean
+cph_mechanism_job_cancel_purge (CphMechanism *mechanism,
+ int id,
+ gboolean purge,
+ DBusGMethodInvocation *context);
+
+gboolean
cph_mechanism_job_restart (CphMechanism *mechanism,
int id,
DBusGMethodInvocation *context);
--- cups-pk-helper-0.0.4/src/cups-pk-helper-mechanism.xml 2010-03-22 15:41:36.000000000 +0100
+++ cups-pk-helper-0.0.4/src/cups-pk-helper-mechanism.xml 2010-03-22 15:44:36.000000000 +0100
@@ -174,12 +174,20 @@
+
+
+
+
+
+
+
+