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.

134 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 setConf(self, srvid, key, value):
  25. pass
  26. def getDefaultConf(self):
  27. pass
  28. def getValue(self, srvid, key):
  29. pass
  30. def newServer(self):
  31. pass
  32. def setSuperUserPassword(self, srvid, value):
  33. pass
  34. def start(self, srvid):
  35. pass
  36. def stop(self, srvid):
  37. pass
  38. def isBooted(self, srvid):
  39. pass
  40. def deleteServer(self, srvid):
  41. pass
  42. def getUsers(self, srvid):
  43. pass
  44. def getPlayers(self, srvid):
  45. pass
  46. def getRegisteredPlayers(self, srvid):
  47. pass
  48. def getChannels(self, srvid):
  49. pass
  50. def registerPlayer(self, srvid, name):
  51. pass
  52. def setRegistration(self, srvid, mumbleid, name, email, password):
  53. pass
  54. def unregisterPlayer(self, srvid, mumbleid):
  55. pass
  56. def getBootedServers(self):
  57. pass
  58. def getAllServers(self):
  59. pass
  60. def getACL(self, srvid, identifier):
  61. pass
  62. def setACL(self, srvid, acl):
  63. pass
  64. def getTexture(self, srvid, mumbleid):
  65. pass
  66. def setTexture(self, srvid, mumbleid, infile):
  67. pass
  68. @staticmethod
  69. def newInstance( connstring ):
  70. # connstring defines whether to connect via ICE or DBus.
  71. # Dbus service names: some.words.divided.by.periods
  72. # ICE specs are WAY more complex, so if DBus doesn't match, use ICE.
  73. rd = re.compile( r'^(\w+\.)*\w+$' );
  74. if rd.match( connstring ):
  75. from MumbleCtlDbus import MumbleCtlDbus
  76. return MumbleCtlDbus( connstring )
  77. else:
  78. from MumbleCtlIce import MumbleCtlIce
  79. return MumbleCtlIce( connstring )
  80. if __name__ == "__main__":
  81. import sys
  82. from MumbleCtlIce import MumbleCtlIce
  83. from MumbleCtlDbus import MumbleCtlDbus
  84. x = int(sys.argv[1])
  85. dbusCtl = MumbleCtlDbus()
  86. iceCtl = MumbleCtlIce()
  87. print "equal test ---"
  88. print "getBootedServers [%s]" % (dbusCtl.getBootedServers() == iceCtl.getBootedServers())
  89. print "getChannels [%s]" % (dbusCtl.getChannels(x) == iceCtl.getChannels(x))
  90. print "getPlayers [%s]" % (dbusCtl.getPlayers(x) == iceCtl.getPlayers(x))
  91. print "getACL(x, 0) [%s]" % (dbusCtl.getACL(x, 0) == iceCtl.getACL(x, 0))
  92. print "getAllServers [%s]" % (dbusCtl.getAllServers() == iceCtl.getAllServers())
  93. print "getDefaultConf [%s]" % (dbusCtl.getDefaultConf() == iceCtl.getDefaultConf())
  94. print "getAllConf(x) [%s]" % (dbusCtl.getAllConf(x) == iceCtl.getAllConf(x))
  95. print dbusCtl.getRegisteredPlayers(x)
  96. #print dbusCtl.getRegisteredPlayers(x)[3][1]
  97. print iceCtl.getRegisteredPlayers(x)
  98. #print iceCtl.getRegisteredPlayers(x)[3][1]
  99. print "getRegisteredPlayers(x) [%s]" % (dbusCtl.getRegisteredPlayers(x) == iceCtl.getRegisteredPlayers(x))
  100. #print "getTexture(2, 30) [%s]" % (dbusCtl.getTexture(2, 30) == iceCtl.getTexture(2, 30))
  101. #print dbusCtl.getTexture(2, 30).__class__