Forked mumble-django project from https://bitbucket.org/Svedrin/mumble-django
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

137 lines
3.5 KiB

  1. # -*- coding: utf-8 -*-
  2. """
  3. * Copyright (C) 2009, withgod <withgod@sourceforge.net>
  4. * Michael "Svedrin" Ziegler <diese-addy@funzt-halt.net>
  5. *
  6. * Mumble-Django is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This package is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. """
  16. #zope.interface is good but don't standard interface library
  17. #abc is better but 2.6 higher.
  18. #import abc
  19. import re
  20. class MumbleCtlBase ():
  21. ''' abstract Ctrol Object '''
  22. def getAllConf(self, srvid):
  23. pass
  24. def getVersion( self ):
  25. pass
  26. def setConf(self, srvid, key, value):
  27. pass
  28. def getDefaultConf(self):
  29. pass
  30. def getValue(self, srvid, key):
  31. pass
  32. def newServer(self):
  33. pass
  34. def setSuperUserPassword(self, srvid, value):
  35. pass
  36. def start(self, srvid):
  37. pass
  38. def stop(self, srvid):
  39. pass
  40. def isBooted(self, srvid):
  41. pass
  42. def deleteServer(self, srvid):
  43. pass
  44. def getUsers(self, srvid):
  45. pass
  46. def getPlayers(self, srvid):
  47. pass
  48. def getRegisteredPlayers(self, srvid, filter):
  49. pass
  50. def getChannels(self, srvid):
  51. pass
  52. def registerPlayer(self, srvid, name):
  53. pass
  54. def setRegistration(self, srvid, mumbleid, name, email, password):
  55. pass
  56. def unregisterPlayer(self, srvid, mumbleid):
  57. pass
  58. def getBootedServers(self):
  59. pass
  60. def getAllServers(self):
  61. pass
  62. def getACL(self, srvid, identifier):
  63. pass
  64. def setACL(self, srvid, acl):
  65. pass
  66. def getTexture(self, srvid, mumbleid):
  67. pass
  68. def setTexture(self, srvid, mumbleid, infile):
  69. pass
  70. @staticmethod
  71. def newInstance( connstring ):
  72. # connstring defines whether to connect via ICE or DBus.
  73. # Dbus service names: some.words.divided.by.periods
  74. # ICE specs are WAY more complex, so if DBus doesn't match, use ICE.
  75. rd = re.compile( r'^(\w+\.)*\w+$' );
  76. if rd.match( connstring ):
  77. from MumbleCtlDbus import MumbleCtlDbus
  78. return MumbleCtlDbus( connstring )
  79. else:
  80. from MumbleCtlIce import MumbleCtlIce
  81. return MumbleCtlIce( connstring )
  82. if __name__ == "__main__":
  83. import sys
  84. from MumbleCtlIce import MumbleCtlIce
  85. from MumbleCtlDbus import MumbleCtlDbus
  86. x = int(sys.argv[1])
  87. dbusCtl = MumbleCtlDbus()
  88. iceCtl = MumbleCtlIce()
  89. print "equal test ---"
  90. print "getBootedServers [%s]" % (dbusCtl.getBootedServers() == iceCtl.getBootedServers())
  91. print "getChannels [%s]" % (dbusCtl.getChannels(x) == iceCtl.getChannels(x))
  92. print "getPlayers [%s]" % (dbusCtl.getPlayers(x) == iceCtl.getPlayers(x))
  93. print "getACL(x, 0) [%s]" % (dbusCtl.getACL(x, 0) == iceCtl.getACL(x, 0))
  94. print "getAllServers [%s]" % (dbusCtl.getAllServers() == iceCtl.getAllServers())
  95. print "getDefaultConf [%s]" % (dbusCtl.getDefaultConf() == iceCtl.getDefaultConf())
  96. print "getAllConf(x) [%s]" % (dbusCtl.getAllConf(x) == iceCtl.getAllConf(x))
  97. print dbusCtl.getRegisteredPlayers(x)
  98. #print dbusCtl.getRegisteredPlayers(x)[3][1]
  99. print iceCtl.getRegisteredPlayers(x)
  100. #print iceCtl.getRegisteredPlayers(x)[3][1]
  101. print "getRegisteredPlayers(x) [%s]" % (dbusCtl.getRegisteredPlayers(x) == iceCtl.getRegisteredPlayers(x))
  102. #print "getTexture(2, 30) [%s]" % (dbusCtl.getTexture(2, 30) == iceCtl.getTexture(2, 30))
  103. #print dbusCtl.getTexture(2, 30).__class__