Update model to send newmail notification (mqueue) whenever possible (user registered...
authorJulien Kerihuel <j.kerihuel@openchange.org>
Mon, 17 Oct 2011 17:02:37 +0000 (17:02 +0000)
committerJulien Kerihuel <j.kerihuel@openchange.org>
Mon, 17 Oct 2011 17:02:37 +0000 (17:02 +0000)
mapiproxy/services/ocsmanager/ocsmanager/model/NotificationModel.py

index 5fbf6e088f2ab6ca5a5b95d151049f3d9cc8915c..ea560dd7b5d530211a2c4b8639bba687db9df9cc 100644 (file)
@@ -74,6 +74,11 @@ class NotificationModel:
         # Trigger newmail notification for registered users (rd) who subscribed for newmail Notification
         for username in params['usernames']:
             print 'Searching for fnevNewmail for %s on %s' % (username, info['mapistoreURI'])
-            mgmt.registered_subscription(username, info['mapistoreURI'], 1, 2)
+            ret = mgmt.registered_subscription(username, info['mapistoreURI'], 1, 2)
+            if ret is True:
+                print 'Sending newmail notif on /%s#newmail' % username
+                ret = mgmt.send_newmail(username, info['mapistoreURI'], message[1])
+                if ret is False:
+                    print 'Error while sending newmail notif'
 
         return (False, params)