diff --git a/gajim/common/events.py b/gajim/common/events.py index efd5cd5b88fafe9fe920b2baeb97a95db1e50763..2e4b0f9558de6e293f36dc9e7e2588982e9ba269 100644 --- a/gajim/common/events.py +++ b/gajim/common/events.py @@ -599,7 +599,7 @@ class PingReply(ApplicationEvent): name: str = field(init=False, default='ping-reply') account: str contact: Any - seconds: int + seconds: float @dataclass diff --git a/gajim/common/modules/ping.py b/gajim/common/modules/ping.py index 3f3dcf19521640e1e5152a032b847a01d4751190..0e782e686ac9a71f91728ccd66173a57eb1c03cf 100644 --- a/gajim/common/modules/ping.py +++ b/gajim/common/modules/ping.py @@ -14,17 +14,20 @@ # XEP-0199: XMPP Ping +from __future__ import annotations + from typing import Generator import time from nbxmpp.errors import is_error +from nbxmpp.structs import CommonResult from gajim.common import app +from gajim.common import types from gajim.common.events import PingError from gajim.common.events import PingReply from gajim.common.events import PingSent -from gajim.common.types import ConnectionT from gajim.common.modules.base import BaseModule from gajim.common.modules.util import as_task @@ -36,13 +39,15 @@ class Ping(BaseModule): 'ping', ] - def __init__(self, con: ConnectionT) -> None: + def __init__(self, con: types.Client) -> None: BaseModule.__init__(self, con) self.handlers = [] @as_task - def send_ping(self, contact) -> Generator: + def send_ping(self, + contact: types.ContactT + ) -> Generator[CommonResult, None, None]: _task = yield if not app.account_is_available(self._account):