mirror of
https://github.com/home-assistant/core.git
synced 2025-07-10 14:57:09 +00:00
Fix XMPP room notifications (#80794)
This commit is contained in:
parent
613ea28b0e
commit
9c762a5a5a
@ -159,6 +159,9 @@ async def async_send_message( # noqa: C901
|
|||||||
|
|
||||||
async def start(self, event):
|
async def start(self, event):
|
||||||
"""Start the communication and sends the message."""
|
"""Start the communication and sends the message."""
|
||||||
|
if room:
|
||||||
|
_LOGGER.debug("Joining room %s", room)
|
||||||
|
await self.plugin["xep_0045"].join_muc_wait(room, sender, seconds=0)
|
||||||
# Sending image and message independently from each other
|
# Sending image and message independently from each other
|
||||||
if data:
|
if data:
|
||||||
await self.send_file(timeout=timeout)
|
await self.send_file(timeout=timeout)
|
||||||
@ -173,9 +176,6 @@ async def async_send_message( # noqa: C901
|
|||||||
Send XMPP file message using OOB (XEP_0066) and
|
Send XMPP file message using OOB (XEP_0066) and
|
||||||
HTTP Upload (XEP_0363)
|
HTTP Upload (XEP_0363)
|
||||||
"""
|
"""
|
||||||
if room:
|
|
||||||
self.plugin["xep_0045"].join_muc(room, sender)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Uploading with XEP_0363
|
# Uploading with XEP_0363
|
||||||
_LOGGER.debug("Timeout set to %ss", timeout)
|
_LOGGER.debug("Timeout set to %ss", timeout)
|
||||||
@ -335,8 +335,7 @@ async def async_send_message( # noqa: C901
|
|||||||
"""Send a text only message to a room or a recipient."""
|
"""Send a text only message to a room or a recipient."""
|
||||||
try:
|
try:
|
||||||
if room:
|
if room:
|
||||||
_LOGGER.debug("Joining room %s", room)
|
_LOGGER.debug("Sending message to room %s", room)
|
||||||
self.plugin["xep_0045"].join_muc(room, sender)
|
|
||||||
self.send_message(mto=room, mbody=message, mtype="groupchat")
|
self.send_message(mto=room, mbody=message, mtype="groupchat")
|
||||||
else:
|
else:
|
||||||
for recipient in recipients:
|
for recipient in recipients:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user