General Design

The main slidge entrypoint will automatically detect which classes have been subclassed and use them automagically, as long as legacy_module.Gateway points to your BaseGateway` subclass and that you used generic parameters for all subclasses. Subclass away, and launch your legacy module with slidge --legacy-module=your.importable.legacy_module.

At the very minimum, you will need to subclass BaseGateway, BaseSession, and LegacyContact for a legacy module to be functional.

JID local parts to legacy IDs

By default, contacts JIDs are of the form contact-<legacy-id>@slidge.example.com and rooms use group-<legacy-id>@slidge.example.com. If you want to customize this conversion, see localpart_to_legacy_id() and legacy_id_to_localpart().

If possible, these method should act as an offline validation step for the ¨shape” of legacy IDs. For instance, if contact legacy IDs are positive integers, legacy_id_to_localpart() should raise if legacy_id cannot be converted to an integer.

Setting contact and room metadata

By subclassing LegacyRoster and LegacyBookmarks, you will be able to define how recipients update information about themselves, such as their user-facing name and the avatar that represents them.

The methods that need to be subclassed are slidge.contact.LegacyRoster.create() and slidge.room.LegacyBookmarks.create().

Pre-filling contacts and rooms

The coroutines slidge.contact.LegacyRoster.fill() and slidge.room.LegacyBookmarks.fill() will be awaited just after slidge.BaseSession.login() and should be used to pre-fill/update contacts and rooms.