summaryrefslogtreecommitdiff
path: root/slixmpp/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'slixmpp/plugins')
-rw-r--r--slixmpp/plugins/base.py10
-rw-r--r--slixmpp/plugins/xep_0012/last_activity.py6
-rw-r--r--slixmpp/plugins/xep_0054/vcard_temp.py2
-rw-r--r--slixmpp/plugins/xep_0070/confirm.py13
-rw-r--r--slixmpp/plugins/xep_0153/vcard_avatar.py1
-rw-r--r--slixmpp/plugins/xep_0163.py3
-rw-r--r--slixmpp/plugins/xep_0199/ping.py2
-rw-r--r--slixmpp/plugins/xep_0231/bob.py5
-rw-r--r--slixmpp/plugins/xep_0325/control.py2
9 files changed, 21 insertions, 23 deletions
diff --git a/slixmpp/plugins/base.py b/slixmpp/plugins/base.py
index afdb5339..2aaf1b99 100644
--- a/slixmpp/plugins/base.py
+++ b/slixmpp/plugins/base.py
@@ -12,6 +12,8 @@ import copy
import logging
import threading
+from typing import Any, Dict, Set, ClassVar
+
log = logging.getLogger(__name__)
@@ -250,17 +252,17 @@ class BasePlugin(object):
#: A short name for the plugin based on the implemented specification.
#: For example, a plugin for XEP-0030 would use `'xep_0030'`.
- name = ''
+ name: str = ''
#: A longer name for the plugin, describing its purpose. For example,
#: a plugin for XEP-0030 would use `'Service Discovery'` as its
#: description value.
- description = ''
+ description: str = ''
#: Some plugins may depend on others in order to function properly.
#: Any plugin names included in :attr:`~BasePlugin.dependencies` will
#: be initialized as needed if this plugin is enabled.
- dependencies = set()
+ dependencies: ClassVar[Set[str]] = set()
#: The basic, standard configuration for the plugin, which may
#: be overridden when initializing the plugin. The configuration
@@ -268,7 +270,7 @@ class BasePlugin(object):
#: the plugin. For example, including the configuration field 'foo'
#: would mean accessing `plugin.foo` returns the current value of
#: `plugin.config['foo']`.
- default_config = {}
+ default_config: ClassVar[Dict[str, Any]] = {}
def __init__(self, xmpp, config=None):
self.xmpp = xmpp
diff --git a/slixmpp/plugins/xep_0012/last_activity.py b/slixmpp/plugins/xep_0012/last_activity.py
index 61531431..56905de0 100644
--- a/slixmpp/plugins/xep_0012/last_activity.py
+++ b/slixmpp/plugins/xep_0012/last_activity.py
@@ -11,11 +11,11 @@ from typing import (
Optional
)
-from slixmpp.plugins import BasePlugin, register_plugin
-from slixmpp import future_wrapper, JID
+from slixmpp.plugins import BasePlugin
+from slixmpp import JID
from slixmpp.stanza import Iq
from slixmpp.exceptions import XMPPError
-from slixmpp.xmlstream import JID, register_stanza_plugin
+from slixmpp.xmlstream import register_stanza_plugin
from slixmpp.xmlstream.handler import CoroutineCallback
from slixmpp.xmlstream.matcher import StanzaPath
from slixmpp.plugins.xep_0012 import stanza, LastActivity
diff --git a/slixmpp/plugins/xep_0054/vcard_temp.py b/slixmpp/plugins/xep_0054/vcard_temp.py
index 460013b8..c909f6cd 100644
--- a/slixmpp/plugins/xep_0054/vcard_temp.py
+++ b/slixmpp/plugins/xep_0054/vcard_temp.py
@@ -4,7 +4,6 @@
# This file is part of Slixmpp.
# See the file LICENSE for copying permission.
import logging
-from asyncio import Future
from typing import Optional
from slixmpp import JID
@@ -15,7 +14,6 @@ from slixmpp.xmlstream.handler import CoroutineCallback
from slixmpp.xmlstream.matcher import StanzaPath
from slixmpp.plugins import BasePlugin
from slixmpp.plugins.xep_0054 import VCardTemp, stanza
-from slixmpp import future_wrapper
log = logging.getLogger(__name__)
diff --git a/slixmpp/plugins/xep_0070/confirm.py b/slixmpp/plugins/xep_0070/confirm.py
index 334f78d4..1edde8d9 100644
--- a/slixmpp/plugins/xep_0070/confirm.py
+++ b/slixmpp/plugins/xep_0070/confirm.py
@@ -1,4 +1,3 @@
-
# Slixmpp: The Slick XMPP Library
# Copyright (C) 2015 Emmanuel Gil Peyrot
# This file is part of Slixmpp.
@@ -7,11 +6,10 @@ import asyncio
import logging
from uuid import uuid4
-from slixmpp.plugins import BasePlugin, register_plugin
-from slixmpp import future_wrapper, Iq, Message
-from slixmpp.exceptions import XMPPError, IqError, IqTimeout
+from slixmpp.plugins import BasePlugin
+from slixmpp import Iq, Message
from slixmpp.jid import JID
-from slixmpp.xmlstream import JID, register_stanza_plugin
+from slixmpp.xmlstream import register_stanza_plugin
from slixmpp.xmlstream.handler import Callback
from slixmpp.xmlstream.matcher import StanzaPath
from slixmpp.plugins.xep_0070 import stanza, Confirm
@@ -52,7 +50,6 @@ class XEP_0070(BasePlugin):
def session_bind(self, jid):
self.xmpp['xep_0030'].add_feature('http://jabber.org/protocol/http-auth')
- @future_wrapper
def ask_confirm(self, jid, id, url, method, *, ifrom=None, message=None):
jid = JID(jid)
if jid.resource:
@@ -70,7 +67,9 @@ class XEP_0070(BasePlugin):
if message is not None:
stanza['body'] = message.format(id=id, url=url, method=method)
stanza.send()
- return stanza
+ fut = asyncio.Future()
+ fut.set_result(stanza)
+ return fut
else:
return stanza.send()
diff --git a/slixmpp/plugins/xep_0153/vcard_avatar.py b/slixmpp/plugins/xep_0153/vcard_avatar.py
index e2d98b0a..23709c25 100644
--- a/slixmpp/plugins/xep_0153/vcard_avatar.py
+++ b/slixmpp/plugins/xep_0153/vcard_avatar.py
@@ -17,7 +17,6 @@ from slixmpp.exceptions import XMPPError, IqTimeout, IqError
from slixmpp.xmlstream import register_stanza_plugin, ElementBase
from slixmpp.plugins.base import BasePlugin
from slixmpp.plugins.xep_0153 import stanza, VCardTempUpdate
-from slixmpp import future_wrapper
log = logging.getLogger(__name__)
diff --git a/slixmpp/plugins/xep_0163.py b/slixmpp/plugins/xep_0163.py
index d8ab8c8e..46ca4235 100644
--- a/slixmpp/plugins/xep_0163.py
+++ b/slixmpp/plugins/xep_0163.py
@@ -3,10 +3,11 @@
# Copyright (C) 2011 Nathanael C. Fritz, Lance J.T. Stout
# This file is part of Slixmpp.
# See the file LICENSE for copying permission.
+import asyncio
import logging
from typing import Optional, Callable
-from slixmpp import asyncio, JID
+from slixmpp import JID
from slixmpp.xmlstream import register_stanza_plugin, ElementBase
from slixmpp.plugins.base import BasePlugin, register_plugin
from slixmpp.plugins.xep_0004.stanza import Form
diff --git a/slixmpp/plugins/xep_0199/ping.py b/slixmpp/plugins/xep_0199/ping.py
index 89303ad9..03d272dd 100644
--- a/slixmpp/plugins/xep_0199/ping.py
+++ b/slixmpp/plugins/xep_0199/ping.py
@@ -3,6 +3,7 @@
# Copyright (C) 2010 Nathanael C. Fritz
# This file is part of Slixmpp.
# See the file LICENSE for copying permission.
+import asyncio
import time
import logging
@@ -11,7 +12,6 @@ from typing import Optional, Callable, List
from slixmpp.jid import JID
from slixmpp.stanza import Iq
-from slixmpp import asyncio
from slixmpp.exceptions import IqError, IqTimeout
from slixmpp.xmlstream import register_stanza_plugin
from slixmpp.xmlstream.matcher import StanzaPath
diff --git a/slixmpp/plugins/xep_0231/bob.py b/slixmpp/plugins/xep_0231/bob.py
index 30722208..5614b5b0 100644
--- a/slixmpp/plugins/xep_0231/bob.py
+++ b/slixmpp/plugins/xep_0231/bob.py
@@ -9,14 +9,13 @@ import hashlib
from asyncio import Future
from typing import Optional
-from slixmpp import future_wrapper, JID
+from slixmpp import JID
from slixmpp.stanza import Iq, Message, Presence
-from slixmpp.exceptions import XMPPError
from slixmpp.xmlstream.handler import CoroutineCallback
from slixmpp.xmlstream.matcher import StanzaPath
from slixmpp.xmlstream import register_stanza_plugin
from slixmpp.plugins.base import BasePlugin
-from slixmpp.plugins.xep_0231 import stanza, BitsOfBinary
+from slixmpp.plugins.xep_0231 import BitsOfBinary
log = logging.getLogger(__name__)
diff --git a/slixmpp/plugins/xep_0325/control.py b/slixmpp/plugins/xep_0325/control.py
index 734b3204..467e10d7 100644
--- a/slixmpp/plugins/xep_0325/control.py
+++ b/slixmpp/plugins/xep_0325/control.py
@@ -5,10 +5,10 @@
# Copyright (C) 2013 Sustainable Innovation, Joachim.lindborg@sust.se, bjorn.westrom@consoden.se
# This file is part of Slixmpp.
# See the file LICENSE for copying permission.
+import asyncio
import logging
import time
-from slixmpp import asyncio
from functools import partial
from slixmpp.xmlstream import JID
from slixmpp.xmlstream.handler import Callback