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.

57 lines
1.9 KiB

  1. # -*- coding: utf-8 -*-
  2. """
  3. * Copyright © 2009-2010, Michael "Svedrin" Ziegler <diese-addy@funzt-halt.net>
  4. *
  5. * Mumble-Django is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This package is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. """
  15. import Ice, IcePy, os, getpass
  16. from sys import stderr
  17. from django.core.management.base import BaseCommand
  18. from mumble.models import MumbleServer
  19. class Command( BaseCommand ):
  20. help = "Check if the known servers support getSlice."
  21. def handle(self, **options):
  22. prop = Ice.createProperties([])
  23. prop.setProperty("Ice.ImplicitContext", "Shared")
  24. idd = Ice.InitializationData()
  25. idd.properties = prop
  26. ice = Ice.initialize(idd)
  27. for serv in MumbleServer.objects.all():
  28. print >>stderr, "Probing server at '%s'..." % serv.dbus
  29. if serv.secret:
  30. ice.getImplicitContext().put( "secret", serv.secret.encode("utf-8") )
  31. prx = ice.stringToProxy( serv.dbus.encode("utf-8") )
  32. # Try loading the Slice from Murmur directly via its getSlice method.
  33. try:
  34. slice = IcePy.Operation( 'getSlice',
  35. Ice.OperationMode.Idempotent, Ice.OperationMode.Idempotent,
  36. True, (), (), (), IcePy._t_string, ()
  37. ).invoke(prx, ((), None))
  38. except TypeError, err:
  39. print >>stderr, " Received TypeError:", err
  40. print >>stderr, " It seems your version of IcePy is incompatible."
  41. except Ice.OperationNotExistException:
  42. print >>stderr, " Your version of Murmur does not support getSlice."
  43. else:
  44. print slice
  45. print >>stderr, " Successfully received the slice (length: %d bytes.)" % len(slice)