|
|
@ -12,9 +12,15 @@ import dbus |
|
|
|
class MumbleCtlBase (): |
|
|
|
''' abstract Ctrol Object ''' |
|
|
|
|
|
|
|
def getAllConf(self, srvid): |
|
|
|
pass |
|
|
|
|
|
|
|
def setConf(self, srvid, key, value): |
|
|
|
pass |
|
|
|
|
|
|
|
def getDefaultConf(self): |
|
|
|
pass |
|
|
|
|
|
|
|
def getValue(self, srvid, key): |
|
|
|
pass |
|
|
|
|
|
|
@ -42,6 +48,9 @@ class MumbleCtlBase (): |
|
|
|
def getPlayers(self, srvid): |
|
|
|
pass |
|
|
|
|
|
|
|
def getRegisteredPlayers(self, srvid): |
|
|
|
pass |
|
|
|
|
|
|
|
def getChannels(self, srvid): |
|
|
|
pass |
|
|
|
|
|
|
@ -57,6 +66,9 @@ class MumbleCtlBase (): |
|
|
|
def getBootedServers(self): |
|
|
|
pass |
|
|
|
|
|
|
|
def getAllServers(self): |
|
|
|
pass |
|
|
|
|
|
|
|
def getACL(self, srvid, identifier): |
|
|
|
pass |
|
|
|
|
|
|
@ -91,9 +103,15 @@ class MumbleCtlDbus(MumbleCtlBase): |
|
|
|
|
|
|
|
return dbus.Interface( dbus.SystemBus().get_object( self.dbus_base, '/%d' % srvid ), 'net.sourceforge.mumble.Murmur' ); |
|
|
|
|
|
|
|
def getAllConf(self, srvid): |
|
|
|
return MumbleCtlDbus.converDbusTypeToNative(self.meta.getAllConf(dbus.Int32(srvid))) |
|
|
|
|
|
|
|
def setConf(self, srvid, key, value): |
|
|
|
self.meta.setConf(dbus.Int32( srvid ), key, value) |
|
|
|
|
|
|
|
def getDefaultConf(self): |
|
|
|
return MumbleCtlDbus.converDbusTypeToNative(self.meta.getDefaultConf()) |
|
|
|
|
|
|
|
def deleteServer( self, srvid ): |
|
|
|
srvid = dbus.Int32( srvid ) |
|
|
|
if self.meta.isBooted( srvid ): |
|
|
@ -116,6 +134,9 @@ class MumbleCtlDbus(MumbleCtlBase): |
|
|
|
def getPlayers(self, srvid): |
|
|
|
return MumbleCtlDbus.converDbusTypeToNative(self._getDbusServerObject(srvid).getPlayers()) |
|
|
|
|
|
|
|
def getRegisteredPlayers(self, srvid): |
|
|
|
return MumbleCtlDbus.converDbusTypeToNative(self._getDbusServerObject(srvid).getRegisteredPlayers('')) |
|
|
|
|
|
|
|
def getACL(self, srvid, identifier): |
|
|
|
return MumbleCtlDbus.converDbusTypeToNative(self._getDbusServerObject(srvid).getACL(identifier)) |
|
|
|
|
|
|
@ -125,6 +146,9 @@ class MumbleCtlDbus(MumbleCtlBase): |
|
|
|
def getBootedServers(self): |
|
|
|
return MumbleCtlDbus.converDbusTypeToNative(self.meta.getBootedServers()) |
|
|
|
|
|
|
|
def getAllServers(self): |
|
|
|
return MumbleCtlDbus.converDbusTypeToNative(self.meta.getAllServers()) |
|
|
|
|
|
|
|
def setSuperUserPassword(self, srvid, value): |
|
|
|
self.meta.setSuperUserPassword(dbus.Int32(srvid), value) |
|
|
|
|
|
|
@ -137,15 +161,19 @@ class MumbleCtlDbus(MumbleCtlBase): |
|
|
|
#but dbus.* type is not native type. it's not good transparent for using Ice/Dbus. |
|
|
|
ret = None |
|
|
|
|
|
|
|
if isinstance(data, tuple) or type(data) is data.__class__ is dbus.Array or data.__class__ is dbus.Struct : |
|
|
|
if isinstance(data, tuple) or type(data) is data.__class__ is dbus.Array or data.__class__ is dbus.Struct: |
|
|
|
ret = [] |
|
|
|
for x in data: |
|
|
|
ret.append(MumbleCtlDbus.converDbusTypeToNative(x)) |
|
|
|
elif data.__class__ is dbus.Dictionary: |
|
|
|
ret = {} |
|
|
|
for x in data.items(): |
|
|
|
ret[MumbleCtlDbus.converDbusTypeToNative(x[0])] = MumbleCtlDbus.converDbusTypeToNative(x[1]) |
|
|
|
else: |
|
|
|
if data.__class__ is dbus.Boolean: |
|
|
|
ret = bool(data) |
|
|
|
elif data.__class__ is dbus.String: |
|
|
|
ret = str(data) |
|
|
|
ret = unicode(data) |
|
|
|
elif data.__class__ is dbus.Int32 or data.__class__ is dbus.UInt32: |
|
|
|
ret = int(data) |
|
|
|
return ret |
|
|
@ -163,6 +191,12 @@ if __name__ == "__main__": |
|
|
|
print ctl.getPlayers(1) |
|
|
|
print "getACL", ctl.getACL(1, 0) |
|
|
|
print ctl.getACL(1, 0)[0].__class__ is dbus.Array |
|
|
|
print "getAllServers()" |
|
|
|
print ctl.getAllServers() |
|
|
|
print "getDefaultConf()" |
|
|
|
print ctl.getDefaultConf() |
|
|
|
print "getAllConf(1)" |
|
|
|
print ctl.getAllConf(1) |
|
|
|
|
|
|
|
print "--- test end" |
|
|
|
|