view sat_pubsub/mam.py @ 281:30895c49ebd2

fixes the imports from sat.tmp
author souliane <souliane@mailoo.org>
date Wed, 14 Jan 2015 10:43:27 +0100
parents 798cb8962c0b
children 7d54ff2eeaf2
line wrap: on
line source

#!/usr/bin/python
#-*- coding: utf-8 -*-

"""
XMPP Message Archive Management protocol.

This protocol is specified in
U{XEP-0313<http://xmpp.org/extensions/xep-0313.html>}.
"""

from zope.interface import implements

# TODO: change this when RSM and MAM are in wokkel
from sat.tmp.wokkel.rsm import RSMResponse
from sat.tmp.wokkel.mam import MAMPrefs, IMAMResource


class MAMResource(object):

    implements(IMAMResource)

    def onArchiveRequest(self, mam, rsm, requestor):
        """

        @param mam: The MAM <query/> request.
        @type mam: L{MAMQueryReques<wokkel.mam.MAMQueryRequest>}

        @param rsm: The RSM request.
        @type rsm: L{RSMRequest<wokkel.rsm.RSMRequest>}

        @param requestor: JID of the requestor.
        @type requestor: L{JID<twisted.words.protocols.jabber.jid.JID>}

        @return: The RSM answer.
        @rtype: L{RSMResponse<wokkel.rsm.RSMResponse>}
        """
        # TODO: send the archived messages
        return RSMResponse()

    def onPrefsGetRequest(self, requestor):
        """

        @param requestor: JID of the requestor.
        @type requestor: L{JID<twisted.words.protocols.jabber.jid.JID>}

        @return: The current settings.
        @rtype: L{wokkel.mam.MAMPrefs}
        """
        # TODO: return the actual current settings
        return MAMPrefs()

    def onPrefsSetRequest(self, prefs, requestor):
        """

        @param prefs: The new settings to set.
        @type prefs: L{wokkel.mam.MAMPrefs}

        @param requestor: JID of the requestor.
        @type requestor: L{JID<twisted.words.protocols.jabber.jid.JID>}

        @return: The settings that have actually been set.
        @rtype: L{wokkel.mam.MAMPrefs}
        """
        # TODO: set the new settings and return them
        return MAMPrefs()