Forked mumble-django project from https://bitbucket.org/Svedrin/mumble-django

58 lines
2.2 KiB

  1. # -*- coding: utf-8 -*-
  2. # kate: space-indent on; indent-width 4; replace-tabs on;
  3. """
  4. * Copyright © 2009-2010, 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 Ice, IcePy, os, getpass
  17. from sys import stderr
  18. from django.core.management.base import BaseCommand
  19. from mumble.models import MumbleServer
  20. class Command( BaseCommand ):
  21. help = "Check if the known servers support getSlice."
  22. def handle(self, **options):
  23. prop = Ice.createProperties([])
  24. prop.setProperty("Ice.ImplicitContext", "Shared")
  25. idd = Ice.InitializationData()
  26. idd.properties = prop
  27. ice = Ice.initialize(idd)
  28. for serv in MumbleServer.objects.all():
  29. print >>stderr, "Probing server at '%s'..." % serv.dbus
  30. if serv.secret:
  31. ice.getImplicitContext().put( "secret", serv.secret.encode("utf-8") )
  32. prx = ice.stringToProxy( serv.dbus.encode("utf-8") )
  33. # Try loading the Slice from Murmur directly via its getSlice method.
  34. try:
  35. slice = IcePy.Operation( 'getSlice',
  36. Ice.OperationMode.Idempotent, Ice.OperationMode.Idempotent,
  37. True, (), (), (), IcePy._t_string, ()
  38. ).invoke(prx, ((), None))
  39. except TypeError, err:
  40. print >>stderr, " Received TypeError:", err
  41. print >>stderr, " It seems your version of IcePy is incompatible."
  42. except Ice.OperationNotExistException:
  43. print >>stderr, " Your version of Murmur does not support getSlice."
  44. else:
  45. print slice
  46. print >>stderr, " Successfully received the slice (length: %d bytes.)" % len(slice)