Browse Source

changed *everything* just to handle the new user registration in Murmur 1.2.0. Hope it works.

Natenom/support-murmur-13-1446181288462
Michael Ziegler 16 years ago
parent
commit
7c790ba929
  1. 6
      pyweb/mumble/MumbleCtlDbus.py
  2. 15
      pyweb/mumble/MumbleCtlIce.py
  3. 2
      pyweb/mumble/mctl.py
  4. 23
      pyweb/mumble/models.py

6
pyweb/mumble/MumbleCtlDbus.py

@ -70,8 +70,10 @@ class MumbleCtlDbus(MumbleCtlBase):
def newServer(self):
return self.meta.newServer()
def registerPlayer(self, srvid, name):
return MumbleCtlDbus.converDbusTypeToNative(self._getDbusServerObject(srvid).registerPlayer(name))
def registerPlayer(self, srvid, name, email, password):
mumbleid = MumbleCtlDbus.converDbusTypeToNative( self._getDbusServerObject(srvid).registerPlayer(name) );
self.setRegistration( srvid, mumbleid, name, email, password );
return mumbleid;
def unregisterPlayer(self, srvid, mumbleid):
self._getDbusServerObject(srvid).unregisterPlayer(dbus.Int32( mumbleid ))

15
pyweb/mumble/MumbleCtlIce.py

@ -142,8 +142,10 @@ class MumbleCtlIce_118(MumbleCtlBase):
def setConf(self, srvid, key, value):
self._getIceServerObject(srvid).setConf( key, value.encode( "UTF-8" ) )
def registerPlayer(self, srvid, name):
return self._getIceServerObject(srvid).registerPlayer( name.encode( "UTF-8" ) )
def registerPlayer(self, srvid, name, email, password):
mumbleid = self._getIceServerObject(srvid).registerPlayer( name.encode( "UTF-8" ) )
self.setRegistration( srvid, mumbleid, name, email, password );
return mumbleid;
def unregisterPlayer(self, srvid, mumbleid):
self._getIceServerObject(srvid).unregisterPlayer(mumbleid)
@ -287,8 +289,13 @@ class MumbleCtlIce_120(MumbleCtlIce_118):
return ret
def registerPlayer(self, srvid, name):
return self._getIceServerObject(srvid).registerUser( name.encode( "UTF-8" ) )
def registerPlayer(self, srvid, name, email, password):
user = {
'name': name.encode( "UTF-8" ),
'email': email.encode( "UTF-8" ),
'pw': password.encode( "UTF-8" ),
};
return self._getIceServerObject(srvid).registerUser( user );
def unregisterPlayer(self, srvid, mumbleid):
self._getIceServerObject(srvid).unregisterUser(mumbleid)

2
pyweb/mumble/mctl.py

@ -59,7 +59,7 @@ class MumbleCtlBase ():
def getChannels(self, srvid):
raise NotImplementedError( "mctl::getChannels" );
def registerPlayer(self, srvid, name):
def registerPlayer(self, srvid, name, email, password):
raise NotImplementedError( "mctl::registerPlayer" );
def setRegistration(self, srvid, mumbleid, name, email, password):

23
pyweb/mumble/models.py

@ -253,19 +253,22 @@ class MumbleUser( models.Model ):
# Before the record set is saved, update Murmur via controller.
ctl = self.server.ctl;
if self.owner:
email = self.owner.email;
else:
email = settings.DEFAULT_FROM_EMAIL;
if self.id is None:
# 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 );
if not self.password:
raise ValueError( "Cannot register player without a password!" );
self.mumbleid = ctl.registerPlayer( self.server.srvid, self.name, email, self.password );
# Update user's registration
if self.password:
if self.owner:
email = self.owner.email
else:
email = settings.DEFAULT_FROM_EMAIL;
elif self.password:
ctl.setRegistration(
self.server.srvid,
self.mumbleid,
@ -273,9 +276,9 @@ class MumbleUser( models.Model ):
email,
self.password
);
# Don't save the users' passwords, we don't need them anyway
self.password = '';
# Don't save the users' passwords, we don't need them anyway
self.password = '';
self.setAdmin( self.isAdmin );

Loading…
Cancel
Save