Esempio n. 1
0
 def RemoveUser(self, user):
     try:
         user.LeaveChannel()
         user.LeaveGame()
         self.u.remove(user)
     except:
         wol_logging.log_caller(wol_logging.ERROR, "users", "User_Manager::RemoveUser called with invalid user argument")
Esempio n. 2
0
 def CreateChannel(self, channel_name):
     """Returns a new Channel instance"""
     if self.FindChannel(channel_name) != None:
         wol_logging.log_caller(wol_logging.ERROR, "chans", "Channel_Manager::CreateChannel called when a channel by that name exists!")
         return None
     g = Channel(channel_name, self)
     self.g.append(g)
     return g
Esempio n. 3
0
 def CreateGame(self, game_name):
     """Returns a new Game instance"""
     if self.FindGame(name=game_name) != None:
         wol_logging.log_caller(wol_logging.ERROR, "games", "Game_Manager::CreateGame called when a game by that name exists!")
         return None
     g = Game(game_name, self)
     self.g.append(g)
     return g
Esempio n. 4
0
 def CreateUser(self, username, connection):
     """Returns a new User instance"""
     if self.FindUser(name=username) != None:
         wol_logging.log_caller(wol_logging.ERROR, "users", "User_Manager::CreateUser called when a user by that name exists!")
         wol_logging.log_caller(wol_logging.ERROR, "users", "User_Manager::CreateUser - removing old %s"%(username))
         self.RemoveUser(self.FindUser(name=username))
         #return None
     u = User(username, connection, self)
     self.u.append(u)
     return u
Esempio n. 5
0
 def FindUser(self, name=None, id=None):
     """Specify name or id, but not both. Returns a user instance"""
     if (name == None) and (id==None):
         wol_logging.log_caller(wol_logging.ERROR, "users", "User_Manager::FindUser called with None name and id!")
     if (name != None):
         u = [u for u in self.u if u.GetName().upper() == name.upper()]
         if len(u) == 0:
             return None
         return u[0]
     if (id != None):
         u = [u for u in self.u if u.GetUID() == id]
         if len(u) == 0:
             return None
         return u[0]
Esempio n. 6
0
 def debug(self, level, dtype, strn):
     wol_logging.log_caller(level, dtype, "[" + str(self.conid) + "] " + strn)
Esempio n. 7
0
 def RemoveChannel(self, channel):
     try:
         self.g.remove(channel)
     except:
         wol_logging.log_caller(wol_logging.ERROR, "chans", "Channel_Manager::RemoveChannel called with invalid channel argument")
Esempio n. 8
0
 def RemoveGame(self, game):
     try:
         self.g.remove(game)
     except:
         wol_logging.log_caller(wol_logging.ERROR, "games", "Game_Manager::RemoveGame called with invalid game argument")