From 77896e26514eacbeee57177e0d37f983920dc663 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 11 Jul 2023 22:28:09 +0200 Subject: [PATCH 1/3] fix: rename Murmur to MumbleServer apparently due to internal renaming in mumble-server the class generated by ICE isn't called Murmur anymore. The previous state of the master branch didn't even start for me anymore. Renaming Murmur to MumbleServer seems to fix this issue for me. --- mumo.py | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/mumo.py b/mumo.py index 49425b6..b318feb 100755 --- a/mumo.py +++ b/mumo.py @@ -159,7 +159,7 @@ def do_main_program(): fsload_slice(cfg.ice.slice) # noinspection PyUnresolvedReferences - import Murmur + import MumbleServer class mumoIceApp(Ice.Application): def __init__(self, manager): @@ -200,7 +200,7 @@ def initializeIceConnection(self): info('Connecting to Ice server (%s:%d)', cfg.ice.host, cfg.ice.port) base = ice.stringToProxy(prxstr) - self.meta = Murmur.MetaPrx.uncheckedCast(base) + self.meta = MumbleServer.MetaPrx.uncheckedCast(base) if cfg.ice.callback_port > 0: cbp = ' -p %d' % cfg.ice.callback_port @@ -214,7 +214,7 @@ def initializeIceConnection(self): self.manager.setClientAdapter(adapter) metacbprx = adapter.addWithUUID(metaCallback(self)) - self.metacb = Murmur.MetaCallbackPrx.uncheckedCast(metacbprx) + self.metacb = MumbleServer.MetaCallbackPrx.uncheckedCast(metacbprx) return self.attachCallbacks() @@ -234,15 +234,15 @@ def attachCallbacks(self): if not cfg.murmur.servers or sid in cfg.murmur.servers: info('Setting callbacks for virtual server %d', sid) servercbprx = self.adapter.addWithUUID(serverCallback(self.manager, server, sid)) - servercb = Murmur.ServerCallbackPrx.uncheckedCast(servercbprx) + servercb = MumbleServer.ServerCallbackPrx.uncheckedCast(servercbprx) server.addCallback(servercb) - except (Murmur.InvalidSecretException, Ice.UnknownUserException, Ice.ConnectionRefusedException) as e: + except (MumbleServer.InvalidSecretException, Ice.UnknownUserException, Ice.ConnectionRefusedException) as e: if isinstance(e, Ice.ConnectionRefusedException): error('Server refused connection') - elif isinstance(e, Murmur.InvalidSecretException) or \ + elif isinstance(e, MumbleServer.InvalidSecretException) or \ isinstance(e, Ice.UnknownUserException) and ( - e.unknown == 'Murmur::InvalidSecretException'): + e.unknown == 'MumbleServer::InvalidSecretException'): error('Invalid ice secret') else: # We do not actually want to handle this one, re-raise it @@ -300,7 +300,7 @@ def newfunc(*args, **kws): if not current or 'secret' not in current.ctx or current.ctx['secret'] != cfg.ice.secret: error('Server transmitted invalid secret. Possible injection attempt.') - raise Murmur.InvalidSecretException() + raise MumbleServer.InvalidSecretException() return func(*args, **kws) @@ -337,9 +337,9 @@ def newfunc(*args, **kws): return newdec - class metaCallback(Murmur.MetaCallback): + class metaCallback(MumbleServer.MetaCallback): def __init__(self, app): - Murmur.MetaCallback.__init__(self) + MumbleServer.MetaCallback.__init__(self) self.app = app @fortifyIceFu() @@ -354,12 +354,12 @@ def started(self, server, current=None): info('Setting callbacks for virtual server %d', server.id()) try: servercbprx = self.app.adapter.addWithUUID(serverCallback(self.app.manager, server, sid)) - servercb = Murmur.ServerCallbackPrx.uncheckedCast(servercbprx) + servercb = MumbleServer.ServerCallbackPrx.uncheckedCast(servercbprx) server.addCallback(servercb) # Apparently this server was restarted without us noticing - except (Murmur.InvalidSecretException, Ice.UnknownUserException) as e: - if hasattr(e, "unknown") and e.unknown != "Murmur::InvalidSecretException": + except (MumbleServer.InvalidSecretException, Ice.UnknownUserException) as e: + if hasattr(e, "unknown") and e.unknown != "MumbleServer::InvalidSecretException": # Special handling for Murmur 1.2.2 servers with invalid slice files raise e @@ -399,9 +399,9 @@ def new_fu(self, *args, **kwargs): return new_fu - class serverCallback(Murmur.ServerCallback): + class serverCallback(MumbleServer.ServerCallback): def __init__(self, manager, server, sid): - Murmur.ServerCallback.__init__(self) + MumbleServer.ServerCallback.__init__(self) self.manager = manager self.sid = sid self.server = server @@ -441,9 +441,9 @@ def channelStateChanged(self, c, current=None): pass @forwardServer def userTextMessage(self, u, m, current=None): pass - class customContextCallback(Murmur.ServerContextCallback): + class customContextCallback(MumbleServer.ServerContextCallback): def __init__(self, contextActionCallback, *ctx): - Murmur.ServerContextCallback.__init__(self) + MumbleServer.ServerContextCallback.__init__(self) self.cb = contextActionCallback self.ctx = ctx @@ -457,7 +457,7 @@ def contextAction(self, *args, **argv): # info('Starting mumble moderator') debug('Initializing manager') - manager = MumoManager(Murmur, customContextCallback) + manager = MumoManager(MumbleServer, customContextCallback) manager.start() manager.loadModules() manager.startModules() From 41fb0cb44dc30b55db260bea2ec72e4645978b75 Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 12 Jul 2023 23:21:50 +0200 Subject: [PATCH 2/3] fix: handle ModuleNotFoundError on mumble <1.5 on older Versions of the mumble server the generated module is called "Murmur" instead of "MumbleServer" so try importing this if "MumbleServer" isn't found. --- mumo.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mumo.py b/mumo.py index b318feb..4318a6f 100755 --- a/mumo.py +++ b/mumo.py @@ -159,7 +159,11 @@ def do_main_program(): fsload_slice(cfg.ice.slice) # noinspection PyUnresolvedReferences - import MumbleServer + try: + import MumbleServer + except ModuleNotFoundError: + # on Mumble <1.5 try to import Murmur instead + import Murmur as MumbleServer class mumoIceApp(Ice.Application): def __init__(self, manager): From 21164e1619ec54141225b8d1d7b486417b252019 Mon Sep 17 00:00:00 2001 From: Jan Klass Date: Thu, 13 Jul 2023 17:21:47 +0200 Subject: [PATCH 3/3] fix: Be more specific in fallback comment --- mumo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mumo.py b/mumo.py index 4318a6f..02dcbd8 100755 --- a/mumo.py +++ b/mumo.py @@ -162,7 +162,7 @@ def do_main_program(): try: import MumbleServer except ModuleNotFoundError: - # on Mumble <1.5 try to import Murmur instead + # Try to import Mumble <1.5 name `Murmur` instead import Murmur as MumbleServer class mumoIceApp(Ice.Application):