From 38d606367a7ddd8346bb0cfaaa0e21590ad0280d Mon Sep 17 00:00:00 2001 From: Lukasz Kawczynski Date: Wed, 24 Jul 2013 21:28:21 +0100 Subject: [PATCH] Set default XMPP message type to 'chat'. This enables sending messages to partychat-like services (e.g. im.partych.at). This commit also fixes handling of 'to' argument for non-chatroom recipients. --- library/notification/jabber | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/library/notification/jabber b/library/notification/jabber index 8a4fbeba441..4b72ea7a130 100644 --- a/library/notification/jabber +++ b/library/notification/jabber @@ -100,7 +100,10 @@ def main(): server = jid.getDomain() port = module.params['port'] 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']: host = module.params['host'] @@ -125,6 +128,8 @@ def main(): msg.setTag('x', namespace='http://jabber.org/protocol/muc#user') conn.send(xmpp.Presence(to=module.params['to'])) time.sleep(1) + else: + msg.setType('chat') msg.setTo(to) if not module.check_mode: