Dateien nach „slixmpp/plugins/xep_0262“ hochladen
This commit is contained in:
parent
5cdd923b8c
commit
e212e7d62b
11
slixmpp/plugins/xep_0262/__init__.py
Normal file
11
slixmpp/plugins/xep_0262/__init__.py
Normal file
@ -0,0 +1,11 @@
|
||||
# slixmpp: The Slick XMPP Library
|
||||
# Copyright (C) 2020 Emmanuel Gil Peyrot
|
||||
# This file is part of slixmpp.
|
||||
# See the file LICENSE for copying permission.
|
||||
|
||||
from slixmpp.plugins.base import register_plugin
|
||||
|
||||
from slixmpp.plugins.xep_0262.stanza import Zrtp
|
||||
from slixmpp.plugins.xep_0262.zrtp import XEP_0262
|
||||
|
||||
register_plugin(XEP_0262)
|
19
slixmpp/plugins/xep_0262/stanza.py
Normal file
19
slixmpp/plugins/xep_0262/stanza.py
Normal file
@ -0,0 +1,19 @@
|
||||
# slixmpp: The Slick XMPP Library
|
||||
# Copyright (C) 2020 Emmanuel Gil Peyrot
|
||||
# This file is part of slixmpp.
|
||||
# See the file LICENSE for copying permission.
|
||||
|
||||
from typing import Iterable, List, Tuple, Optional
|
||||
from slixmpp.xmlstream import ElementBase, ET
|
||||
|
||||
class Zrtp(ElementBase):
|
||||
name = 'zrtp-hash'
|
||||
namespace = 'urn:xmpp:jingle:apps:rtp:zrtp:1'
|
||||
plugin_attrib = 'zrtp'
|
||||
interfaces = {'version'}
|
||||
sub_interfaces = {}
|
||||
|
||||
def getSDP(self):
|
||||
if self['version']:
|
||||
return "\r\na=zrtp-hash:%s %s" % (self['version'],self.xml.text)
|
||||
return None
|
51
slixmpp/plugins/xep_0262/zrtp.py
Normal file
51
slixmpp/plugins/xep_0262/zrtp.py
Normal file
@ -0,0 +1,51 @@
|
||||
# slixmpp: The Slick XMPP Library
|
||||
# Copyright (C) 2020 Emmanuel Gil Peyrot
|
||||
# This file is part of slixmpp.
|
||||
# See the file LICENSE for copying permission.
|
||||
|
||||
import logging
|
||||
|
||||
from typing import Iterable, Tuple, Optional
|
||||
|
||||
from slixmpp import JID, Iq
|
||||
from slixmpp.plugins import BasePlugin
|
||||
from slixmpp.xmlstream import register_stanza_plugin
|
||||
from slixmpp.xmlstream.handler import Callback
|
||||
from slixmpp.xmlstream.matcher import StanzaPath
|
||||
from slixmpp.plugins.xep_0166 import Jingle, Content
|
||||
from slixmpp.plugins.xep_0167 import Description, Encryption
|
||||
from slixmpp.plugins.xep_0262 import stanza, Zrtp
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class XEP_0262(BasePlugin):
|
||||
|
||||
name = 'xep_0262'
|
||||
description = 'XEP-0262: ZRTP in RTP Session'
|
||||
dependencies = set(['xep_0166','xep_0176'])
|
||||
stanza = stanza
|
||||
|
||||
def plugin_init(self):
|
||||
register_stanza_plugin(Iq,Jingle)
|
||||
register_stanza_plugin(Jingle,Content)
|
||||
register_stanza_plugin(Content,Description)
|
||||
register_stanza_plugin(Description,Encryption)
|
||||
register_stanza_plugin(Encryption,Zrtp)
|
||||
|
||||
self.xmpp.register_handler(
|
||||
Callback('Jingle Content Transport Fingerprint',
|
||||
StanzaPath('iq/jingle/content/description/encryption/zrtp'),
|
||||
self._handle_jingle_content_description_encryption_zrtp))
|
||||
|
||||
# def session_bind(self, jid):
|
||||
# pass
|
||||
|
||||
# def plugin_end(self):
|
||||
# pass
|
||||
|
||||
|
||||
#######################################################################
|
||||
|
||||
def _handle_jingle_content_description_encryption_zrtp(self, message):
|
||||
self.xmpp.event('jingle_content_description__encryption_zrtp', message['jingle']['content']['description']['encryption']['zrtp'])
|
Loading…
x
Reference in New Issue
Block a user