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.

130 lines
3.2 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. from django.conf import settings
  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():
  70. # if dbus
  71. if settings.DAOTYPE == 'dbus':
  72. from MumbleCtlDbus import MumbleCtlDbus
  73. return MumbleCtlDbus()
  74. else:
  75. from MumbleCtlIce import MumbleCtlIce
  76. return MumbleCtlIce()
  77. if __name__ == "__main__":
  78. import sys
  79. from MumbleCtlIce import MumbleCtlIce
  80. from MumbleCtlDbus import MumbleCtlDbus
  81. x = int(sys.argv[1])
  82. dbusCtl = MumbleCtlDbus()
  83. iceCtl = MumbleCtlIce()
  84. print "equal test ---"
  85. print "getBootedServers [%s]" % (dbusCtl.getBootedServers() == iceCtl.getBootedServers())
  86. print "getChannels [%s]" % (dbusCtl.getChannels(x) == iceCtl.getChannels(x))
  87. print "getPlayers [%s]" % (dbusCtl.getPlayers(x) == iceCtl.getPlayers(x))
  88. print "getACL(x, 0) [%s]" % (dbusCtl.getACL(x, 0) == iceCtl.getACL(x, 0))
  89. print "getAllServers [%s]" % (dbusCtl.getAllServers() == iceCtl.getAllServers())
  90. print "getDefaultConf [%s]" % (dbusCtl.getDefaultConf() == iceCtl.getDefaultConf())
  91. print "getAllConf(x) [%s]" % (dbusCtl.getAllConf(x) == iceCtl.getAllConf(x))
  92. print dbusCtl.getRegisteredPlayers(x)
  93. #print dbusCtl.getRegisteredPlayers(x)[3][1]
  94. print iceCtl.getRegisteredPlayers(x)
  95. #print iceCtl.getRegisteredPlayers(x)[3][1]
  96. print "getRegisteredPlayers(x) [%s]" % (dbusCtl.getRegisteredPlayers(x) == iceCtl.getRegisteredPlayers(x))
  97. #print "getTexture(2, 30) [%s]" % (dbusCtl.getTexture(2, 30) == iceCtl.getTexture(2, 30))
  98. #print dbusCtl.getTexture(2, 30).__class__