]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - backend/snmp-supplies.c
Merge changes from CUPS 1.4svn-r8033.
[thirdparty/cups.git] / backend / snmp-supplies.c
index dea84fcf14ca5480ed2640326b442da6cf9c73a9..b63ed85c329217d0464a4abc1def97bbef6948a2 100644 (file)
@@ -323,6 +323,8 @@ backend_init_supplies(
                *ptr,                   /* Pointer into value string */
                *name_ptr;              /* Pointer into name string */
   cups_snmp_t  packet;                 /* SNMP response packet */
+  ppd_file_t   *ppd;                   /* PPD file for this queue */
+  ppd_attr_t   *ppdattr;               /* cupsSNMPSupplies attribute */
   static const char * const types[] =  /* Supply types */
                {
                  "other",
@@ -371,6 +373,20 @@ backend_init_supplies(
 
   memset(supplies, 0, sizeof(supplies));
 
+ /*
+  * See if we should be getting supply levels via SNMP...
+  */
+
+  if ((ppd = ppdOpenFile(getenv("PPD"))) != NULL &&
+      (ppdattr = ppdFindAttr(ppd, "cupsSNMPSupplies", NULL)) != NULL &&
+      ppdattr->value && strcasecmp(ppdattr->value, "true"))
+  {
+    ppdClose(ppd);
+    return;
+  }
+
+  ppdClose(ppd);
+
  /*
   * Get the device description...
   */