Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use wokkel's whitespace keepalive.

  • Loading branch information...
commit e8534eecce95b81e5436951126633261e42b3a2f 1 parent 51e9fb4
@dustin authored
Showing with 2 additions and 21 deletions.
  1. +0 −20 lib/whatsup/protocol.py
  2. +2 −1  whatsup.tac
View
20 lib/whatsup/protocol.py
@@ -1,11 +1,9 @@
#!/usr/bin/env python
-from twisted.internet import task
from twisted.words.xish import domish
from twisted.words.protocols.jabber.jid import JID
from wokkel.xmppim import MessageProtocol, PresenceClientProtocol
from wokkel.xmppim import AvailablePresence
-from wokkel.client import XMPPHandler
import xmpp_commands
import config
@@ -136,21 +134,3 @@ def unsubscribeReceived(self, entity):
self.unsubscribe(entity)
self.unsubscribed(entity)
self.update_presence()
-
-# From https://mailman.ik.nu/pipermail/twisted-jabber/2008-October/000171.html
-class KeepAlive(XMPPHandler):
-
- interval = 300
- lc = None
-
- def connectionInitialized(self):
- self.lc = task.LoopingCall(self.ping)
- self.lc.start(self.interval)
-
- def connectionLost(self, *args):
- if self.lc:
- self.lc.stop()
-
- def ping(self):
- print "Stayin' alive"
- self.send(" ")
View
3  whatsup.tac
@@ -7,6 +7,7 @@ from twisted.internet import task, reactor
from twisted.words.protocols.jabber import jid
from wokkel.client import XMPPClient
from wokkel.generic import VersionHandler
+from wokkel.keepalive import KeepAlive
from whatsup import config
from whatsup import protocol
@@ -20,7 +21,7 @@ xmppclient.logTraffic = False
whatsup=protocol.WhatsupProtocol()
whatsup.setHandlerParent(xmppclient)
VersionHandler('Whatsup', config.VERSION).setHandlerParent(xmppclient)
-protocol.KeepAlive().setHandlerParent(xmppclient)
+KeepAlive().setHandlerParent(xmppclient)
xmppclient.setServiceParent(application)
site_checker = scheduling.CheckSites(whatsup)
Please sign in to comment.
Something went wrong with that request. Please try again.