diff options
Diffstat (limited to 'gajim/common/settings.py')
-rw-r--r-- | gajim/common/settings.py | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/gajim/common/settings.py b/gajim/common/settings.py index 0cb841699..dfb6c6c4d 100644 --- a/gajim/common/settings.py +++ b/gajim/common/settings.py @@ -391,6 +391,61 @@ class Settings: self._settings['app'].pop('muclumbus_api_http_uri', None) self._set_user_version(5) + if version < 6: + # Migrate workspace chats to contact/group chat contact settings + for workspace_id, settings in self._settings['workspaces'].items(): + workspace_settings = cast( + OpenChatsSettingT, settings.get('chats', [])) + for chat in workspace_settings: + if chat['type'] in ('contact', 'pm'): + self.set_contact_setting( + chat['account'], + chat['jid'], + 'workspace', + workspace_id) + self.set_contact_setting( + chat['account'], + chat['jid'], + 'opened', + True) + if chat['pinned']: + self.set_contact_setting( + chat['account'], + chat['jid'], + 'pinned', + chat['pinned']) + if chat['position'] != -1: + self.set_contact_setting( + chat['account'], + chat['jid'], + 'position', + chat['position']) + elif chat['type'] == 'groupchat': + self.set_group_chat_setting( + chat['account'], + chat['jid'], + 'workspace', + workspace_id) + self.set_group_chat_setting( + chat['account'], + chat['jid'], + 'opened', + True) + if chat['pinned']: + self.set_group_chat_setting( + chat['account'], + chat['jid'], + 'pinned', + chat['pinned']) + if chat['position'] != -1: + self.set_group_chat_setting( + chat['account'], + chat['jid'], + 'position', + chat['position']) + + self._set_user_version(6) + def _migrate_old_config(self) -> None: if self._in_memory: return |