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 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))