Edgewall Software

Opened 18 years ago

Last modified 7 years ago

#3517 closed enhancement

Notification plugin — at Version 16

Reported by: wichert@… Owned by: Peter Suter
Priority: normal Milestone: 1.1.3
Component: notification Version: 0.9.6
Severity: major Keywords:
Cc: ufs@…, davidf@…, pacopablo@…, Jun Omae Branch:
Release Notes:

Allow plugins to extend notification system.

API Changes:

Added new API for notification distribution and extension points:

Internal Changes:

Description

Currently trac only supports email notifications. For some environments it it would be very practical to use different kinds of notifications; for example to send a SMS when tickets of a specific type are files, or to notify CIA of new tickets.

It seems sensible to create an extension point for the notification infrastructure so one or more plugins can handle notifications.

Change History (19)

by wichert@…, 18 years ago

Attachment: trac-cia.diff added

Example of submitting messages to CIA from trac

comment:1 by wichert@…, 18 years ago

I've added a patch which implements a trac-CIA connection. This implementation is quite bad since it hooks trac directly into the email notifier logic, but the xmlrpc code can easily be reused.

comment:2 by Christian Boos, 17 years ago

Component: ticket systemnotification
Milestone: 0.12
Owner: changed from Jonas Borgström to Emmanuel Blot
Severity: normalmajor

Yes, a more generic infrastructure for notifications will be a big topic for 0.12.

comment:3 by Pedro Algarvio, aka, s0undt3ch <ufs@…>, 17 years ago

Cc: ufs@… added

comment:4 by pookey@…, 16 years ago

I'd really appreciate if someone could manage to update this patch to work with 0.10.4 - my python skills are sadly lacking!

comment:5 by wichert@…, 16 years ago

I did an improved version of that patch for 0.10 a while ago. I'll add it to this issue.

by wichert@…, 16 years ago

Attachment: trac-0.10-cia.diff added

CIA for trac 0.10.4

by wichert@…, 16 years ago

Attachment: trac-0.10.4-cia.diff added

CIA for trac 0.10.4

comment:6 by davidf@…, 16 years ago

Cc: davidf@… added

Also wanting to add a generic jabber notification system…. again this would make sense as a plugin

comment:7 by anonymous, 16 years ago

We definitely need a few explanations about how to make it work. I've patched my trac, figured a few config items from code, but i can't make it work. Can someone please post instructions and a config sample? Thanks in advance.

in reply to:  6 comment:8 by Emmanuel Blot, 16 years ago

Replying to davidf@sjsoft.com:

Also wanting to add a generic jabber notification system…. again this would make sense as a plugin

BTW, for Mac users only: I've written a growl notification plugin.

comment:9 by wichert@…, 16 years ago

For reference this is the configuration we use for Plone:

[notification]
always_notify_owner = true
always_notify_reporter = true
cia_enabled = true
cia_project = Plone
cia_server = http://cia.navi.cx
smtp_always_cc = plone-collector@objectrealms.net
smtp_enabled = true
smtp_from = discard@antiloop.plone.org
smtp_password = 
smtp_port = 25
smtp_replyto = discard@antiloop.plone.org
smtp_server = localhost
smtp_user = 

comment:10 by John Hampton, 16 years ago

Cc: pacopablo@… added

comment:11 by Peter Suter, 10 years ago

The INotificationDistributor extension point of the AdvancedNotification proposal provides a clean way for plugins to implement such alternative notification protocols.

The proposed changes can be found in log:psuter@advanced-notification-mail-distribution.

Several other new extension points and public APIs for plugins are also introduced there. These might have to be reviewed and discussed in some more detail. For example I listed some open questions in the relevant wiki pages (e.g. NotificationEvent API, INotificationFormatter and IEmailAddressResolver).

comment:12 by Peter Suter, 10 years ago

Milestone: next-major-releases1.1.2
Owner: changed from Emmanuel Blot to Peter Suter
Status: newassigned

comment:13 by Jun Omae, 10 years ago

Cc: Jun Omae added

comment:14 by Ryan J Ollos, 10 years ago

Milestone: 1.1.21.1.3

in reply to:  11 comment:15 by Peter Suter, 9 years ago

The proposed changes can be found in log:psuter@advanced-notification-mail-distribution.

Updated in log:psuter@advanced-notification-mail-distribution.2.

These might have to be reviewed and discussed in some more detail. For example I listed some open questions in the relevant wiki pages (e.g. NotificationEvent API, INotificationFormatter and IEmailAddressResolver).

I'll probably just commit the current state. We can still fine-tune later if problems emerge.

comment:16 by Peter Suter, 9 years ago

API Changes: modified (diff)
Release Notes: modified (diff)

Committed to trunk in [13454]. I'll follow up with changes for milestone delete and retargeting events:

  • trac/ticket/roadmap.py

    diff -r c5cadf7e6beb trac/ticket/roadmap.py
    a b  
    3535from trac.util.text import CRLF, exception_to_unicode, to_unicode
    3636from trac.util.translation import _, tag_
    3737from trac.ticket.api import TicketSystem
    38 from trac.ticket.notification import BatchTicketNotifyEmail
     38from trac.ticket.notification import send_ticket_event, BatchTicketChangeEvent
    3939from trac.ticket.model import Milestone, MilestoneCache, Ticket, \
    4040                              group_milestones
    4141from trac.timeline.api import ITimelineEventProvider
     
    775775                new_values = {'milestone': retarget_to}
    776776                comment = comment or \
    777777                          _("Open tickets retargeted after milestone closed")
    778                 tn = BatchTicketNotifyEmail(self.env)
     778                event = BatchTicketChangeEvent(retargeted_tickets, None,
     779                                               req.authname, comment,
     780                                               new_values, None)
    779781                try:
    780                     tn.notify(retargeted_tickets, new_values, comment, None,
    781                               req.authname)
     782                    send_ticket_event(self.env, self.config, event)
    782783                except Exception as e:
    783784                    self.log.error("Failure sending notification on ticket "
    784785                                   "batch change: %s",
     
    827828                              retarget=retarget_to))
    828829            new_values = {'milestone': retarget_to}
    829830            comment = _("Tickets retargeted after milestone deleted")
    830             tn = BatchTicketNotifyEmail(self.env)
     831            event = BatchTicketChangeEvent(retargeted_tickets, None,
     832                                           req.authname, comment, new_values,
     833                                           None)
    831834            try:
    832                 tn.notify(retargeted_tickets, new_values, comment, None,
    833                           req.authname)
     835                send_ticket_event(self.env, self.config, event)
    834836            except Exception as e:
    835837                self.log.error("Failure sending notification on ticket batch "
    836838                               "change: %s", exception_to_unicode(e))
Note: See TracTickets for help on using tickets.