changeset 2325:741ab277616a

Honor the user setting of notification methods.
author Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
date Sun, 24 Jun 2007 01:20:44 +0200
parents c142804478c7
children cbad6fb20f2d 529b17ec4396
files MoinMoin/events/emailnotify.py MoinMoin/events/jabbernotify.py MoinMoin/user.py
diffstat 3 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/events/emailnotify.py	Sun Jun 24 01:09:38 2007 +0200
+++ b/MoinMoin/events/emailnotify.py	Sun Jun 24 01:20:44 2007 +0200
@@ -65,8 +65,8 @@
 
         # send email to all subscribers
         for lang in subscribers:
-            emails = [u.email for u in subscribers[lang]]
-            names = [u.name for u in subscribers[lang]]
+            emails = [u.email for u in subscribers[lang] if u.notify_by_email]
+            names = [u.name for u in subscribers[lang] if u.notify_by_email]
             result = send_notification(request, page, comment, emails, lang, revisions, trivial)
             if result:
                 recipients.update(names)
--- a/MoinMoin/events/jabbernotify.py	Sun Jun 24 01:09:38 2007 +0200
+++ b/MoinMoin/events/jabbernotify.py	Sun Jun 24 01:20:44 2007 +0200
@@ -79,7 +79,7 @@
         userlist = []
         
         for usr in subscribers[lang]:
-            if event_name in usr.subscribed_events:
+            if event_name in usr.subscribed_events and usr.notify_by_jabber:
                 userlist.append(usr)
                 
         subscribers[lang] = userlist
@@ -137,6 +137,8 @@
     
     for id in user_ids:
         usr = User(event.request, id=id)
+        if not usr.notify_by_jabber:
+            continue
         
         # Currently send this only to super users
         # TODO: make it possible to disable this notification
--- a/MoinMoin/user.py	Sun Jun 24 01:09:38 2007 +0200
+++ b/MoinMoin/user.py	Sun Jun 24 01:20:44 2007 +0200
@@ -285,6 +285,8 @@
         self.auth_method = kw.get('auth_method', 'internal')
         self.auth_attribs = kw.get('auth_attribs', ())
         self.bookmarks = {} # interwikiname: bookmark
+        self.notify_be_email = True
+        self.notify_be_jabber = False
 
         # create some vars automatically
         self.__dict__.update(self._cfg.user_form_defaults)