Update the type of BasePlugin.xmpp to BaseXMPP. Increase the timeout for join_muc_wait.

This commit is contained in:
jinyu 2024-09-08 12:26:36 +08:00 committed by mathieui
parent e79b98b266
commit df0ecfc142
2 changed files with 4 additions and 4 deletions

View File

@ -12,7 +12,7 @@ import copy
import logging import logging
import threading import threading
from slixmpp.clientxmpp import ClientXMPP from slixmpp.basexmpp import BaseXMPP
from typing import Any, Dict, Set, ClassVar from typing import Any, Dict, Set, ClassVar
@ -274,7 +274,7 @@ class BasePlugin(object):
#: `plugin.config['foo']`. #: `plugin.config['foo']`.
default_config: ClassVar[Dict[str, Any]] = {} default_config: ClassVar[Dict[str, Any]] = {}
def __init__(self, xmpp: ClientXMPP, config=None): def __init__(self, xmpp: BaseXMPP, config=None):
self.xmpp = xmpp self.xmpp = xmpp
if self.xmpp: if self.xmpp:
self.api = self.xmpp.api.wrap(self.name) self.api = self.xmpp.api.wrap(self.name)

View File

@ -266,7 +266,7 @@ class XEP_0045(BasePlugin):
seconds: Optional[int] = None, seconds: Optional[int] = None,
since: Optional[datetime] = None, since: Optional[datetime] = None,
presence_options: Optional[PresenceArgs] = None, presence_options: Optional[PresenceArgs] = None,
timeout: int = 30) -> JoinResult: timeout: int = 300) -> JoinResult:
""" """
Try to join a MUC and block until we are joined or get an error. Try to join a MUC and block until we are joined or get an error.
@ -312,7 +312,7 @@ class XEP_0045(BasePlugin):
stanza.send() stanza.send()
return await self._await_join(room, timeout) return await self._await_join(room, timeout)
async def _await_join(self, room: JID, timeout: int = 30) -> JoinResult: async def _await_join(self, room: JID, timeout: int = 300) -> JoinResult:
"""Do the heavy lifting for awaiting a MUC join """Do the heavy lifting for awaiting a MUC join
A muc join, once the join stanza is sent, is: A muc join, once the join stanza is sent, is: