def publish_avatar_metadata(self, items=None, pointers=None, ifrom=None, block=True, callback=None, timeout=None): metadata = MetaData() if items is None: items = [] for info in items: metadata.add_info(info['id'], info['type'], info['bytes'], height=info.get('height', ''), width=info.get('width', ''), url=info.get('url', '')) if pointers is not None: for pointer in pointers: metadata.add_pointer(pointer) return self.xmpp['xep_0163'].publish(metadata, ifrom=ifrom, block=block, callback=callback, timeout=timeout)
def publish_avatar_metadata(self, items=None, pointers=None, ifrom=None, block=True, callback=None, timeout=None): metadata = MetaData() if items is None: items = [] for info in items: metadata.add_info(info['id'], info['type'], info['bytes'], height=info.get('height', ''), width=info.get('width', ''), url=info.get('url', '')) for pointer in pointers: metadata.add_pointer(pointer) return self.xmpp['xep_0163'].publish(payload, node=Data.namespace, id=hashlib.sha1(data).hexdigest(), ifrom=ifrom, block=block, callback=callback, timeout=timeout)
def publish_avatar_metadata(self, items=None, pointers=None, ifrom=None, block=True, callback=None, timeout=None): metadata = MetaData() if items is None: items = [] if not isinstance(items, (list, set)): items = [items] for info in items: metadata.add_info(info['id'], info['type'], info['bytes'], height=info.get('height', ''), width=info.get('width', ''), url=info.get('url', '')) if pointers is not None: for pointer in pointers: metadata.add_pointer(pointer) return self.xmpp['xep_0163'].publish(metadata, id=info['id'], ifrom=ifrom, block=block, callback=callback, timeout=timeout)
def stop(self, ifrom=None, block=True, callback=None, timeout=None): """ Clear existing avatar metadata information to stop notifications. Arguments: ifrom -- Specify the sender's JID. block -- Specify if the send call will block until a response is received, or a timeout occurs. Defaults to True. timeout -- The length of time (in seconds) to wait for a response before exiting the send call if blocking is used. Defaults to sleekxmpp.xmlstream.RESPONSE_TIMEOUT callback -- Optional reference to a stream handler function. Will be executed when a reply stanza is received. """ metadata = MetaData() return self.xmpp['xep_0163'].publish(metadata, node=MetaData.namespace, ifrom=ifrom, block=block, callback=callback, timeout=timeout)