/usr/share/pyshared/wokkel/shim.py is in python-wokkel 0.7.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | # -*- test-case-name: wokkel.test.test_shim -*-
#
# Copyright (c) Ralph Meijer.
# See LICENSE for details.
"""
XMPP Stanza Headers and Internet Metadata.
This protocol is specified in
U{XEP-0131<http://xmpp.org/extensions/xep-0131.html>}.
"""
from twisted.words.xish import domish
NS_SHIM = "http://jabber.org/protocol/shim"
class Headers(domish.Element):
def __init__(self, headers):
domish.Element.__init__(self, (NS_SHIM, 'headers'))
for name, value in headers:
self.addElement('header', content=value)['name'] = name
def extractHeaders(stanza):
"""
Extract SHIM headers from stanza.
@param stanza: The stanza to extract headers from.
@type stanza: L{Element<twisted.words.xish.domish.Element>}
@return: Headers as a mapping from header name to a list of values.
@rtype: C{dict}
"""
headers = {}
for element in domish.generateElementsQNamed(stanza.children,
'headers', NS_SHIM):
for header in domish.generateElementsQNamed(element.children,
'header', NS_SHIM):
headers.setdefault(header['name'], []).append(unicode(header))
return headers
|