Source code for pyjabber.plugins.xep_0199.xep_0199
from xml.etree import ElementTree as ET
from pyjabber.stanzas.IQ import IQ
from pyjabber.stream.JID import JID
from pyjabber import metadata
[docs]class Ping:
[docs] @staticmethod
def feed(jid: JID, element: ET.Element):
if element.attrib.get('to') == metadata.HOST:
return ET.tostring(
IQ(
type_=IQ.TYPE.RESULT,
id_=element.attrib.get('id'),
from_=metadata.HOST,
to=str(jid)
)
)