From b073dfe848c601fbe6ab4229f91833eb5fdca588 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ana=C3=ABl=20Verrier?= Date: Sun, 12 Jul 2009 16:32:01 +0200 Subject: [PATCH] * first draft of ArchivingPreferences (for XEP-0136) --- src/common/message_archiving.py | 45 +++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/common/message_archiving.py diff --git a/src/common/message_archiving.py b/src/common/message_archiving.py new file mode 100644 index 000000000..ffde9eee3 --- /dev/null +++ b/src/common/message_archiving.py @@ -0,0 +1,45 @@ +# -*- coding:utf-8 -*- +## src/common/message_archiving.py +## +## Copyright (C) 2009 Anaƫl Verrier +## +## This file is part of Gajim. +## +## Gajim is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published +## by the Free Software Foundation; version 3 only. +## +## Gajim is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Gajim. If not, see . +## + + +class ArchivingPreferences: + def __init__(self): + self.auto = None + self.method_auto = None + self.method_local = None + self.method_manual = None + self.default = None + self.items = {} + + def set(self, auto, method_auto, method_local, method_manual, default): + self.auto = auto + self.method_auto = method_auto + self.method_local = method_local + self.method_manual = method_manual + self.default = default + + def set_default(self, expire, otr, save): + self.default = {'expire': expire, 'otr': otr, 'save': save} + + def append_or_update_item(self, jid, expire, otr, save): + self.items[jid] = {'expire': expire, 'otr': otr, 'save': save} + + def remove_item(self, jid): + del self.items[jid]