# slixmpp: The Slick XMPP Library# Copyright (C) 2016 Emmanuel Gil Peyrot# This file is part of slixmpp.# See the file LICENSE for copying permission.importloggingfromtypingimportOptionalfromslixmppimportMessage,JIDfromslixmpp.pluginsimportBasePluginfromslixmpp.xmlstreamimportregister_stanza_pluginfromslixmpp.xmlstream.handlerimportCallbackfromslixmpp.xmlstream.matcherimportStanzaPathfromslixmpp.plugins.xep_0333importstanza,Markable,Received,Displayed,Acknowledgedlog=logging.getLogger(__name__)
[docs]defsend_marker(self,mto:JID,id:str,marker:str,thread:Optional[str]=None,*,mfrom:Optional[JID]=None):""" Send a chat marker. :param JID mto: recipient of the marker :param str id: Identifier of the marked message :param str marker: Marker to send (one of displayed, received, or acknowledged) :param str thread: Message thread :param str mfrom: Use a specific JID to send the message """ifmarkernotin('displayed','received','acknowledged'):raiseValueError('Invalid marker: %s'%marker)msg=self.xmpp.make_message(mto=mto,mfrom=mfrom)ifthread:msg['thread']=threadmsg[marker]['id']=idmsg.send()