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.

121 lines
3.6 KiB

15 years ago
15 years ago
15 years ago
15 years ago
15 years ago
15 years ago
15 years ago
15 years ago
15 years ago
15 years ago
15 years ago
15 years ago
15 years ago
15 years ago
15 years ago
15 years ago
15 years ago
15 years ago
15 years ago
15 years ago
15 years ago
15 years ago
  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. import re
  17. class MumbleCtlBase (object):
  18. """ This class defines the base interface that the Mumble model expects. """
  19. cache = {};
  20. def getAllConf(self, srvid):
  21. raise NotImplementedError( "mctl::getAllConf" );
  22. def getVersion( self ):
  23. raise NotImplementedError( "mctl::getVersion" );
  24. def setConf(self, srvid, key, value):
  25. raise NotImplementedError( "mctl::setConf" );
  26. def getDefaultConf(self):
  27. raise NotImplementedError( "mctl::getDefaultConf" );
  28. def newServer(self):
  29. raise NotImplementedError( "mctl::newServer" );
  30. def setSuperUserPassword(self, srvid, value):
  31. raise NotImplementedError( "mctl::setSuperUserPassword" );
  32. def start(self, srvid):
  33. raise NotImplementedError( "mctl::start" );
  34. def stop(self, srvid):
  35. raise NotImplementedError( "mctl::stop" );
  36. def isBooted(self, srvid):
  37. raise NotImplementedError( "mctl::isBooted" );
  38. def deleteServer(self, srvid):
  39. raise NotImplementedError( "mctl::deleteServer" );
  40. def getPlayers(self, srvid):
  41. raise NotImplementedError( "mctl::getPlayers" );
  42. def getRegisteredPlayers(self, srvid, filter):
  43. raise NotImplementedError( "mctl::getRegisteredPlayers" );
  44. def getChannels(self, srvid):
  45. raise NotImplementedError( "mctl::getChannels" );
  46. def registerPlayer(self, srvid, name, email, password):
  47. raise NotImplementedError( "mctl::registerPlayer" );
  48. def getRegistration(self, srvid, mumbleid):
  49. raise NotImplementedError( "mctl::getRegistration" );
  50. def setRegistration(self, srvid, mumbleid, name, email, password):
  51. raise NotImplementedError( "mctl::setRegistration" );
  52. def unregisterPlayer(self, srvid, mumbleid):
  53. raise NotImplementedError( "mctl::unregisterPlayer" );
  54. def getBootedServers(self):
  55. raise NotImplementedError( "mctl::getBootedServers" );
  56. def getAllServers(self):
  57. raise NotImplementedError( "mctl::getAllServers" );
  58. def getACL(self, srvid, channelid):
  59. raise NotImplementedError( "mctl::getACL" );
  60. def setACL(self, srvid, acl):
  61. raise NotImplementedError( "mctl::setACL" );
  62. def getTexture(self, srvid, mumbleid):
  63. raise NotImplementedError( "mctl::getTexture" );
  64. def setTexture(self, srvid, mumbleid, infile):
  65. raise NotImplementedError( "mctl::setTexture" );
  66. def verifyPassword( self, srvid, username, password ):
  67. raise NotImplementedError( "mctl::verifyPassword" );
  68. @staticmethod
  69. def newInstance( connstring ):
  70. """ Create a new CTL object for the given connstring. """
  71. # check cache
  72. if connstring in MumbleCtlBase.cache:
  73. return MumbleCtlBase.cache[connstring];
  74. # connstring defines whether to connect via ICE or DBus.
  75. # Dbus service names: some.words.divided.by.periods
  76. # ICE specs are WAY more complex, so if DBus doesn't match, use ICE.
  77. rd = re.compile( r'^(\w+\.)*\w+$' );
  78. if rd.match( connstring ):
  79. from MumbleCtlDbus import MumbleCtlDbus
  80. ctl = MumbleCtlDbus( connstring )
  81. else:
  82. from MumbleCtlIce import MumbleCtlIce
  83. ctl = MumbleCtlIce( connstring )
  84. MumbleCtlBase.cache[connstring] = ctl;
  85. return ctl;