Merge branch 'master' of https://github.com/Zenconomy/sucks into Zenconomy-master

This commit is contained in:
William Pietri
2017-12-05 15:05:17 -08:00
+9
View File
@@ -160,6 +160,8 @@ class VacBot(ClientXMPP):
MatchXPath('{jabber:client}iq/{com:ctl}query/{com:ctl}ctl[@td="' + kind + '"]'), MatchXPath('{jabber:client}iq/{com:ctl}query/{com:ctl}ctl[@td="' + kind + '"]'),
function)) function))
self.schedule('Ping', 30, self.send_ping, repeat=True)
def handle_clean_report(self, iq): def handle_clean_report(self, iq):
self.clean_status = iq.find('{com:ctl}query/{com:ctl}ctl/{com:ctl}clean').get('type') self.clean_status = iq.find('{com:ctl}query/{com:ctl}ctl/{com:ctl}clean').get('type')
logging.debug("*** clean_status = " + self.clean_status) logging.debug("*** clean_status = " + self.clean_status)
@@ -202,6 +204,13 @@ class VacBot(ClientXMPP):
child.append(ctl) child.append(ctl)
return q return q
def send_ping(self):
q = self.make_iq_get(ito=self.vacuum['did'] + '@' + self.vacuum['class'] + '.ecorobot.net/atom',
ifrom=self.user + '@' + self.domain + '/' + self.resource)
logging.debug("*** sending ping ***")
q.xml.append(ET.Element('ping', {'xmlns':'urn:xmpp:ping'}))
q.send()
def connect_and_wait_until_ready(self): def connect_and_wait_until_ready(self):
self.connect(('msg-{}.ecouser.net'.format(self.continent), '5223')) self.connect(('msg-{}.ecouser.net'.format(self.continent), '5223'))
self.process() self.process()