Index: /pykota/trunk/conf/pykota.conf.sample
===================================================================
--- /pykota/trunk/conf/pykota.conf.sample (revision 830)
+++ /pykota/trunk/conf/pykota.conf.sample (revision 852)
@@ -48,4 +48,14 @@
 
 #
+# Who should we send an email to in case a quota is reached ?
+# possible values are : DevNull, User, Admin, Both
+# The Both value means that the User and the Admin will receive 
+# an email message.
+# The DevNull value means no email message will be sent.
+# This value can be set either globally or per printer or both.
+# If both are defined, the printer option has priority.
+mailto: both
+
+#
 # Grace delay in days
 # This value can be set either globally or per printer or both.
Index: /pykota/trunk/pykota/tool.py
===================================================================
--- /pykota/trunk/pykota/tool.py (revision 844)
+++ /pykota/trunk/pykota/tool.py (revision 852)
@@ -15,4 +15,8 @@
 #
 # $Log$
+# Revision 1.27  2003/03/15 23:01:28  jalet
+# New mailto option in configuration file added.
+# No time to test this tonight (although it should work).
+#
 # Revision 1.26  2003/03/09 23:58:16  jalet
 # Comment
@@ -312,4 +316,5 @@
         admin = self.config.getAdmin(pname)
         adminmail = self.config.getAdminMail(pname)
+        mailto = self.config.getMailTo(pname)
         action = self.checkUserPQuota(username, pname)
         if action.startswith("POLICY_") :
@@ -318,11 +323,15 @@
             adminmessage = _("Print Quota exceeded for user %s on printer %s") % (username, pname)
             self.logger.log_message(adminmessage)
-            self.sendMessageToUser(admin, adminmail, username, _("Print Quota Exceeded"), _("You are not allowed to print anymore because\nyour Print Quota is exceeded on printer %s.") % pname)
-            self.sendMessageToAdmin(adminmail, _("Print Quota"), adminmessage)
+            if mailto in [ "BOTH", "USER" ] :
+                self.sendMessageToUser(admin, adminmail, username, _("Print Quota Exceeded"), _("You are not allowed to print anymore because\nyour Print Quota is exceeded on printer %s.") % pname)
+            if mailto in [ "BOTH", "ADMIN" ] :
+                self.sendMessageToAdmin(adminmail, _("Print Quota"), adminmessage)
         elif action == "WARN" :    
             adminmessage = _("Print Quota soft limit exceeded for user %s on printer %s") % (username, pname)
             self.logger.log_message(adminmessage)
-            self.sendMessageToUser(admin, adminmail, username, _("Print Quota Exceeded"), _("You will soon be forbidden to print anymore because\nyour Print Quota is almost reached on printer %s.") % pname)
-            self.sendMessageToAdmin(adminmail, _("Print Quota"), adminmessage)
+            if mailto in [ "BOTH", "USER" ] :
+                self.sendMessageToUser(admin, adminmail, username, _("Print Quota Exceeded"), _("You will soon be forbidden to print anymore because\nyour Print Quota is almost reached on printer %s.") % pname)
+            if mailto in [ "BOTH", "ADMIN" ] :
+                self.sendMessageToAdmin(adminmail, _("Print Quota"), adminmessage)
         return action        
     
Index: /pykota/trunk/pykota/config.py
===================================================================
--- /pykota/trunk/pykota/config.py (revision 804)
+++ /pykota/trunk/pykota/config.py (revision 852)
@@ -15,4 +15,8 @@
 #
 # $Log$
+# Revision 1.17  2003/03/15 23:01:28  jalet
+# New mailto option in configuration file added.
+# No time to test this tonight (although it should work).
+#
 # Revision 1.16  2003/02/17 23:01:56  jalet
 # Typos
@@ -189,4 +193,12 @@
         return self.getPrinterOption(printer, "admin")
         
+    def getMailTo(self, printer) :    
+        """Returns the recipient of email messages."""
+        validmailtos = [ "DEVNULL", "BOTH", "USER", "ADMIN" ]
+        mailto = self.getPrinterOption(printer, "mailto").upper()
+        if mailto not in validmailtos :
+            raise PyKotaConfigError, _("Option mailto in section %s only supports values in %s") % (printer, str(validmailtos))
+        return mailto    
+        
     def getGraceDelay(self, printer) :    
         """Returns the grace delay in days."""
Index: /pykota/trunk/NEWS
===================================================================
--- /pykota/trunk/NEWS (revision 846)
+++ /pykota/trunk/NEWS (revision 852)
@@ -16,4 +16,17 @@
 PyKota NEWS :
 
+    - 1.01 :
+    
+        - The configuration file now accepts an option   
+          to choose the recipient(s) of the email messages :
+          
+            - DevNull means no one will receive them.
+            - User means only the user will receive them.
+            - Admin means only the admin will receive them.
+            - Both means the User and the Admin will receive them.
+            
+        - Manual pages are included since 1.00, but I forgot to    
+          add this information to this file.
+          
     - 1.00 :
     
Index: /pykota/trunk/po/en/pykota.po
===================================================================
--- /pykota/trunk/po/en/pykota.po (revision 842)
+++ /pykota/trunk/po/en/pykota.po (revision 852)
@@ -15,4 +15,8 @@
 #
 # $Log$
+# Revision 1.10  2003/03/15 23:01:28  jalet
+# New mailto option in configuration file added.
+# No time to test this tonight (although it should work).
+#
 # Revision 1.9  2003/03/09 23:38:43  jalet
 # Simplified translations.
@@ -219,2 +223,5 @@
 msgid "unknown"
 msgstr ""
+
+msgid "Option mailto in section %s only supports values in %s"
+msgstr ""
Index: /pykota/trunk/po/fr/pykota.po
===================================================================
--- /pykota/trunk/po/fr/pykota.po (revision 842)
+++ /pykota/trunk/po/fr/pykota.po (revision 852)
@@ -15,4 +15,8 @@
 #
 # $Log$
+# Revision 1.8  2003/03/15 23:01:28  jalet
+# New mailto option in configuration file added.
+# No time to test this tonight (although it should work).
+#
 # Revision 1.7  2003/03/09 23:38:43  jalet
 # Simplified translations.
@@ -227,2 +231,5 @@
 msgid "unknown"
 msgstr "inconnu"
+
+msgid "Option mailto in section %s only supports values in %s"
+msgstr "L'option mailto dans la section %s supporte seulement les valeurs %s"
Index: /pykota/trunk/po/pykota.pot
===================================================================
--- /pykota/trunk/po/pykota.pot (revision 842)
+++ /pykota/trunk/po/pykota.pot (revision 852)
@@ -15,4 +15,8 @@
 #
 # $Log$
+# Revision 1.10  2003/03/15 23:01:28  jalet
+# New mailto option in configuration file added.
+# No time to test this tonight (although it should work).
+#
 # Revision 1.9  2003/03/09 23:38:43  jalet
 # Simplified translations.
@@ -219,2 +223,5 @@
 msgid "unknown"
 msgstr ""
+
+msgid "Option mailto in section %s only supports values in %s"
+msgstr ""
