mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-27 10:40:22 -07:00
Merge pull request #3659 from neuroid/jabber-chat-fix
Set default XMPP message type to 'chat'.
This commit is contained in:
commit
cd8d742a89
1 changed files with 6 additions and 1 deletions
|
@ -100,7 +100,10 @@ def main():
|
||||||
server = jid.getDomain()
|
server = jid.getDomain()
|
||||||
port = module.params['port']
|
port = module.params['port']
|
||||||
password = module.params['password']
|
password = module.params['password']
|
||||||
to, nick = re.split( r'/', module.params['to'])
|
try:
|
||||||
|
to, nick = module.params['to'].split('/', 1)
|
||||||
|
except ValueError:
|
||||||
|
to, nick = module.params['to'], None
|
||||||
|
|
||||||
if module.params['host']:
|
if module.params['host']:
|
||||||
host = module.params['host']
|
host = module.params['host']
|
||||||
|
@ -125,6 +128,8 @@ def main():
|
||||||
msg.setTag('x', namespace='http://jabber.org/protocol/muc#user')
|
msg.setTag('x', namespace='http://jabber.org/protocol/muc#user')
|
||||||
conn.send(xmpp.Presence(to=module.params['to']))
|
conn.send(xmpp.Presence(to=module.params['to']))
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
else:
|
||||||
|
msg.setType('chat')
|
||||||
|
|
||||||
msg.setTo(to)
|
msg.setTo(to)
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue