XMPP vcard-temp example for PyXMPP

Материал из Linux Wiki
Перейти к навигацииПерейти к поиску
    def get_vCard(self,iq):

        iqmr=iq.make_result_response()
        q=iqmr.xmlnode.newChild(None,"vCard",None)
        q.setProp("xmlns","vcard-temp")

        transav=q.newTextChild(None,"PHOTO", None)
        transav.newTextChild(None, "BINVAL", self.gttlogo)
        transav.newTextChild(None, "TYPE", 'image/png')

        q.newTextChild(None,"BDAY","2022-12-07")
        q.newTextChild(None,"URL","https://github.com/jabberworld/gtt")

        if iq.get_to() == self.name:
            q.newTextChild(None,"FN","Google Translate Transport")
            q.newTextChild(None,"NICKNAME","Google Translate")
            q.newTextChild(None,"DESC","Google Translate Transport")
            q.newTextChild(None,"ROLE","Создаю ботов для получения перевода текста через Google Translate")
        self.stream.send(iqmr)
        return 1