def _update_presence_ready(self): def gotResult(counts): users = counts['users'] tracking = counts['tracks'] if tracking != self._tracking or users != self._users: status="Tracking %s topics for %s users" % (tracking, users) self.available(None, None, {None: status}) self._tracking = tracking self._users = users db.model_counts().addCallback(gotResult).addErrback(self.presence_fallback)
def _update_presence_ready(self): def gotResult(counts): users = counts['users'] tracking = counts['tracks'] if tracking != self._tracking or users != self._users: status = "Tracking %s topics for %s users" % (tracking, users) self.available(None, None, {None: status}) self._tracking = tracking self._users = users db.model_counts().addCallback(gotResult).addErrback( self.presence_fallback)
def subscribedReceived(self, entity): log.msg("Subscribe received from %s" % (entity.userhost())) welcome_message="""Welcome to twitterspy. Here you can use your normal IM client to post to twitter, track topics, watch your friends, make new ones, and more. Type "help" to get started. """ global current_conns conn = current_conns[self.jid] conn.send_plain(entity.full(), welcome_message) def send_notices(counts): cnt = counts['users'] msg = "New subscriber: %s ( %d )" % (entity.userhost(), cnt) for a in config.ADMINS: conn.send_plain(a, msg) db.model_counts().addCallback(send_notices)
def subscribedReceived(self, entity): log.msg("Subscribe received from %s" % (entity.userhost())) welcome_message = """Welcome to twitterspy. Here you can use your normal IM client to post to twitter, track topics, watch your friends, make new ones, and more. Type "help" to get started. """ global current_conns conn = current_conns[self.jid] conn.send_plain(entity.full(), welcome_message) def send_notices(counts): cnt = counts['users'] msg = "New subscriber: %s ( %d )" % (entity.userhost(), cnt) for a in config.ADMINS: conn.send_plain(a, msg) db.model_counts().addCallback(send_notices)