Browse Source

added check if the player name the user tries to register is already taken

Natenom/support-murmur-13-1446181288462
svedrin 16 years ago
parent
commit
4d3bbee3e3
  1. 4
      pyweb/mumble/MumbleCtlDbus.py
  2. 8
      pyweb/mumble/MumbleCtlIce.py
  3. 2
      pyweb/mumble/mctl.py
  4. 2
      pyweb/mumble/models.py

4
pyweb/mumble/MumbleCtlDbus.py

@ -84,8 +84,8 @@ class MumbleCtlDbus(MumbleCtlBase):
def getPlayers(self, srvid): def getPlayers(self, srvid):
return MumbleCtlDbus.converDbusTypeToNative(self._getDbusServerObject(srvid).getPlayers()) return MumbleCtlDbus.converDbusTypeToNative(self._getDbusServerObject(srvid).getPlayers())
def getRegisteredPlayers(self, srvid):
return MumbleCtlDbus.converDbusTypeToNative(self._getDbusServerObject(srvid).getRegisteredPlayers(''))
def getRegisteredPlayers(self, srvid, filter = ''):
return MumbleCtlDbus.converDbusTypeToNative(self._getDbusServerObject(srvid).getRegisteredPlayers( filter ) )
def getACL(self, srvid, identifier): def getACL(self, srvid, identifier):
return MumbleCtlDbus.converDbusTypeToNative(self._getDbusServerObject(srvid).getACL(identifier)) return MumbleCtlDbus.converDbusTypeToNative(self._getDbusServerObject(srvid).getACL(identifier))

8
pyweb/mumble/MumbleCtlIce.py

@ -84,8 +84,8 @@ class MumbleCtlIce_118(MumbleCtlBase):
ret.append(x.id()) ret.append(x.id())
return ret return ret
def getRegisteredPlayers(self, srvid):
users = self._getIceServerObject(srvid).getRegisteredPlayers('')
def getRegisteredPlayers(self, srvid, filter = ''):
users = self._getIceServerObject(srvid).getRegisteredPlayers( filter )
ret = [] ret = []
for user in users: for user in users:
@ -260,8 +260,8 @@ class MumbleCtlIce_118(MumbleCtlBase):
class MumbleCtlIce_120(MumbleCtlIce_118): class MumbleCtlIce_120(MumbleCtlIce_118):
def getRegisteredPlayers(self, srvid):
users = self._getIceServerObject(srvid).getRegisteredUsers('')
def getRegisteredPlayers(self, srvid, filter = ''):
users = self._getIceServerObject(srvid).getRegisteredUsers(filter)
ret = [] ret = []
for user in users: for user in users:

2
pyweb/mumble/mctl.py

@ -63,7 +63,7 @@ class MumbleCtlBase ():
def getPlayers(self, srvid): def getPlayers(self, srvid):
pass pass
def getRegisteredPlayers(self, srvid):
def getRegisteredPlayers(self, srvid, filter):
pass pass
def getChannels(self, srvid): def getChannels(self, srvid):

2
pyweb/mumble/models.py

@ -251,6 +251,8 @@ class MumbleUser( models.Model ):
if self.id is None: if self.id is None:
# This is a new user record, so Murmur doesn't know about it yet # This is a new user record, so Murmur doesn't know about it yet
if len( ctl.getRegisteredPlayers( self.server.srvid, self.name ) ) > 0:
raise ValueError( "Another player already registered that name." );
self.mumbleid = ctl.registerPlayer( self.server.srvid, self.name ); self.mumbleid = ctl.registerPlayer( self.server.srvid, self.name );
# Update user's registration # Update user's registration

Loading…
Cancel
Save