class IPushNotificationListener(XplPlugin): """ Create listener for xPL messages about Iphone push notification """ def __init__(self): """ Create listener for Iphone push notification """ XplPlugin.__init__(self, name='ipushnot') # Create logger self.log.debug("Listener for Iphone push notification created") # Create IPushNotification object self.ipn_notification_manager = IPushNotification(self.log) # Create listeners Listener(self.ipn_notification_cb, self.myxpl, { 'schema': 'sendmsg.push', 'xpltype': 'xpl-cmnd' }) self.enable_hbeat() def ipn_notification_cb(self, message): """ Call Iphone notification lib @param message : message to send """ self.log.debug("Call ipn_notification_cb") # mandatory keys if 'to' in message.data: pushmenick = message.data['to'] else: self.log.warning("No recipient was found in the xpl message") return if 'body' in message.data: body = message.data['body'] else: self.log.warning("No message was found in the xpl message") return # optionnal keys if 'signature' in message.data: signature = message.data['signature'] else: self.log.info( "No signature was found in the xpl message, so we use NoSign") signature = "NoSign" self.log.debug( "Call send_ipn with following parameters : pushmenick=" + pushmenick + ", message=" + body + ", signature=" + signature) self.ipn_notification_manager.send_ipn(pushmenick, body, signature)
def __init__(self): """ Create listener for Iphone push notification """ XplPlugin.__init__(self, name='ipushnot') # Create logger self.log.debug("Listener for Iphone push notification created") # Create IPushNotification object self.ipn_notification_manager = IPushNotification(self.log) # Create listeners Listener(self.ipn_notification_cb, self.myxpl, { 'schema': 'sendmsg.push', 'xpltype': 'xpl-cmnd' }) self.enable_hbeat()
class IPushNotificationListener(XplPlugin): """ Create listener for xPL messages about Iphone push notification """ def __init__(self): """ Create listener for Iphone push notification """ XplPlugin.__init__(self, name = 'ipushnot') # Create logger self.log.debug("Listener for Iphone push notification created") # Create IPushNotification object self.ipn_notification_manager = IPushNotification(self.log) # Create listeners Listener(self.ipn_notification_cb, self.myxpl, {'schema': 'sendmsg.push', 'xpltype': 'xpl-cmnd'}) self.enable_hbeat() def ipn_notification_cb(self, message): """ Call Iphone notification lib @param message : message to send """ self.log.debug("Call ipn_notification_cb") # mandatory keys if 'to' in message.data: pushmenick = message.data['to'] else: self.log.warning("No recipient was found in the xpl message") return if 'body' in message.data: body = message.data['body'] else: self.log.warning("No message was found in the xpl message") return # optionnal keys if 'signature' in message.data: signature = message.data['signature'] else: self.log.info("No signature was found in the xpl message, so we use NoSign") signature = "NoSign" self.log.debug("Call send_ipn with following parameters : pushmenick=" + pushmenick + ", message=" + body + ", signature=" + signature) self.ipn_notification_manager.send_ipn(pushmenick, body, signature)
def __init__(self): """ Create listener for Iphone push notification """ XplPlugin.__init__(self, name = 'ipushnot') # Create logger self.log.debug("Listener for Iphone push notification created") # Create IPushNotification object self.ipn_notification_manager = IPushNotification(self.log) # Create listeners Listener(self.ipn_notification_cb, self.myxpl, {'schema': 'sendmsg.push', 'xpltype': 'xpl-cmnd'}) self.enable_hbeat()