def _handle_caps_feature(self, features): # We already have a method to process presence with # caps, so wrap things up and use that. p = Presence() p['from'] = self.xmpp.boundjid.domain p.append(features['caps']) self.xmpp.features.add('caps') self.xmpp.event('entity_caps', p)
async def _recv_presence(self, pres: Presence): try: if pres.get_plugin('muc', check=True): # Don't process vCard avatars for MUC occupants # since they all share the same bare JID. return except: pass if not pres.match('presence/vcard_temp_update'): await self.api['set_hash'](pres['from'], args=None) return data = pres['vcard_temp_update']['photo'] if data is None: return self.xmpp.event('vcard_avatar_update', pres)
def Presence(self, *args, **kwargs): """ Create a Presence stanza. Uses same arguments as StanzaBase.__init__ Arguments: xml -- An XML object to use for the Iq's values. """ return Presence(self.xmpp, *args, **kwargs)
def Presence(self, *args, **kwargs): """Create a Presence stanza associated with this stream.""" pres = Presence(self, *args, **kwargs) pres['lang'] = self.default_lang return pres