|
@ -12,9 +12,15 @@ import dbus |
|
|
class MumbleCtlBase (): |
|
|
class MumbleCtlBase (): |
|
|
''' abstract Ctrol Object ''' |
|
|
''' abstract Ctrol Object ''' |
|
|
|
|
|
|
|
|
|
|
|
def getAllConf(self, srvid): |
|
|
|
|
|
pass |
|
|
|
|
|
|
|
|
def setConf(self, srvid, key, value): |
|
|
def setConf(self, srvid, key, value): |
|
|
pass |
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
def getDefaultConf(self): |
|
|
|
|
|
pass |
|
|
|
|
|
|
|
|
def getValue(self, srvid, key): |
|
|
def getValue(self, srvid, key): |
|
|
pass |
|
|
pass |
|
|
|
|
|
|
|
@ -42,6 +48,9 @@ class MumbleCtlBase (): |
|
|
def getPlayers(self, srvid): |
|
|
def getPlayers(self, srvid): |
|
|
pass |
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
def getRegisteredPlayers(self, srvid): |
|
|
|
|
|
pass |
|
|
|
|
|
|
|
|
def getChannels(self, srvid): |
|
|
def getChannels(self, srvid): |
|
|
pass |
|
|
pass |
|
|
|
|
|
|
|
@ -57,6 +66,9 @@ class MumbleCtlBase (): |
|
|
def getBootedServers(self): |
|
|
def getBootedServers(self): |
|
|
pass |
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
def getAllServers(self): |
|
|
|
|
|
pass |
|
|
|
|
|
|
|
|
def getACL(self, srvid, identifier): |
|
|
def getACL(self, srvid, identifier): |
|
|
pass |
|
|
pass |
|
|
|
|
|
|
|
@ -91,9 +103,15 @@ class MumbleCtlDbus(MumbleCtlBase): |
|
|
|
|
|
|
|
|
return dbus.Interface( dbus.SystemBus().get_object( self.dbus_base, '/%d' % srvid ), 'net.sourceforge.mumble.Murmur' ); |
|
|
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): |
|
|
def setConf(self, srvid, key, value): |
|
|
self.meta.setConf(dbus.Int32( srvid ), key, value) |
|
|
self.meta.setConf(dbus.Int32( srvid ), key, value) |
|
|
|
|
|
|
|
|
|
|
|
def getDefaultConf(self): |
|
|
|
|
|
return MumbleCtlDbus.converDbusTypeToNative(self.meta.getDefaultConf()) |
|
|
|
|
|
|
|
|
def deleteServer( self, srvid ): |
|
|
def deleteServer( self, srvid ): |
|
|
srvid = dbus.Int32( srvid ) |
|
|
srvid = dbus.Int32( srvid ) |
|
|
if self.meta.isBooted( srvid ): |
|
|
if self.meta.isBooted( srvid ): |
|
@ -116,6 +134,9 @@ 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 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)) |
|
|
|
|
|
|
|
@ -125,6 +146,9 @@ class MumbleCtlDbus(MumbleCtlBase): |
|
|
def getBootedServers(self): |
|
|
def getBootedServers(self): |
|
|
return MumbleCtlDbus.converDbusTypeToNative(self.meta.getBootedServers()) |
|
|
return MumbleCtlDbus.converDbusTypeToNative(self.meta.getBootedServers()) |
|
|
|
|
|
|
|
|
|
|
|
def getAllServers(self): |
|
|
|
|
|
return MumbleCtlDbus.converDbusTypeToNative(self.meta.getAllServers()) |
|
|
|
|
|
|
|
|
def setSuperUserPassword(self, srvid, value): |
|
|
def setSuperUserPassword(self, srvid, value): |
|
|
self.meta.setSuperUserPassword(dbus.Int32(srvid), value) |
|
|
self.meta.setSuperUserPassword(dbus.Int32(srvid), value) |
|
|
|
|
|
|
|
@ -141,11 +165,15 @@ class MumbleCtlDbus(MumbleCtlBase): |
|
|
ret = [] |
|
|
ret = [] |
|
|
for x in data: |
|
|
for x in data: |
|
|
ret.append(MumbleCtlDbus.converDbusTypeToNative(x)) |
|
|
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: |
|
|
else: |
|
|
if data.__class__ is dbus.Boolean: |
|
|
if data.__class__ is dbus.Boolean: |
|
|
ret = bool(data) |
|
|
ret = bool(data) |
|
|
elif data.__class__ is dbus.String: |
|
|
elif data.__class__ is dbus.String: |
|
|
ret = str(data) |
|
|
|
|
|
|
|
|
ret = unicode(data) |
|
|
elif data.__class__ is dbus.Int32 or data.__class__ is dbus.UInt32: |
|
|
elif data.__class__ is dbus.Int32 or data.__class__ is dbus.UInt32: |
|
|
ret = int(data) |
|
|
ret = int(data) |
|
|
return ret |
|
|
return ret |
|
@ -163,6 +191,12 @@ if __name__ == "__main__": |
|
|
print ctl.getPlayers(1) |
|
|
print ctl.getPlayers(1) |
|
|
print "getACL", ctl.getACL(1, 0) |
|
|
print "getACL", ctl.getACL(1, 0) |
|
|
print ctl.getACL(1, 0)[0].__class__ is dbus.Array |
|
|
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" |
|
|
print "--- test end" |
|
|
|
|
|
|