Skip to content
This repository has been archived by the owner on Feb 19, 2020. It is now read-only.

Commit

Permalink
Merge pull request #413 from mathieui/xep-0334
Browse files Browse the repository at this point in the history
Implement XEP-0334 (message processing hints)
  • Loading branch information
bear authored Jul 30, 2016
2 parents fbc283b + 203b873 commit ba1b088
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 0 deletions.
14 changes: 14 additions & 0 deletions sleekxmpp/plugins/xep_0334/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""
SleekXMPP: The Sleek XMPP Library
Copyright (C) 2016 Nathanael C. Fritz, Lance J.T. Stout
This file is part of SleekXMPP.
See the file LICENSE for copying permission.
"""

from sleekxmpp.plugins.base import register_plugin

from sleekxmpp.plugins.xep_0334.stanza import Store, NoStore, NoPermanentStore, NoCopy
from sleekxmpp.plugins.xep_0334.hints import XEP_0334

register_plugin(XEP_0334)
28 changes: 28 additions & 0 deletions sleekxmpp/plugins/xep_0334/hints.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""
SleekXMPP: The Sleek XMPP Library
Copyright (C) 2016 Nathanael C. Fritz, Lance J.T. Stout
This file is part of SleekXMPP.
See the file LICENSE for copying permission.
"""

import logging

from sleekxmpp import Message
from sleekxmpp.plugins import BasePlugin
from sleekxmpp.xmlstream import register_stanza_plugin
from sleekxmpp.plugins.xep_0334 import stanza, Store, NoStore, NoPermanentStore, NoCopy

log = logging.getLogger(__name__)

class XEP_0334(BasePlugin):

name = 'xep_0334'
description = 'XEP-0334: Message Processing Hints'
stanza = stanza

def plugin_init(self):
register_stanza_plugin(Message, Store)
register_stanza_plugin(Message, NoStore)
register_stanza_plugin(Message, NoPermanentStore)
register_stanza_plugin(Message, NoCopy)
31 changes: 31 additions & 0 deletions sleekxmpp/plugins/xep_0334/stanza.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""
SleekXMPP: The Sleek XMPP Library
Implementation of Message Processing Hints
http://xmpp.org/extensions/xep-0334.html
Copyright (C) 2016 Nathanael C. Fritz, Lance J.T. Stout
This file is part of SleekXMPP.
See the file LICENSE for copying permission.
"""

from sleekxmpp.xmlstream import ElementBase

class Store(ElementBase):
name = 'store'
plugin_attrib = 'store'
namespace = 'urn:xmpp:hints'

class NoPermanentStore(ElementBase):
name = 'no-permanent-store'
plugin_attrib = 'no-permanent-store'
namespace = 'urn:xmpp:hints'

class NoStore(ElementBase):
name = 'no-store'
plugin_attrib = 'no-store'
namespace = 'urn:xmpp:hints'

class NoCopy(ElementBase):
name = 'no-copy'
plugin_attrib = 'no-copy'
namespace = 'urn:xmpp:hints'

0 comments on commit ba1b088

Please sign in to comment.