def get_user_status(self, user): rv = [] rv.append("Jid: %s" % user.jid) rv.append("Notification status: %s" % {True: 'Active', False: 'Inactive'}[user.active]) rv.append("Autopost status: %s" % {True: 'Active', False: 'Inactive'}[user.auto_post]) rv.append("Douban OAuth status: %s" % {True: 'Active', False: 'Inactive'}[user.auth]) if user.auth: rv.append("Douban Uid: %s" % user.uid) resources = scheduling.resources(user.jid) if resources: rv.append("I see you logged in with the following resources:") for r in resources: rv.append(" %s %s" % ('\xe2\x80\xa2'.decode('utf-8'), r)) else: rv.append("I don't see you logged in with any resource I'd send " "a message to. Perhaps you're dnd, xa, or negative priority.") if user.is_quiet(): rv.append("All alerts are quieted until %s" % str(user.quiet_until)) if user.is_admin: with models.Session() as session: auth_user = session.query(models.User).filter_by(auth=True).count() rv.append("Authorized user: %s" %auth_user) auth_active_user = session.query(models.User).filter_by(auth=True).filter_by(active=True).count() rv.append("Active user: %s" %auth_active_user) online_user = scheduling.online_users_count() rv.append("Online user: %s" %online_user) return "\n".join(rv)
def __call__(self, user, prot, args): # For bare jids, we'll send what was requested, # but also look up the user and send it to any active resources self.ping(prot, user.jid, args) j = JID(args) if j.user and not j.resource: for rsrc in scheduling.resources(args): j.resource=rsrc self.ping(prot, user.jid, j.full())
def get_user_status(self, user): rv=[] rv.append("Jid: %s" % user.jid) rv.append("Twitterspy status: %s" % {True: 'Active', False: 'Inactive'}[user.active]) resources = scheduling.resources(user.jid) if resources: rv.append("I see you logged in with the following resources:") for r in resources: rv.append(u" • %s" % r) else: rv.append("I don't see you logged in with any resource I'd send " "a message to. Perhaps you're dnd, xa, or negative priority.") rv.append("You are currently tracking %d topics." % len(user.tracks)) if user.has_credentials: rv.append("You're logged in to twitter as %s" % (user.username)) if user.friend_timeline_id is not None: rv.append("Friend tracking is enabled.") return "\n".join(rv)
def get_user_status(self, user): rv = [] rv.append("Jid: %s" % user.jid) rv.append("Notification status: %s" % { True: 'Active', False: 'Inactive' }[user.active]) rv.append("Autopost status: %s" % { True: 'Active', False: 'Inactive' }[user.auto_post]) rv.append("Douban OAuth status: %s" % { True: 'Active', False: 'Inactive' }[user.auth]) if user.auth: rv.append("Douban Uid: %s" % user.uid) resources = scheduling.resources(user.jid) if resources: rv.append("I see you logged in with the following resources:") for r in resources: rv.append(" %s %s" % ('\xe2\x80\xa2'.decode('utf-8'), r)) else: rv.append( "I don't see you logged in with any resource I'd send " "a message to. Perhaps you're dnd, xa, or negative priority.") if user.is_quiet(): rv.append("All alerts are quieted until %s" % str(user.quiet_until)) if user.is_admin: with models.Session() as session: auth_user = session.query( models.User).filter_by(auth=True).count() rv.append("Authorized user: %s" % auth_user) auth_active_user = session.query(models.User).filter_by( auth=True).filter_by(active=True).count() rv.append("Active user: %s" % auth_active_user) online_user = scheduling.online_users_count() rv.append("Online user: %s" % online_user) return "\n".join(rv)
def get_user_status(self, user): rv=[] rv.append("Jid: %s" % user.jid) rv.append("Twitterspy status: %s" % {True: 'Active', None: 'Inactive', False: 'Inactive'}[user.active]) rv.append("Service jid: %s" % user.service_jid) rv.append("Autopost: %s" % {True: 'on', None: 'off', False: 'off'}[user.auto_post]) resources = scheduling.resources(user.jid) if resources: rv.append("I see you logged in with the following resources:") for r in resources: rv.append(u" • %s" % r) else: rv.append("I don't see you logged in with any resource I'd send " "a message to. Perhaps you're dnd, xa, or negative priority.") rv.append("You are currently tracking %d topics." % len(user.tracks)) if user.has_credentials: rv.append("You're logged in to twitter as %s" % (user.username)) if user.friend_timeline_id is not None: rv.append("Friend tracking is enabled.") return "\n".join(rv)