/usr/share/pyshared/jabberbot/oob.py is in python-moinmoin 1.9.3-1ubuntu2.3.
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 | # -*- coding: iso-8859-1 -*-
"""
MoinMoin - Out Of Band Data (XEP-066) implementation
This is used by the xmpp thread to send URIs to clients
in a structured manner.
@copyright: 2007 by Karol Nowak <grywacz@gmail.com>
@license: GNU GPL, see COPYING for details.
"""
from pyxmpp.message import Message
from pyxmpp.presence import Presence
def add_urls(stanza, data):
"""Adds a URL to a message or presence stanza
Adds an <x> element qualified by the jabber:x:oob namespace
to the stanza's payload
@param stanza: message or presence stanza to add the URL info to
@type stanza: pyxmpp.message.Message or pyxmpp.presence.Presence
@param data: a list of dictionaries containing (url, description), as unicode
@type data: list
"""
if not (isinstance(stanza, Presence) or isinstance(stanza, Message)):
raise TypeError("Stanza must be either of type Presence or Message!")
for piece in data:
x_elem = stanza.add_new_content(u"jabber:x:oob", u"x")
url = x_elem.newChild(None, u"url", None)
desc = x_elem.newChild(None, u"desc", None)
url.addContent(piece['url'].encode("utf-8"))
desc.addContent(piece['description'].encode("utf-8"))
|