jabber mirror: Remove code for occupy/vacate events.

The server no longer sends occupy/vacate events
for streams.

The mirror should continue to work fine by processing
subsription-related events.
This commit is contained in:
Steve Howell 2020-10-20 16:18:36 +00:00 committed by Tim Abbott
parent befbb953dd
commit f100ab07aa

View file

@ -219,8 +219,6 @@ class ZulipToJabberBot:
logging.exception("Exception forwarding Zulip => Jabber") logging.exception("Exception forwarding Zulip => Jabber")
elif event['type'] == 'subscription': elif event['type'] == 'subscription':
self.process_subscription(event) self.process_subscription(event)
elif event['type'] == 'stream':
self.process_stream(event)
def stream_message(self, msg: Dict[str, str]) -> None: def stream_message(self, msg: Dict[str, str]) -> None:
assert(self.jabber is not None) assert(self.jabber is not None)
@ -266,19 +264,6 @@ class ZulipToJabberBot:
for stream in streams: for stream in streams:
self.jabber.leave_muc(stream_to_room(stream)) self.jabber.leave_muc(stream_to_room(stream))
def process_stream(self, event: Dict[str, Any]) -> None:
assert(self.jabber is not None)
if event['op'] == 'occupy':
streams = [s['name'].lower() for s in event['streams']]
streams = [s for s in streams if s.endswith("/xmpp")]
for stream in streams:
self.jabber.join_muc(stream_to_room(stream))
if event['op'] == 'vacate':
streams = [s['name'].lower() for s in event['streams']]
streams = [s for s in streams if s.endswith("/xmpp")]
for stream in streams:
self.jabber.leave_muc(stream_to_room(stream))
def get_rooms(zulipToJabber: ZulipToJabberBot) -> List[str]: def get_rooms(zulipToJabber: ZulipToJabberBot) -> List[str]:
def get_stream_infos(key: str, method: Callable[[], Dict[str, Any]]) -> Any: def get_stream_infos(key: str, method: Callable[[], Dict[str, Any]]) -> Any:
ret = method() ret = method()