def run(self, jid, add): """<jid> Print jid's disco info. See http://xmpp.org/extensions/xep-0030.html """ jid = xmpp.JID(jid).getStripped() iq = xmpp.Iq("get", xmpp.NS_DISCO_INFO, to=jid, attrs={"id": utils.get_id()}) self._bot.cl.SendAndCallForResponse( iq, self.got_info, {"msg": add["msg"]}) return ""
def run(self, jid, add): """<jid> Print jid's vcard info. See http://xmpp.org/extensions/xep-0054.html """ jid = xmpp.JID(jid).getStripped() iq = xmpp.Iq("get", to=jid, attrs={"id": utils.get_id()}) iq.addChild(xmpp.NS_VCARD + " vCard") self._bot.cl.SendAndCallForResponse( iq, self.parse_response, {"msg": add["msg"]}) return ""
def got_info(self, cl, info, msg): jid = info.getFrom().getStripped() if info.getType() == "error": error = info.getTag("error") error_info = error.kids[0].name err = "%s disco:\ngot %s error (%s)" % ( jid, error["code"], error_info) self.send_message(msg, err) return iq = xmpp.Iq("get", xmpp.NS_DISCO_ITEMS, to=jid, attrs={"id": utils.get_id()}) self._bot.cl.SendAndCallForResponse( iq, self.parse_response, {"info": info, "msg": msg})