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