Esempio n. 1
0
	def onPrecenceUpdated(self, jid, lastseen):
		buddy = jid.split("@")[0]
		self.logger.info("Lastseen: %s %s", buddy, utils.ago(lastseen))

		if buddy in self.presenceRequested:
			timestamp = time.localtime(time.time() - lastseen)
			timestring = time.strftime("%a, %d %b %Y %H:%M:%S", timestamp)
			self.sendMessageToXMPP(buddy, "%s (%s)" % (timestring, utils.ago(lastseen)))
			self.presenceRequested.remove(buddy)

		if lastseen < 60:
			self.onPrecenceAvailable(jid)
		else:
			self.onPrecenceUnavailable(jid)
Esempio n. 2
0
    def onPrecenceUpdated(self, jid, lastseen):
        buddy = jid.split("@")[0]
        self.logger.info("Lastseen: %s %s", buddy, utils.ago(lastseen))

        if buddy in self.presenceRequested:
            timestamp = time.localtime(time.time() - lastseen)
            timestring = time.strftime("%a, %d %b %Y %H:%M:%S", timestamp)
            self.sendMessageToXMPP(
                buddy, "%s (%s)" % (timestring, utils.ago(lastseen)))
            self.presenceRequested.remove(buddy)

        if lastseen < 60:
            self.onPrecenceAvailable(jid)
        else:
            self.onPrecenceUnavailable(jid)
Esempio n. 3
0
 def status(self):
     if self.updating:
         return "updating"
     if self.updated is None:
         return "never updated"
     if self.is_stale:
         return "stale"
     return "updated %s" % ago(self.updated)
Esempio n. 4
0
    def onPresenceReceived(self, _type, name, jid, lastseen):
        self.logger.info("Presence received: %s %s %s %s", _type, name, jid,
                         lastseen)
        buddy = jid.split("@")[0]
        #		seems to be causing an error
        #		self.logger.info("Lastseen: %s %s", buddy, utils.ago(lastseen))

        if buddy in self.presenceRequested:
            timestamp = time.localtime(time.time() - lastseen)
            timestring = time.strftime("%a, %d %b %Y %H:%M:%S", timestamp)
            self.sendMessageToXMPP(
                buddy, "%s (%s)" % (timestring, utils.ago(lastseen)))
            self.presenceRequested.remove(buddy)

        if lastseen < 60:
            self.onPresenceAvailable(buddy)
        else:
            self.onPresenceUnavailable(buddy)
Esempio n. 5
0
 def ago(self):
     return utils.ago(self.timestamp)
Esempio n. 6
0
 def onSuccess(buddy, lastseen):
     timestamp = time.localtime(time.localtime() - lastseen)
     timestring = time.strftime("%a, %d %b %Y %H:%M:%S", timestamp)
     self.sendMessageToXMPP(
         buddy, "%s (%s) %s" %
         (timestring, utils.ago(lastseen), str(lastseen)))