HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/xmpp.cpython-310.pyc
o

�N�g�@s�dZddlZdZzddlmZddlmZdZWney(Gdd�d�ZYnwe�	e
�Zd	Zd
Z
dd�ZGd
d�dej�ZGdd�de�Zddd�Z						ddd�ZdS)a�
Module for Sending Messages via XMPP (a.k.a. Jabber)

.. versionadded:: 2014.1.0

:depends:   - sleekxmpp>=1.3.1
            - pyasn1
            - pyasn1-modules
            - dnspython
:configuration: This module can be used by either passing a jid and password
    directly to send_message, or by specifying the name of a configuration
    profile in the minion config, minion pillar, or master config.

    For example:

    .. code-block:: yaml

        my-xmpp-login:
            xmpp.jid: myuser@jabber.example.org/resourcename
            xmpp.password: verybadpass

    The resourcename refers to the resource that is using this account. It is
    user-definable, and optional. The following configurations are both valid:

    .. code-block:: yaml

        my-xmpp-login:
            xmpp.jid: myuser@jabber.example.org/salt
            xmpp.password: verybadpass

        my-xmpp-login:
            xmpp.jid: myuser@jabber.example.org
            xmpp.password: verybadpass

�NF)�
ClientXMPP)�	XMPPErrorTc@seZdZdZdS)�_ClientXMPPz9
        Fake class in order not to raise errors
        N)�__name__�
__module__�__qualname__�__doc__�r	r	�E/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/xmpp.pyr/sr�xmppz'Use of send mask waiters is deprecated.cCstrtSdS)zI
    Only load this module if sleekxmpp is installed on this minion.
    )Fz.Module xmpp: required libraries failed to load)�HAS_LIBS�__virtualname__r	r	r	r
�__virtual__<src@seZdZdd�ZdS)�SleekXMPPMUCcCs|��tkS)N)�
getMessage�MUC_DEPRECATED)�self�recordr	r	r
�filterFszSleekXMPPMUC.filterN)rrrrr	r	r	r
rEsrcs4eZdZ�fdd�Ze	d	dd��Zdd�Z�ZS)
�
SendMsgBotcs@t��||�|dur
gn|g|_g|_||_|�d|j�dS)NZ
session_start)�super�__init__�
recipients�rooms�msgZadd_event_handler�start)r�jid�password�	recipientr��	__class__r	r
rKs
zSendMsgBot.__init__N�
SaltStack BotcCs<t||d|�}|dur
gn||_|durgn||_||_|S)zQ
        Alternate constructor that accept multiple recipients and rooms
        N)rrr�nick)�clsrrrrrr"�objr	r	r
�create_multiWs
zSendMsgBot.create_multicCst|��|��|jD]}|j||jdd�q|jD]}|jdj||jdd�|j||jdd�q|j	dd�dS)NZchat)ZmtoZmbodyZmtype�xep_0045T)�waitZ	groupchat)
Z
send_presenceZ
get_rosterrZsend_messagerrZpluginZjoinMUCr"Z
disconnect)r�eventr�roomr	r	r
rds

zSendMsgBot.start)NNr!)rrrr�classmethodr%r�
__classcell__r	r	rr
rJs�rcCsb|rtd|�}|�d�}|�d�}t||||�}|�d�|�d�|��r/|jdd�dSdS)	a~
    Send a message to an XMPP recipient. Designed for use in states.

    CLI Examples:

    .. code-block:: bash

        xmpp.send_msg 'admins@xmpp.example.com' 'This is a salt module test'             profile='my-xmpp-account'
        xmpp.send_msg 'admins@xmpp.example.com' 'This is a salt module test'             jid='myuser@xmpp.example.com/salt' password='verybadpass'
    �
config.option�xmpp.jid�
xmpp.passwordZxep_0030Zxep_0199T��blockF)�__salt__�getr�register_plugin�connect�process)r�messagerr�profile�credsrr	r	r
�send_msgrs




r9r!c
Cs�tjjD]}|�t��q|rtd|�}|�d�}|�d�}tj||||||d�}	|r1|	�	d�|	�
�rXz	|	jdd�WdStyW}
z
t
�d|
�WYd	}
~
dSd	}
~
wwt
�d
�dS)aD
    Send a message to an XMPP recipient, support send message to
    multiple recipients or chat room.

    CLI Examples:

    .. code-block:: bash

        xmpp.send_msg recipients=['admins@xmpp.example.com']             rooms=['secret@conference.xmpp.example.com']             'This is a salt module test'             profile='my-xmpp-account'
        xmpp.send_msg recipients=['admins@xmpp.example.com']             rooms=['secret@conference.xmpp.example.com']            'This is a salt module test'             jid='myuser@xmpp.example.com/salt' password='verybadpass'

    r,r-r.)rrr"r&Tr/z!Could not send message, error: %sNz Could not connect to XMPP serverF)�logging�root�handlers�	addFilterrr1r2rr%r3r4r5r�log�error)r6rrrrr"r7�handlerr8r�errr	r	r
�send_msg_multi�s,

�
��
rB)NNN)NNNNr!N)rr:rZ	sleekxmpprrZsleekxmpp.exceptionsr�ImportError�	getLoggerrr>r
rr�Filterrrr9rBr	r	r	r
�<module>s0$�
	
(�