def send_growl_notification(self): growl_ips = self.growl_ips reg = GrowlRegistrationPacket(password=self.password) reg.addNotification() notify = GrowlNotificationPacket(title=self.title, description=self.description, sticky=True, password=self.password) for ip in growl_ips: addr = (ip, GROWL_UDP_PORT) s = socket(AF_INET, SOCK_DGRAM) s.sendto(reg.payload(), addr) s.sendto(notify.payload(), addr)
def wiki_page_version_deleted(self, page): """Called when a version of a page has been deleted.""" if 'wiki' not in self.sources: return gnp = GrowlNotificationPacket(notification='wiki', title='Page suppressed', description=self._wiki_repr(page)) gs = GrowlSender(self.env) gs.notify(self._get_hosts('wiki'), gnp)
def attachment_added(self, attachment): """Called when an attachment is added.""" if 'attachment' not in self.sources: return gnp = GrowlNotificationPacket(notification='attachment', title='Attachment added', description=attachment.title) gs = GrowlSender(self.env) gs.notify(self._get_hosts('attachment'), gnp)
def build_aborted(build): """Called when a build slave cancels a build or disconnects.""" if 'bitten' not in self.sources: return gnp = GrowlNotificationPacket(notification='bitten', title='Build aborted', description=self._bitten_repr(build)) gs = GrowlSender(self.env) gs.notify(self._get_hosts('bitten'), gnp)
def wiki_page_added(self, page): """Called whenever a new Wiki page is added.""" if 'wiki' not in self.sources: return gnp = GrowlNotificationPacket(notification='wiki', title='Page created', description=page.name) gs = GrowlSender(self.env) gs.notify(self._get_hosts('wiki'), gnp)
def ticket_deleted(self, ticket): """Called when a ticket is deleted.""" if 'ticket' not in self.sources: return gnp = GrowlNotificationPacket(notification='ticket', title='Ticket #%d deleted' % ticket.id, description=self._ticket_repr(ticket)) gs = GrowlSender(self.env) gs.notify(self._get_hosts('ticket'), gnp)
def ticket_changed(self, ticket, comment, author, old_values): """Called when a ticket is modified.""" if 'ticket' not in self.sources: return gnp = GrowlNotificationPacket(notification='ticket', title='Ticket #%d updated' % ticket.id, description=self._ticket_repr(ticket)) gs = GrowlSender(self.env) gs.notify(self._get_hosts('ticket'), gnp)
def build_started(build): """Called when a build slave has accepted a build initiation.""" if 'bitten' not in self.sources: return gnp = GrowlNotificationPacket(notification='bitten', title='Build started', description=self._bitten_repr(build), priority=-2) gs = GrowlSender(self.env) gs.notify(self._get_hosts('bitten'), gnp)
def wiki_page_changed(self, page, version, t, comment, author, ipnr): """Called when a page has been modified.""" if 'wiki' not in self.sources: return gnp = GrowlNotificationPacket(notification='wiki', title='Page updated', description=self._wiki_repr( page, comment)) gs = GrowlSender(self.env) gs.notify(self._get_hosts('wiki'), gnp)
def build_completed(build): """Called when a build slave has completed a build, regardless of the outcome.""" if 'bitten' not in self.sources: return failure = self.status == Build.FAILURE status = 'Build %s' % failure and 'failed' or 'successful' gnp = GrowlNotificationPacket(notification='bitten', title=status, description=self._bitten_repr(build), sticky=failure, priority=failure and 2 or 0) gs = GrowlSender(self.env) gs.notify(self._get_hosts('bitten'), gnp)
def send(self, msg): p = GrowlNotificationPacket(application='foobox', notification='Message', title=msg['src'], description=msg['text']) self.sock.sendto(p.payload(), (self.data['target'], GROWL_UDP_PORT))