mirror of
https://github.com/YunoHost/webhooks.git
synced 2024-09-03 19:56:54 +02:00
Update the to_room script with an unique presence uuid
This commit is contained in:
parent
0affbc50ac
commit
ab63cf7cc9
1 changed files with 5 additions and 4 deletions
|
@ -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 <password> <message> [<room name>]"
|
||||
print("Usage : python to_room.py <password> <message> [<room name>]")
|
||||
sys.exit(1)
|
||||
|
||||
password, message = sys.argv[1:3]
|
||||
|
|
Loading…
Reference in a new issue