slidge 0.2.8__py3-none-any.whl → 0.2.9__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- slidge/__init__.py +8 -0
- slidge/command/admin.py +3 -3
- slidge/core/gateway.py +1 -0
- slidge/core/session.py +2 -2
- slidge/group/room.py +5 -2
- slidge/main.py +3 -3
- slidge/util/types.py +1 -7
- slidge/util/util.py +0 -13
- slidge-0.2.9.dist-info/METADATA +134 -0
- {slidge-0.2.8.dist-info → slidge-0.2.9.dist-info}/RECORD +14 -14
- {slidge-0.2.8.dist-info → slidge-0.2.9.dist-info}/WHEEL +1 -1
- slidge-0.2.9.dist-info/licenses/LICENSE +661 -0
- slidge/__version__.py +0 -5
- slidge-0.2.8.dist-info/METADATA +0 -793
- {slidge-0.2.8.dist-info → slidge-0.2.9.dist-info}/entry_points.txt +0 -0
- {slidge-0.2.8.dist-info → slidge-0.2.9.dist-info}/top_level.txt +0 -0
slidge/__init__.py
CHANGED
@@ -6,6 +6,7 @@ Contains importable classes for a minimal function :term:`Legacy Module`.
|
|
6
6
|
|
7
7
|
import sys
|
8
8
|
import warnings
|
9
|
+
from importlib.metadata import PackageNotFoundError, version
|
9
10
|
|
10
11
|
from . import slixfix # noqa: F401
|
11
12
|
from .command import FormField, SearchResult # noqa: F401
|
@@ -37,8 +38,15 @@ def formatwarning(message, category, filename, lineno, line=""):
|
|
37
38
|
|
38
39
|
warnings.formatwarning = formatwarning
|
39
40
|
|
41
|
+
try:
|
42
|
+
__version__ = version("slidge")
|
43
|
+
except PackageNotFoundError:
|
44
|
+
# package is not installed
|
45
|
+
__version__ = "dev"
|
46
|
+
|
40
47
|
|
41
48
|
__all__ = [
|
49
|
+
"__version__",
|
42
50
|
"BaseGateway",
|
43
51
|
"BaseSession",
|
44
52
|
# For backwards compatibility, these names are still importable from the
|
slidge/command/admin.py
CHANGED
@@ -60,8 +60,6 @@ class SlidgeInfo(AdminCommand):
|
|
60
60
|
ACCESS = CommandAccess.ANY
|
61
61
|
|
62
62
|
async def run(self, _session, _ifrom, *_):
|
63
|
-
from slidge.__version__ import __version__
|
64
|
-
|
65
63
|
start = self.xmpp.datetime_started # type:ignore
|
66
64
|
uptime = datetime.now() - start
|
67
65
|
|
@@ -100,8 +98,10 @@ class SlidgeInfo(AdminCommand):
|
|
100
98
|
legacy_module = importlib.import_module(config.LEGACY_MODULE)
|
101
99
|
version = getattr(legacy_module, "__version__", "No version")
|
102
100
|
|
101
|
+
import slidge
|
102
|
+
|
103
103
|
return (
|
104
|
-
f"{self.xmpp.COMPONENT_NAME} (slidge core {__version__},"
|
104
|
+
f"{self.xmpp.COMPONENT_NAME} (slidge core {slidge.__version__},"
|
105
105
|
f" {config.LEGACY_MODULE} {version})\n"
|
106
106
|
f"Up since {start:%Y-%m-%d %H:%M} ({ago} ago)"
|
107
107
|
)
|
slidge/core/gateway.py
CHANGED
slidge/core/session.py
CHANGED
@@ -543,10 +543,10 @@ class BaseSession(
|
|
543
543
|
return f"<Session of {self.user_jid}>"
|
544
544
|
|
545
545
|
def shutdown(self, logout=True) -> asyncio.Task:
|
546
|
-
for c in self.contacts:
|
547
|
-
c.offline()
|
548
546
|
for m in self.bookmarks:
|
549
547
|
m.shutdown()
|
548
|
+
for c in self.contacts:
|
549
|
+
c.offline()
|
550
550
|
if logout:
|
551
551
|
return self.xmpp.loop.create_task(self.logout())
|
552
552
|
else:
|
slidge/group/room.py
CHANGED
@@ -1016,8 +1016,11 @@ class LegacyMUC(
|
|
1016
1016
|
item = ans["pubsub"]["items"]["item"]
|
1017
1017
|
item["id"] = self.jid
|
1018
1018
|
return item
|
1019
|
-
except
|
1020
|
-
warnings.warn(f"Cannot fetch bookmark
|
1019
|
+
except IqTimeout as exc:
|
1020
|
+
warnings.warn(f"Cannot fetch bookmark for {self.user_jid}: timeout")
|
1021
|
+
return None
|
1022
|
+
except IqError as exc:
|
1023
|
+
warnings.warn(f"Cannot fetch bookmark for {self.user_jid}: {exc}")
|
1021
1024
|
return None
|
1022
1025
|
except PermissionError:
|
1023
1026
|
warnings.warn(
|
slidge/main.py
CHANGED
@@ -24,8 +24,8 @@ from pathlib import Path
|
|
24
24
|
|
25
25
|
import configargparse
|
26
26
|
|
27
|
+
import slidge
|
27
28
|
from slidge import BaseGateway
|
28
|
-
from slidge.__version__ import __version__
|
29
29
|
from slidge.core import config
|
30
30
|
from slidge.core.pubsub import PepAvatar, PepNick
|
31
31
|
from slidge.db import SlidgeStore
|
@@ -96,7 +96,7 @@ def get_configurator():
|
|
96
96
|
p.add_argument(
|
97
97
|
"--version",
|
98
98
|
action="version",
|
99
|
-
version=f"%(prog)s {__version__}",
|
99
|
+
version=f"%(prog)s {slidge.__version__}",
|
100
100
|
)
|
101
101
|
configurator = MainConfig(config, p)
|
102
102
|
return configurator
|
@@ -128,7 +128,7 @@ def main():
|
|
128
128
|
signal.signal(signal.SIGTERM, handle_sigterm)
|
129
129
|
|
130
130
|
unknown_argv = configure()
|
131
|
-
logging.info("Starting slidge version %s", __version__)
|
131
|
+
logging.info("Starting slidge version %s", slidge.__version__)
|
132
132
|
|
133
133
|
legacy_module = importlib.import_module(config.LEGACY_MODULE)
|
134
134
|
logging.debug("Legacy module: %s", dir(legacy_module))
|
slidge/util/types.py
CHANGED
@@ -21,7 +21,7 @@ from typing import (
|
|
21
21
|
)
|
22
22
|
|
23
23
|
from slixmpp import Message, Presence
|
24
|
-
from slixmpp.types import PresenceShows, PresenceTypes
|
24
|
+
from slixmpp.types import PresenceShows, PresenceTypes, ResourceDict
|
25
25
|
|
26
26
|
if TYPE_CHECKING:
|
27
27
|
from ..contact import LegacyContact
|
@@ -155,12 +155,6 @@ class MucType(IntEnum):
|
|
155
155
|
PseudoPresenceShow = Union[PresenceShows, Literal[""]]
|
156
156
|
|
157
157
|
|
158
|
-
class ResourceDict(TypedDict):
|
159
|
-
show: PseudoPresenceShow
|
160
|
-
status: str
|
161
|
-
priority: int
|
162
|
-
|
163
|
-
|
164
158
|
MessageOrPresenceTypeVar = TypeVar(
|
165
159
|
"MessageOrPresenceTypeVar", bound=Union[Message, Presence]
|
166
160
|
)
|
slidge/util/util.py
CHANGED
@@ -218,19 +218,6 @@ class SlidgeLogger(logging.Logger):
|
|
218
218
|
log = logging.getLogger(__name__)
|
219
219
|
|
220
220
|
|
221
|
-
def get_version() -> str:
|
222
|
-
try:
|
223
|
-
git = subprocess.check_output(
|
224
|
-
["git", "rev-parse", "HEAD"],
|
225
|
-
stderr=subprocess.DEVNULL,
|
226
|
-
cwd=Path(__file__).parent,
|
227
|
-
).decode()
|
228
|
-
except (FileNotFoundError, subprocess.CalledProcessError):
|
229
|
-
return "NO_VERSION"
|
230
|
-
else:
|
231
|
-
return "git-" + git[:10]
|
232
|
-
|
233
|
-
|
234
221
|
def merge_resources(resources: dict[str, ResourceDict]) -> Optional[ResourceDict]:
|
235
222
|
if len(resources) == 0:
|
236
223
|
return None
|
@@ -0,0 +1,134 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: slidge
|
3
|
+
Version: 0.2.9
|
4
|
+
Summary: XMPP bridging framework
|
5
|
+
Author-email: Nicolas Cedilnik <nicoco@nicoco.fr>
|
6
|
+
License-Expression: AGPL-3.0-or-later
|
7
|
+
Project-URL: Homepage, https://codeberg.org/slidge/
|
8
|
+
Project-URL: Issues, https://codeberg.org/slidge/slidge/issues
|
9
|
+
Project-URL: Repository, https://codeberg.org/slidge/slidge/
|
10
|
+
Project-URL: Chat room, https://conference.nicoco.fr:5281/muc_log/slidge/
|
11
|
+
Project-URL: Documentation, https://slidge.im/docs/slidge/main
|
12
|
+
Project-URL: changelog, https://codeberg.org/slidge/slidge/releases
|
13
|
+
Keywords: xmpp,gateway,bridge,instant messaging
|
14
|
+
Classifier: Topic :: Internet :: XMPP
|
15
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
16
|
+
Requires-Python: >=3.11
|
17
|
+
Description-Content-Type: text/markdown
|
18
|
+
License-File: LICENSE
|
19
|
+
Requires-Dist: aiohttp[speedups]<4,>=3.11.11
|
20
|
+
Requires-Dist: alembic<2,>=1.14.0
|
21
|
+
Requires-Dist: configargparse<2,>=1.7
|
22
|
+
Requires-Dist: defusedxml>=0.7.1
|
23
|
+
Requires-Dist: pillow<12,>=11.0.0
|
24
|
+
Requires-Dist: python-magic<0.5,>=0.4.27
|
25
|
+
Requires-Dist: qrcode<9,>=8.0
|
26
|
+
Requires-Dist: slixmpp<2,>=1.9.0
|
27
|
+
Requires-Dist: sqlalchemy<3,>=2
|
28
|
+
Requires-Dist: thumbhash>=0.1.2
|
29
|
+
Dynamic: license-file
|
30
|
+
|
31
|
+

|
32
|
+
|
33
|
+
[](https://conference.nicoco.fr:5281/muc_log/slidge/)
|
34
|
+
|
35
|
+
|
36
|
+
[](https://ci.codeberg.org/repos/14027)
|
37
|
+
[](https://slidge.im/coverage/main)
|
38
|
+
|
39
|
+
[](https://pypi.org/project/slidge/)
|
40
|
+
[](https://packages.debian.org/unstable/python3-slidge)
|
41
|
+
|
42
|
+
Slidge is an XMPP (puppeteer) gateway library in python.
|
43
|
+
It makes
|
44
|
+
[writing gateways to other chat networks](https://slidge.im/docs/slidge/main/dev/tutorial.html)
|
45
|
+
(*legacy modules*) as frictionless as possible.
|
46
|
+
It supports fancy IM features, such as
|
47
|
+
[(emoji) reactions](https://xmpp.org/extensions/xep-0444.html),
|
48
|
+
[replies](https://xmpp.org/extensions/xep-0461.html), and
|
49
|
+
[retractions](https://xmpp.org/extensions/xep-0424.html).
|
50
|
+
The full list of supported XEPs in on [xmpp.org](https://xmpp.org/software/slidge/).
|
51
|
+
|
52
|
+
Status
|
53
|
+
------
|
54
|
+
|
55
|
+
Slidge is **beta**-grade software. It support groups and 1:1 chats.
|
56
|
+
Try slidge and give us some
|
57
|
+
feedback, through the [MUC](xmpp:slidge@conference.nicoco.fr?join) or the
|
58
|
+
[issue tracker](https://codeberg.org/slidge/slidge/issues).
|
59
|
+
Don't be shy!
|
60
|
+
|
61
|
+
Usage
|
62
|
+
-----
|
63
|
+
|
64
|
+
A minimal (and fictional!) slidge-powered "legacy module" looks like this:
|
65
|
+
|
66
|
+
```python
|
67
|
+
from cool_chat_lib import CoolClient
|
68
|
+
from slidge import BaseGateway, BaseSession
|
69
|
+
from slidge.contact import LegacyContact
|
70
|
+
from slidge.group import LegacyMUC
|
71
|
+
from slidge.db import GatewayUser
|
72
|
+
|
73
|
+
|
74
|
+
class Gateway(BaseGateway):
|
75
|
+
# Various aspects of the gateway component are configured as class
|
76
|
+
# attributes of the concrete Gateway class
|
77
|
+
COMPONENT_NAME = "Gateway to the super duper chat network"
|
78
|
+
|
79
|
+
|
80
|
+
class Session(BaseSession):
|
81
|
+
def __init__(self, user: GatewayUser):
|
82
|
+
super().__init__(user)
|
83
|
+
self.legacy_client = CoolClient(
|
84
|
+
login=user.legacy_module_data["username"],
|
85
|
+
password=user.legacy_module_data["password"],
|
86
|
+
)
|
87
|
+
|
88
|
+
async def on_text(self, chat: LegacyContact | LegacyMUC, text: str, **kwargs):
|
89
|
+
"""
|
90
|
+
Triggered when the slidge user sends an XMPP message through the gateway
|
91
|
+
"""
|
92
|
+
self.legacy_client.send_message(text=text, destination=chat.legacy_id)
|
93
|
+
```
|
94
|
+
|
95
|
+
There's more in [the tutorial](https://slidge.im/docs/slidge/main/dev/tutorial.html)!
|
96
|
+
|
97
|
+
Installation
|
98
|
+
------------
|
99
|
+
|
100
|
+
⚠️ Slidge is a lib for gateway developers, if you are an XMPP server admin and
|
101
|
+
want to install gateways on your server, you are looking for a
|
102
|
+
[slidge-based gateway](https://codeberg.org/explore/repos?q=slidge&topic=1).
|
103
|
+
or the
|
104
|
+
[slidge-debian](https://git.sr.ht/~nicoco/slidge-debian)
|
105
|
+
bundle.
|
106
|
+
|
107
|
+
Slidge is available on
|
108
|
+
[codeberg](https://codeberg.org/slidge/-/packages) (python packages and containers)
|
109
|
+
and [pypi](https://pypi.org/project/slidge/).
|
110
|
+
Refer to [the docs](https://slidge.im/docs/slidge/main/admin/install.html) for details.
|
111
|
+
|
112
|
+
About privacy
|
113
|
+
-------------
|
114
|
+
|
115
|
+
Slidge (and most if not all XMPP gateway that I know of) will break
|
116
|
+
end-to-end encryption, or more precisely one of the 'ends' become the
|
117
|
+
gateway itself. If privacy is a major concern for you, my advice would
|
118
|
+
be to:
|
119
|
+
|
120
|
+
- use XMPP + OMEMO
|
121
|
+
- self-host your gateways
|
122
|
+
- have your gateways hosted by someone you know AFK and trust
|
123
|
+
|
124
|
+
Related projects
|
125
|
+
----------------
|
126
|
+
|
127
|
+
- [Spectrum](https://www.spectrum.im/)
|
128
|
+
- [telegabber](https://dev.narayana.im/narayana/telegabber)
|
129
|
+
- [biboumi](https://biboumi.louiz.org/)
|
130
|
+
- [Bifröst](https://github.com/matrix-org/matrix-bifrost)
|
131
|
+
- [Mautrix](https://github.com/mautrix)
|
132
|
+
- [matterbridge](https://github.com/42wim/matterbridge)
|
133
|
+
|
134
|
+
Thank you, [Trung](https://trung.fun/), for the slidge logo!
|
@@ -1,12 +1,11 @@
|
|
1
|
-
slidge/__init__.py,sha256=
|
1
|
+
slidge/__init__.py,sha256=36BNw5mWk_MWxlPMzNCJpspoou05hFaL-eQp-JwE3JU,1793
|
2
2
|
slidge/__main__.py,sha256=ydjUklOoavS4YlGfjRX_8BQN2DaSbaXPMi47RkOgcFI,37
|
3
|
-
slidge/
|
4
|
-
slidge/main.py,sha256=vMJzhvUxbeuIXuHxXXs6lm_ShBjXiS9B5Li5Ge4vWPo,6238
|
3
|
+
slidge/main.py,sha256=kusTX-W9cYo1I1TLqHEag20-TPsjFeF5BO2jC8y2Mt4,6223
|
5
4
|
slidge/migration.py,sha256=4BJmPIRB56_WIhRTqBFIIBXuvnhhBjjOMl4CE7jY6oc,1541
|
6
5
|
slidge/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
6
|
slidge/command/__init__.py,sha256=UYf1mjCYbZ5G7PIgaFTWSQRAzEJkQ6dTH8Fu_e_XnO0,613
|
8
7
|
slidge/command/adhoc.py,sha256=bYLXcYJjbqPE9nBhrEQevqYFh9AS7Ei3m1vTZBIggrc,10557
|
9
|
-
slidge/command/admin.py,sha256=
|
8
|
+
slidge/command/admin.py,sha256=DYN9yADZo2hKV0t20K2qnFPJHU98eKsaZTOqi1zdMys,6165
|
10
9
|
slidge/command/base.py,sha256=EDcEl5dJcooSmLarXI2fmBq6QtU7h-7MOM3DDsxXmTU,13447
|
11
10
|
slidge/command/categories.py,sha256=vF0KGDV9sEn8TNkcMoDRw-u3gEyNHSXghOU2JRHQtKs,351
|
12
11
|
slidge/command/chat_command.py,sha256=z-4qp03rK7kCh3_kEozDViwkDg_hVjHvRCiYYJxedBQ,11153
|
@@ -17,9 +16,9 @@ slidge/contact/contact.py,sha256=CLWuNLvWuODi1mlT6MFGx9s3y8yGPM8ZEsH-Ih6QEn8,229
|
|
17
16
|
slidge/contact/roster.py,sha256=19EYyX-usuevMob9AgnQmSt6APdE5MxMroHOYmVYt-w,10205
|
18
17
|
slidge/core/__init__.py,sha256=RG7Jj5JCJERjhqJ31lOLYV-7bH_oblClQD1KF9LsTXo,68
|
19
18
|
slidge/core/config.py,sha256=OjJfpXJaDhMxRB-vYA0cqkSf0fwMt-HMThM8GS1htCg,7964
|
20
|
-
slidge/core/gateway.py,sha256=
|
19
|
+
slidge/core/gateway.py,sha256=tBaI8ZTGEOeojgSny1rfec9w8MF24Buce8KL5oes984,37492
|
21
20
|
slidge/core/pubsub.py,sha256=BoeYE__ptmRAn4x55Hn_6JWRA4nM-XJgDemG5Cy5kN4,11959
|
22
|
-
slidge/core/session.py,sha256=
|
21
|
+
slidge/core/session.py,sha256=Ie1a6bpUCC_HFvm98S-t03WG5JlOFG0SwbmGB2l9ZTc,28439
|
23
22
|
slidge/core/dispatcher/__init__.py,sha256=1EXcjXietUKlxEqdrCWCV3xZ3q_DSsjHoqWrPMbtYao,84
|
24
23
|
slidge/core/dispatcher/caps.py,sha256=vzCAXo_bhALuLEpJWtyJTzVfWx96g1AsWD8_wkoDl0Y,2028
|
25
24
|
slidge/core/dispatcher/disco.py,sha256=j56VY9NIFzwPEWFKQQZ7YIqS9GdD-ZaF_K8a2L-JvRk,2006
|
@@ -81,7 +80,7 @@ slidge/group/__init__.py,sha256=yFt7cHqeaKIMN6f9ZyhhspOcJJvBtLedGv-iICG7lto,258
|
|
81
80
|
slidge/group/archive.py,sha256=AUzVtXlHiCreyY3jp1XMt0G7LDNm-qOU-4CEPQ89ics,5445
|
82
81
|
slidge/group/bookmarks.py,sha256=uGw_XtF0nloZ7rhNLdKM0nNZZb5C6SBfTsLyZryxjxY,6592
|
83
82
|
slidge/group/participant.py,sha256=h9Cz4liCWzCaysvDk4wr8-zHvLOyIoM3vvQWzHCdpFE,17690
|
84
|
-
slidge/group/room.py,sha256=
|
83
|
+
slidge/group/room.py,sha256=C0CYhn3EuqjQnGLia9A3_mmkGfc_gDmd-PMESggupFo,49164
|
85
84
|
slidge/slixfix/__init__.py,sha256=opamnCRI89KtCY2jfUrzij423hROgMF_Jw8Rrv1i0pw,2515
|
86
85
|
slidge/slixfix/delivery_receipt.py,sha256=3bWdZH3-X3CZJXmnI_TpjkTUUK-EY4Ktm78lW0-40fc,1366
|
87
86
|
slidge/slixfix/roster.py,sha256=KvDjh9q7pqaZf69H93okfib13cc95uVZUJ6rzpqmDaU,1704
|
@@ -103,10 +102,11 @@ slidge/util/archive_msg.py,sha256=xXAR0BI5r3d6KKWjae9594izCOv6iI03z2WLuTecNw8,17
|
|
103
102
|
slidge/util/conf.py,sha256=1j2OnOsCBar1tOObErhXR5RC3Vl3faliOZ1U8J3My58,6613
|
104
103
|
slidge/util/jid_escaping.py,sha256=pWJTrB6-M923a_rEE-nxPmiDTOx9UCMa8UgE7JbLC0c,1066
|
105
104
|
slidge/util/test.py,sha256=l1VHBsw5Uzk2t7wtkfb9kWvtehcYhw1t_d567JAJFKA,14135
|
106
|
-
slidge/util/types.py,sha256=
|
107
|
-
slidge/util/util.py,sha256=
|
108
|
-
slidge-0.2.
|
109
|
-
slidge-0.2.
|
110
|
-
slidge-0.2.
|
111
|
-
slidge-0.2.
|
112
|
-
slidge-0.2.
|
105
|
+
slidge/util/types.py,sha256=5j0G22hhsh3PNhtpJaz2DVt5XINJznZjz0hqewPZoFo,5407
|
106
|
+
slidge/util/util.py,sha256=ZkQltO6JmfqZc9T-86XI6gAsZx9BLdF0CCurnxPRNRc,9329
|
107
|
+
slidge-0.2.9.dist-info/licenses/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
|
108
|
+
slidge-0.2.9.dist-info/METADATA,sha256=tmqEtywN5eD_3DDDeh4nPQIvp51Uc7d8wRgKibuh-QE,5102
|
109
|
+
slidge-0.2.9.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
110
|
+
slidge-0.2.9.dist-info/entry_points.txt,sha256=py3_x834fFJ2TEzPd18Wt2DnysdAfuVqJ5zzBrXbAZs,44
|
111
|
+
slidge-0.2.9.dist-info/top_level.txt,sha256=2LRjDYHaGZ5ieCMF8xy58JIiabRMzX-MGMbCZwfE17c,7
|
112
|
+
slidge-0.2.9.dist-info/RECORD,,
|