|
@ -27,6 +27,17 @@ from mctl import MumbleCtlBase |
|
|
import Ice |
|
|
import Ice |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def protectDjangoErrPage( func ): |
|
|
|
|
|
def protection_wrapper( *args, **kwargs ): |
|
|
|
|
|
try: |
|
|
|
|
|
return func( *args, **kwargs ); |
|
|
|
|
|
except Ice.Exception, e: |
|
|
|
|
|
raise e; |
|
|
|
|
|
|
|
|
|
|
|
return protection_wrapper; |
|
|
|
|
|
|
|
|
|
|
|
@protectDjangoErrPage |
|
|
def MumbleCtlIce( connstring ): |
|
|
def MumbleCtlIce( connstring ): |
|
|
version = settings.SLICE_VERSION; |
|
|
version = settings.SLICE_VERSION; |
|
|
|
|
|
|
|
@ -57,8 +68,6 @@ def MumbleCtlIce( connstring ): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MumbleCtlIce_118(MumbleCtlBase): |
|
|
class MumbleCtlIce_118(MumbleCtlBase): |
|
|
method = "ICE"; |
|
|
method = "ICE"; |
|
|
|
|
|
|
|
@ -66,24 +75,29 @@ class MumbleCtlIce_118(MumbleCtlBase): |
|
|
self.proxy = connstring; |
|
|
self.proxy = connstring; |
|
|
self.meta = meta; |
|
|
self.meta = meta; |
|
|
|
|
|
|
|
|
|
|
|
@protectDjangoErrPage |
|
|
def _getIceServerObject(self, srvid): |
|
|
def _getIceServerObject(self, srvid): |
|
|
return self.meta.getServer(srvid); |
|
|
return self.meta.getServer(srvid); |
|
|
|
|
|
|
|
|
|
|
|
@protectDjangoErrPage |
|
|
def getBootedServers(self): |
|
|
def getBootedServers(self): |
|
|
ret = [] |
|
|
ret = [] |
|
|
for x in self.meta.getBootedServers(): |
|
|
for x in self.meta.getBootedServers(): |
|
|
ret.append(x.id()) |
|
|
ret.append(x.id()) |
|
|
return ret |
|
|
return ret |
|
|
|
|
|
|
|
|
|
|
|
@protectDjangoErrPage |
|
|
def getVersion( self ): |
|
|
def getVersion( self ): |
|
|
return self.meta.getVersion(); |
|
|
return self.meta.getVersion(); |
|
|
|
|
|
|
|
|
|
|
|
@protectDjangoErrPage |
|
|
def getAllServers(self): |
|
|
def getAllServers(self): |
|
|
ret = [] |
|
|
ret = [] |
|
|
for x in self.meta.getAllServers(): |
|
|
for x in self.meta.getAllServers(): |
|
|
ret.append(x.id()) |
|
|
ret.append(x.id()) |
|
|
return ret |
|
|
return ret |
|
|
|
|
|
|
|
|
|
|
|
@protectDjangoErrPage |
|
|
def getRegisteredPlayers(self, srvid, filter = ''): |
|
|
def getRegisteredPlayers(self, srvid, filter = ''): |
|
|
users = self._getIceServerObject(srvid).getRegisteredPlayers( filter.encode( "UTF-8" ) ) |
|
|
users = self._getIceServerObject(srvid).getRegisteredPlayers( filter.encode( "UTF-8" ) ) |
|
|
ret = [] |
|
|
ret = [] |
|
@ -93,16 +107,11 @@ class MumbleCtlIce_118(MumbleCtlBase): |
|
|
|
|
|
|
|
|
return ret |
|
|
return ret |
|
|
|
|
|
|
|
|
|
|
|
@protectDjangoErrPage |
|
|
def getChannels(self, srvid): |
|
|
def getChannels(self, srvid): |
|
|
chans = self._getIceServerObject(srvid).getChannels() |
|
|
|
|
|
ret = [] |
|
|
|
|
|
|
|
|
|
|
|
for x in chans: |
|
|
|
|
|
chan = chans[x] |
|
|
|
|
|
ret.append([chan.id, self.setUnicodeFlag(chan.name), chan.parent, chan.links]) |
|
|
|
|
|
|
|
|
|
|
|
return ret |
|
|
|
|
|
|
|
|
return self._getIceServerObject(srvid).getChannels(); |
|
|
|
|
|
|
|
|
|
|
|
@protectDjangoErrPage |
|
|
def getPlayers(self, srvid): |
|
|
def getPlayers(self, srvid): |
|
|
users = self._getIceServerObject(srvid).getPlayers() |
|
|
users = self._getIceServerObject(srvid).getPlayers() |
|
|
ret = [] |
|
|
ret = [] |
|
@ -113,43 +122,55 @@ class MumbleCtlIce_118(MumbleCtlBase): |
|
|
|
|
|
|
|
|
return ret |
|
|
return ret |
|
|
|
|
|
|
|
|
|
|
|
@protectDjangoErrPage |
|
|
def getDefaultConf(self): |
|
|
def getDefaultConf(self): |
|
|
return self.setUnicodeFlag(self.meta.getDefaultConf()) |
|
|
return self.setUnicodeFlag(self.meta.getDefaultConf()) |
|
|
|
|
|
|
|
|
|
|
|
@protectDjangoErrPage |
|
|
def getAllConf(self, srvid): |
|
|
def getAllConf(self, srvid): |
|
|
return self.setUnicodeFlag(self._getIceServerObject(srvid).getAllConf()) |
|
|
return self.setUnicodeFlag(self._getIceServerObject(srvid).getAllConf()) |
|
|
|
|
|
|
|
|
|
|
|
@protectDjangoErrPage |
|
|
def newServer(self): |
|
|
def newServer(self): |
|
|
return self.meta.newServer().id() |
|
|
return self.meta.newServer().id() |
|
|
|
|
|
|
|
|
|
|
|
@protectDjangoErrPage |
|
|
def isBooted( self, srvid ): |
|
|
def isBooted( self, srvid ): |
|
|
return bool( self._getIceServerObject(srvid).isRunning() ); |
|
|
return bool( self._getIceServerObject(srvid).isRunning() ); |
|
|
|
|
|
|
|
|
|
|
|
@protectDjangoErrPage |
|
|
def start( self, srvid ): |
|
|
def start( self, srvid ): |
|
|
self._getIceServerObject(srvid).start(); |
|
|
self._getIceServerObject(srvid).start(); |
|
|
|
|
|
|
|
|
|
|
|
@protectDjangoErrPage |
|
|
def stop( self, srvid ): |
|
|
def stop( self, srvid ): |
|
|
self._getIceServerObject(srvid).stop(); |
|
|
self._getIceServerObject(srvid).stop(); |
|
|
|
|
|
|
|
|
|
|
|
@protectDjangoErrPage |
|
|
def deleteServer( self, srvid ): |
|
|
def deleteServer( self, srvid ): |
|
|
if self._getIceServerObject(srvid).isRunning(): |
|
|
if self._getIceServerObject(srvid).isRunning(): |
|
|
self._getIceServerObject(srvid).stop() |
|
|
self._getIceServerObject(srvid).stop() |
|
|
self._getIceServerObject(srvid).delete() |
|
|
self._getIceServerObject(srvid).delete() |
|
|
|
|
|
|
|
|
|
|
|
@protectDjangoErrPage |
|
|
def setSuperUserPassword(self, srvid, value): |
|
|
def setSuperUserPassword(self, srvid, value): |
|
|
self._getIceServerObject(srvid).setSuperuserPassword( value.encode( "UTF-8" ) ) |
|
|
self._getIceServerObject(srvid).setSuperuserPassword( value.encode( "UTF-8" ) ) |
|
|
|
|
|
|
|
|
|
|
|
@protectDjangoErrPage |
|
|
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" ) ) |
|
|
|
|
|
|
|
|
|
|
|
@protectDjangoErrPage |
|
|
def registerPlayer(self, srvid, name, email, password): |
|
|
def registerPlayer(self, srvid, name, email, password): |
|
|
mumbleid = self._getIceServerObject(srvid).registerPlayer( name.encode( "UTF-8" ) ) |
|
|
mumbleid = self._getIceServerObject(srvid).registerPlayer( name.encode( "UTF-8" ) ) |
|
|
self.setRegistration( srvid, mumbleid, name, email, password ); |
|
|
self.setRegistration( srvid, mumbleid, name, email, password ); |
|
|
return mumbleid; |
|
|
return mumbleid; |
|
|
|
|
|
|
|
|
|
|
|
@protectDjangoErrPage |
|
|
def unregisterPlayer(self, srvid, mumbleid): |
|
|
def unregisterPlayer(self, srvid, mumbleid): |
|
|
self._getIceServerObject(srvid).unregisterPlayer(mumbleid) |
|
|
self._getIceServerObject(srvid).unregisterPlayer(mumbleid) |
|
|
|
|
|
|
|
|
|
|
|
@protectDjangoErrPage |
|
|
def getRegistration(self, srvid, mumbleid): |
|
|
def getRegistration(self, srvid, mumbleid): |
|
|
user = self._getIceServerObject(srvid).getRegistration(mumbleid) |
|
|
user = self._getIceServerObject(srvid).getRegistration(mumbleid) |
|
|
return { |
|
|
return { |
|
@ -157,6 +178,7 @@ class MumbleCtlIce_118(MumbleCtlBase): |
|
|
'email': user.email, |
|
|
'email': user.email, |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
@protectDjangoErrPage |
|
|
def setRegistration(self, srvid, mumbleid, name, email, password): |
|
|
def setRegistration(self, srvid, mumbleid, name, email, password): |
|
|
user = self._getIceServerObject(srvid).getRegistration(mumbleid) |
|
|
user = self._getIceServerObject(srvid).getRegistration(mumbleid) |
|
|
user.name = name.encode( "UTF-8" ) |
|
|
user.name = name.encode( "UTF-8" ) |
|
@ -165,6 +187,7 @@ class MumbleCtlIce_118(MumbleCtlBase): |
|
|
# update*r*egistration r is lowercase... |
|
|
# update*r*egistration r is lowercase... |
|
|
return self._getIceServerObject(srvid).updateregistration(user) |
|
|
return self._getIceServerObject(srvid).updateregistration(user) |
|
|
|
|
|
|
|
|
|
|
|
@protectDjangoErrPage |
|
|
def getACL(self, srvid, channelid): |
|
|
def getACL(self, srvid, channelid): |
|
|
import Murmur |
|
|
import Murmur |
|
|
acls = self._getIceServerObject(srvid).getACL(channelid) |
|
|
acls = self._getIceServerObject(srvid).getACL(channelid) |
|
@ -184,6 +207,7 @@ class MumbleCtlIce_118(MumbleCtlBase): |
|
|
|
|
|
|
|
|
return ret |
|
|
return ret |
|
|
|
|
|
|
|
|
|
|
|
@protectDjangoErrPage |
|
|
def setACL(self, srvid, acl): |
|
|
def setACL(self, srvid, acl): |
|
|
import Murmur |
|
|
import Murmur |
|
|
|
|
|
|
|
@ -214,6 +238,7 @@ class MumbleCtlIce_118(MumbleCtlBase): |
|
|
|
|
|
|
|
|
self._getIceServerObject(srvid).setACL( acl.channelId, newacls, newgroups, acl.inherit ); |
|
|
self._getIceServerObject(srvid).setACL( acl.channelId, newacls, newgroups, acl.inherit ); |
|
|
|
|
|
|
|
|
|
|
|
@protectDjangoErrPage |
|
|
def getTexture(self, srvid, mumbleid): |
|
|
def getTexture(self, srvid, mumbleid): |
|
|
texture = self._getIceServerObject(srvid).getTexture(mumbleid) |
|
|
texture = self._getIceServerObject(srvid).getTexture(mumbleid) |
|
|
if len(texture) == 0: |
|
|
if len(texture) == 0: |
|
@ -233,6 +258,7 @@ class MumbleCtlIce_118(MumbleCtlBase): |
|
|
# return an 600x60 RGBA image object created from the data |
|
|
# return an 600x60 RGBA image object created from the data |
|
|
return Image.fromstring( "RGBA", ( 600, 60 ), imgdata ); |
|
|
return Image.fromstring( "RGBA", ( 600, 60 ), imgdata ); |
|
|
|
|
|
|
|
|
|
|
|
@protectDjangoErrPage |
|
|
def setTexture(self, srvid, mumbleid, infile): |
|
|
def setTexture(self, srvid, mumbleid, infile): |
|
|
# open image, convert to RGBA, and resize to 600x60 |
|
|
# open image, convert to RGBA, and resize to 600x60 |
|
|
img = Image.open( infile ).convert( "RGBA" ).transform( ( 600, 60 ), Image.EXTENT, ( 0, 0, 600, 60 ) ); |
|
|
img = Image.open( infile ).convert( "RGBA" ).transform( ( 600, 60 ), Image.EXTENT, ( 0, 0, 600, 60 ) ); |
|
@ -250,6 +276,7 @@ class MumbleCtlIce_118(MumbleCtlBase): |
|
|
# finally call murmur and set the texture |
|
|
# finally call murmur and set the texture |
|
|
self._getIceServerObject(srvid).setTexture(mumbleid, texture) |
|
|
self._getIceServerObject(srvid).setTexture(mumbleid, texture) |
|
|
|
|
|
|
|
|
|
|
|
@protectDjangoErrPage |
|
|
def verifyPassword(self, srvid, username, password): |
|
|
def verifyPassword(self, srvid, username, password): |
|
|
return self._getIceServerObject(srvid).verifyPassword(username, password); |
|
|
return self._getIceServerObject(srvid).verifyPassword(username, password); |
|
|
|
|
|
|
|
@ -269,6 +296,7 @@ class MumbleCtlIce_118(MumbleCtlBase): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MumbleCtlIce_120(MumbleCtlIce_118): |
|
|
class MumbleCtlIce_120(MumbleCtlIce_118): |
|
|
|
|
|
@protectDjangoErrPage |
|
|
def getRegisteredPlayers(self, srvid, filter = ''): |
|
|
def getRegisteredPlayers(self, srvid, filter = ''): |
|
|
users = self._getIceServerObject( srvid ).getRegisteredUsers( filter.encode( "UTF-8" ) ) |
|
|
users = self._getIceServerObject( srvid ).getRegisteredUsers( filter.encode( "UTF-8" ) ) |
|
|
ret = [] |
|
|
ret = [] |
|
@ -278,16 +306,7 @@ class MumbleCtlIce_120(MumbleCtlIce_118): |
|
|
|
|
|
|
|
|
return ret |
|
|
return ret |
|
|
|
|
|
|
|
|
def getChannels(self, srvid): |
|
|
|
|
|
chans = self._getIceServerObject(srvid).getChannels() |
|
|
|
|
|
ret = [] |
|
|
|
|
|
|
|
|
|
|
|
for x in chans: |
|
|
|
|
|
chan = chans[x] |
|
|
|
|
|
ret.append([chan.id, self.setUnicodeFlag(chan.name), chan.parent, chan.links, chan.description]) |
|
|
|
|
|
|
|
|
|
|
|
return ret |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@protectDjangoErrPage |
|
|
def getPlayers(self, srvid): |
|
|
def getPlayers(self, srvid): |
|
|
serv = self._getIceServerObject(srvid); |
|
|
serv = self._getIceServerObject(srvid); |
|
|
users = serv.getUsers() |
|
|
users = serv.getUsers() |
|
@ -299,6 +318,7 @@ class MumbleCtlIce_120(MumbleCtlIce_118): |
|
|
|
|
|
|
|
|
return ret |
|
|
return ret |
|
|
|
|
|
|
|
|
|
|
|
@protectDjangoErrPage |
|
|
def registerPlayer(self, srvid, name, email, password): |
|
|
def registerPlayer(self, srvid, name, email, password): |
|
|
# To get the real values of these ENUM entries, try |
|
|
# To get the real values of these ENUM entries, try |
|
|
# Murmur.UserInfo.UserX.value |
|
|
# Murmur.UserInfo.UserX.value |
|
@ -310,9 +330,11 @@ class MumbleCtlIce_120(MumbleCtlIce_118): |
|
|
}; |
|
|
}; |
|
|
return self._getIceServerObject(srvid).registerUser( user ); |
|
|
return self._getIceServerObject(srvid).registerUser( user ); |
|
|
|
|
|
|
|
|
|
|
|
@protectDjangoErrPage |
|
|
def unregisterPlayer(self, srvid, mumbleid): |
|
|
def unregisterPlayer(self, srvid, mumbleid): |
|
|
self._getIceServerObject(srvid).unregisterUser(mumbleid) |
|
|
self._getIceServerObject(srvid).unregisterUser(mumbleid) |
|
|
|
|
|
|
|
|
|
|
|
@protectDjangoErrPage |
|
|
def getRegistration(self, srvid, mumbleid): |
|
|
def getRegistration(self, srvid, mumbleid): |
|
|
from Murmur import UserInfo |
|
|
from Murmur import UserInfo |
|
|
reg = self._getIceServerObject( srvid ).getRegistration( mumbleid ) |
|
|
reg = self._getIceServerObject( srvid ).getRegistration( mumbleid ) |
|
@ -327,6 +349,7 @@ class MumbleCtlIce_120(MumbleCtlIce_118): |
|
|
user['hash'] = reg[UserInfo.UserHash]; |
|
|
user['hash'] = reg[UserInfo.UserHash]; |
|
|
return user; |
|
|
return user; |
|
|
|
|
|
|
|
|
|
|
|
@protectDjangoErrPage |
|
|
def setRegistration(self, srvid, mumbleid, name, email, password): |
|
|
def setRegistration(self, srvid, mumbleid, name, email, password): |
|
|
from Murmur import UserInfo |
|
|
from Murmur import UserInfo |
|
|
user = { |
|
|
user = { |
|
@ -336,6 +359,7 @@ class MumbleCtlIce_120(MumbleCtlIce_118): |
|
|
}; |
|
|
}; |
|
|
return self._getIceServerObject( srvid ).updateRegistration( mumbleid, user ) |
|
|
return self._getIceServerObject( srvid ).updateRegistration( mumbleid, user ) |
|
|
|
|
|
|
|
|
|
|
|
@protectDjangoErrPage |
|
|
def getACL(self, srvid, channelid): |
|
|
def getACL(self, srvid, channelid): |
|
|
import Murmur |
|
|
import Murmur |
|
|
acls = self._getIceServerObject(srvid).getACL(channelid) |
|
|
acls = self._getIceServerObject(srvid).getACL(channelid) |
|
@ -355,6 +379,7 @@ class MumbleCtlIce_120(MumbleCtlIce_118): |
|
|
|
|
|
|
|
|
return ret |
|
|
return ret |
|
|
|
|
|
|
|
|
|
|
|
@protectDjangoErrPage |
|
|
def setACL(self, srvid, acl): |
|
|
def setACL(self, srvid, acl): |
|
|
import Murmur |
|
|
import Murmur |
|
|
|
|
|
|
|
|