Add registered user information.

This commit is contained in:
2013-11-08 22:39:58 +00:00
parent 48239b32ae
commit dad1a72cf0
3 changed files with 20 additions and 1 deletions

View File

@@ -55,7 +55,7 @@ class Group(object):
@property
def inherited(self):
"""Indiciates if the group is herited from a parent channel."""
"""Indiciates if the group is inherited from a parent channel."""
return bool(self.__group.inherited)
@property

View File

@@ -108,6 +108,12 @@ class Server(object):
def set_user_state(self, state):
return self.__server.setState(state)
def get_registrations(self, filter=''):
return self.__server.getRegistedUsers(filter)
def get_registration(self, user_id):
return self.__server.getRegistration(user_id)
# Bans
def get_bans(self):

View File

@@ -2,6 +2,8 @@ class User(object):
def __init__(self, server, user):
self.__server = server
self.__user = user
if self.__user.userid:
self.__registration = self.__server.get_registration(self.__user.userid)
@property
def session(self):
@@ -113,6 +115,17 @@ class User(object):
"""Returns the number of seconds the user has been idle."""
return self.__user.idlesecs
@property
def registered(self):
"""Indiciates if the user is registered"""
return self.__user.userid > 0
@property
def email(self):
"""If the user is registered, return the user's email address"""
if self.__user.userid:
return self.__registration.UserEmail
def update(self, **kwargs):
"""Update a value of the user's state.kwargs