comparison sat_frontends/quick_frontend/quick_app.py @ 2861:e9e33e05d143

quick frontend (app): fixed notifications ids
author Goffi <goffi@goffi.org>
date Wed, 20 Mar 2019 09:08:47 +0100
parents eb9fa72eb62b
children b2e898384c25
comparison
equal deleted inserted replaced
2860:851c47cc4ae7 2861:e9e33e05d143
895 from_jid = jid.JID(from_jid_s) 895 from_jid = jid.JID(from_jid_s)
896 for widget in self.widgets.getWidgets(quick_chat.QuickChat, target=from_jid.bare, 896 for widget in self.widgets.getWidgets(quick_chat.QuickChat, target=from_jid.bare,
897 profiles=(profile,)): 897 profiles=(profile,)):
898 widget.onChatState(from_jid, state, profile) 898 widget.onChatState(from_jid, state, profile)
899 899
900 def notify( 900 def notify(self, type_, entity=None, message=None, subject=None, callback=None,
901 self, 901 cb_args=None, widget=None, profile=C.PROF_KEY_NONE):
902 type_,
903 entity=None,
904 message=None,
905 subject=None,
906 callback=None,
907 cb_args=None,
908 widget=None,
909 profile=C.PROF_KEY_NONE,
910 ):
911 """Trigger an event notification 902 """Trigger an event notification
912 903
913 @param type_(unicode): notifation kind, 904 @param type_(unicode): notifation kind,
914 one of C.NOTIFY_* constant or any custom type specific to frontend 905 one of C.NOTIFY_* constant or any custom type specific to frontend
915 @param entity(jid.JID, None): entity involved in the notification 906 @param entity(jid.JID, None): entity involved in the notification
935 } 926 }
936 if widget is not None: 927 if widget is not None:
937 notif_data[widget] = widget 928 notif_data[widget] = widget
938 type_notifs.append(notif_data) 929 type_notifs.append(notif_data)
939 self._notifications[self._notif_id] = notif_data 930 self._notifications[self._notif_id] = notif_data
931 self._notif_id += 1
940 self.callListeners("notification", entity, notif_data, profile=profile) 932 self.callListeners("notification", entity, notif_data, profile=profile)
941 933
942 def getNotifs(self, entity=None, type_=None, exact_jid=None, profile=C.PROF_KEY_NONE): 934 def getNotifs(self, entity=None, type_=None, exact_jid=None, profile=C.PROF_KEY_NONE):
943 """return notifications for given entity 935 """return notifications for given entity
944 936