diff --git a/gajim/common/modules/http_auth.py b/gajim/common/modules/http_auth.py index e957ea46d2c9493e85e1cf7a2f39ddc19c03ef3d..a0734a3f618a791f6752d0d7619c225fed8956e5 100644 --- a/gajim/common/modules/http_auth.py +++ b/gajim/common/modules/http_auth.py @@ -14,17 +14,26 @@ # XEP-0070: Verifying HTTP Requests via XMPP +from __future__ import annotations + +from typing import Union + import nbxmpp +from nbxmpp.protocol import Iq +from nbxmpp.protocol import Message +from nbxmpp.structs import IqProperties +from nbxmpp.structs import MessageProperties from nbxmpp.structs import StanzaHandler from nbxmpp.namespaces import Namespace from gajim.common import app +from gajim.common import types from gajim.common.events import HttpAuth from gajim.common.modules.base import BaseModule class HTTPAuth(BaseModule): - def __init__(self, con): + def __init__(self, con: types.Client) -> None: BaseModule.__init__(self, con) self.handlers = [ @@ -39,7 +48,11 @@ def __init__(self, con): priority=45) ] - def _http_auth(self, _con, stanza, properties): + def _http_auth(self, + _con: types.xmppClient, + stanza: Union[Iq, Message], + properties: Union[IqProperties, MessageProperties] + ) -> None: if not properties.is_http_auth: return @@ -56,7 +69,10 @@ def _http_auth(self, _con, stanza, properties): stanza=stanza)) raise nbxmpp.NodeProcessed - def build_http_auth_answer(self, stanza, answer): + def build_http_auth_answer(self, + stanza: Union[Iq, Message], + answer: str + ) -> None: if answer == 'yes': self._log.info('Auth request approved') confirm = stanza.getTag('confirm')