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. 17
      pyweb/mumble/models.py

6
pyweb/mumble/MumbleCtlDbus.py

@ -70,8 +70,10 @@ class MumbleCtlDbus(MumbleCtlBase):
def newServer(self): def newServer(self):
return self.meta.newServer() 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): def unregisterPlayer(self, srvid, mumbleid):
self._getDbusServerObject(srvid).unregisterPlayer(dbus.Int32( 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): def setConf(self, srvid, key, value):
self._getIceServerObject(srvid).setConf( key, value.encode( "UTF-8" ) ) 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): def unregisterPlayer(self, srvid, mumbleid):
self._getIceServerObject(srvid).unregisterPlayer(mumbleid) self._getIceServerObject(srvid).unregisterPlayer(mumbleid)
@ -287,8 +289,13 @@ class MumbleCtlIce_120(MumbleCtlIce_118):
return ret 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): def unregisterPlayer(self, srvid, mumbleid):
self._getIceServerObject(srvid).unregisterUser(mumbleid) self._getIceServerObject(srvid).unregisterUser(mumbleid)

2
pyweb/mumble/mctl.py

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

17
pyweb/mumble/models.py

@ -253,19 +253,22 @@ class MumbleUser( models.Model ):
# Before the record set is saved, update Murmur via controller. # Before the record set is saved, update Murmur via controller.
ctl = self.server.ctl; ctl = self.server.ctl;
if self.owner:
email = self.owner.email;
else:
email = settings.DEFAULT_FROM_EMAIL;
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: if len( ctl.getRegisteredPlayers( self.server.srvid, self.name ) ) > 0:
raise ValueError( "Another player already registered that name." ); 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!" );
# Update user's registration
if self.password:
if self.owner:
email = self.owner.email
else:
email = settings.DEFAULT_FROM_EMAIL;
self.mumbleid = ctl.registerPlayer( self.server.srvid, self.name, email, self.password );
# Update user's registration
elif self.password:
ctl.setRegistration( ctl.setRegistration(
self.server.srvid, self.server.srvid,
self.mumbleid, self.mumbleid,

Loading…
Cancel
Save