# HG changeset patch # User Goffi # Date 1371723406 -7200 # Node ID ee744ffed7fc9147ff17019ea3199ad36558499d # Parent 890776a6fdb79ac9fcb532f9122a7503eef84c74 browser side: events data are cached until initialisation is finished (we get all microblogs) diff -r 890776a6fdb7 -r ee744ffed7fc libervia.py --- a/libervia.py Thu Jun 20 12:16:46 2013 +0200 +++ b/libervia.py Thu Jun 20 12:16:46 2013 +0200 @@ -164,6 +164,8 @@ self.resize() self._register = RegisterCall() self._register.call('isRegistered',self._isRegisteredCB) + self.initialised = False + self.init_cache = [] # used to cache events until initialisation is done def addSelectedListener(self, callback): self._selected_listeners.add(callback) @@ -358,6 +360,10 @@ for lib_wid in self.libervia_widgets: if isinstance(lib_wid, panels.MicroblogPanel): self.FillMicroblogPanel(lib_wid) + self.initialised = True # initialisation phase is finished here + for event_data in self.init_cache: # so we have to send all the cached events + self._personalEventCb(*event_data) + del self.init_cache def _getProfileJidCB(self, jid): self.whoami = JID(jid) @@ -381,6 +387,9 @@ ## Signals callbacks ## def _personalEventCb(self, sender, event_type, data): + if not self.initialised: + self.init_cache.append((sender, event_type, data)) + return if event_type == "MICROBLOG": if not 'content' in data: print ("WARNING: No content found in microblog data")