Commits

Josh VanderLinden committed 962a659

Eesh, didn't really think that through very well

  • Participants
  • Parent commits 19f2b38

Comments (0)

Files changed (3)

 # Maintainer: Josh VanderLinden <arch@cloudlery.com>
 pkgname=zedify
 pkgver=20130516
-pkgrel=3
+pkgrel=4
 pkgdesc="Deliver message notifications to remote machines"
 arch=('any')
 url="http://bitbucket.org/codekoala/zedify"

File zedify/i3.py

         def receive(ev):
             log.info('About to receive messages')
 
-            last_update = 0
+            last_update = time.time()
             p = zmq.Poller()
             p.register(SUB, zmq.POLLIN)
 
+            request_status(True)
+
             try:
                 while not ev.is_set():
                     # request a status update if we haven't received anything
             finally:
                 SUB.close()
 
-        def request_status():
+        def request_status(full=False):
             log.info('Requesting unseen count update')
-            PUSH.send_json({'event': 'status'})
+            PUSH.send_json({'event': 'status', 'full': full})
 
         def stop_receiving(signal=None, frame=None):
             log.warn('Attempting to terminate zedifier')

File zedify/remote.py

             self.pub.close()
             self.sub.close()
 
-    def handle_status(self, msg=None):
+    def handle_status(self, msg):
         """Publish the number of unseen messages"""
 
         self.pub.send_json({
             'unseen': {k: len(v) for k, v in self.unseen.items() if v}
         })
 
-        [self.pub.send_json(m)
-            for msgs in self.unseen.values()
-            for m in msgs]
+        if msg.get('full', False):
+            [self.pub.send_json(m)
+                for msgs in self.unseen.values()
+                for m in msgs]
 
     def handle_typing(self, msg):
         """Reset unseen count for the buffer we're typing into"""