From ab63cf7cc95612bdee91e778032efe9e175244fa Mon Sep 17 00:00:00 2001 From: Kayou Date: Wed, 20 Oct 2021 12:10:32 +0200 Subject: [PATCH] Update the to_room script with an unique presence uuid --- to_room.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/to_room.py b/to_room.py index c23dca3..a743b11 100644 --- a/to_room.py +++ b/to_room.py @@ -3,6 +3,7 @@ import sys import xmpp from contextlib import contextmanager +import uuid @contextmanager @@ -26,19 +27,19 @@ def XMPPBot(password, room="dev"): client.sendInitPresence(requestRoster=0) - presence = xmpp.Presence(to="%s@conference.yunohost.org" % room) + presence = xmpp.Presence(attrs={'id': uuid.uuid4()}, to="%s@conference.yunohost.org" % room) presence.setTag('x', namespace='http://jabber.org/protocol/muc') client.send(presence) - client.send(xmpp.Presence(to='%s@conference.yunohost.org/GitBot' % room)) + client.send(xmpp.Presence(attrs={'id': uuid.uuid4()}, to='%s@conference.yunohost.org/Saperlipopette' % room)) def sendToChatRoom(message): if not client.connected: connect() client.connected = True - client.send(xmpp.protocol.Message("%s@conference.yunohost.org" % room, message, typ="groupchat")) + client.send(xmpp.protocol.Message("%s@conference.yunohost.org" % room, message, typ="groupchat", attrs={'id': uuid.uuid4()})) client.sendToChatRoom = sendToChatRoom @@ -50,7 +51,7 @@ def XMPPBot(password, room="dev"): if __name__ == '__main__': if len(sys.argv[1:]) < 2: - print "Usage : python to_room.py []" + print("Usage : python to_room.py []") sys.exit(1) password, message = sys.argv[1:3]