slidge 0.1.0rc1__tar.gz → 0.1.1__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (176) hide show
  1. slidge-0.1.1/PKG-INFO +110 -0
  2. slidge-0.1.1/README.md +85 -0
  3. slidge-0.1.1/pyproject.toml +88 -0
  4. slidge-0.1.1/slidge/__init__.py +61 -0
  5. {slidge-0.1.0rc1 → slidge-0.1.1}/slidge/__main__.py +51 -5
  6. slidge-0.1.1/slidge/command/__init__.py +28 -0
  7. slidge-0.1.1/slidge/command/adhoc.py +258 -0
  8. slidge-0.1.1/slidge/command/admin.py +193 -0
  9. slidge-0.1.1/slidge/command/base.py +441 -0
  10. slidge-0.1.1/slidge/command/categories.py +3 -0
  11. slidge-0.1.1/slidge/command/chat_command.py +288 -0
  12. slidge-0.1.1/slidge/command/register.py +179 -0
  13. slidge-0.1.1/slidge/command/user.py +250 -0
  14. slidge-0.1.1/slidge/contact/__init__.py +8 -0
  15. slidge-0.1.1/slidge/contact/contact.py +452 -0
  16. slidge-0.1.1/slidge/contact/roster.py +192 -0
  17. {slidge-0.1.0rc1 → slidge-0.1.1}/slidge/core/__init__.py +2 -0
  18. slidge-0.1.1/slidge/core/cache.py +183 -0
  19. slidge-0.1.1/slidge/core/config.py +216 -0
  20. slidge-0.1.1/slidge/core/gateway/__init__.py +3 -0
  21. slidge-0.1.1/slidge/core/gateway/base.py +895 -0
  22. slidge-0.1.1/slidge/core/gateway/caps.py +63 -0
  23. slidge-0.1.1/slidge/core/gateway/delivery_receipt.py +52 -0
  24. slidge-0.1.1/slidge/core/gateway/disco.py +80 -0
  25. slidge-0.1.1/slidge/core/gateway/mam.py +75 -0
  26. slidge-0.1.1/slidge/core/gateway/muc_admin.py +35 -0
  27. slidge-0.1.1/slidge/core/gateway/ping.py +66 -0
  28. slidge-0.1.1/slidge/core/gateway/presence.py +95 -0
  29. slidge-0.1.1/slidge/core/gateway/registration.py +53 -0
  30. slidge-0.1.1/slidge/core/gateway/search.py +102 -0
  31. slidge-0.1.1/slidge/core/gateway/session_dispatcher.py +789 -0
  32. slidge-0.1.1/slidge/core/gateway/vcard_temp.py +130 -0
  33. {slidge-0.1.0rc1 → slidge-0.1.1}/slidge/core/mixins/__init__.py +9 -1
  34. slidge-0.1.1/slidge/core/mixins/attachment.py +506 -0
  35. slidge-0.1.1/slidge/core/mixins/avatar.py +167 -0
  36. slidge-0.1.1/slidge/core/mixins/base.py +31 -0
  37. slidge-0.1.1/slidge/core/mixins/disco.py +130 -0
  38. slidge-0.1.1/slidge/core/mixins/lock.py +31 -0
  39. slidge-0.1.1/slidge/core/mixins/message.py +398 -0
  40. slidge-0.1.1/slidge/core/mixins/message_maker.py +154 -0
  41. slidge-0.1.1/slidge/core/mixins/presence.py +217 -0
  42. slidge-0.1.1/slidge/core/mixins/recipient.py +43 -0
  43. slidge-0.1.1/slidge/core/pubsub.py +525 -0
  44. slidge-0.1.1/slidge/core/session.py +768 -0
  45. slidge-0.1.1/slidge/group/__init__.py +10 -0
  46. slidge-0.1.1/slidge/group/archive.py +125 -0
  47. slidge-0.1.1/slidge/group/bookmarks.py +163 -0
  48. slidge-0.1.1/slidge/group/participant.py +458 -0
  49. slidge-0.1.1/slidge/group/room.py +1103 -0
  50. slidge-0.1.1/slidge/migration.py +18 -0
  51. slidge-0.1.1/slidge/slixfix/__init__.py +68 -0
  52. {slidge-0.1.0rc1/slidge/util/xep_0050 → slidge-0.1.1/slidge/slixfix/link_preview}/__init__.py +4 -5
  53. slidge-0.1.1/slidge/slixfix/link_preview/link_preview.py +17 -0
  54. slidge-0.1.1/slidge/slixfix/link_preview/stanza.py +99 -0
  55. slidge-0.1.1/slidge/slixfix/roster.py +60 -0
  56. {slidge-0.1.0rc1/slidge/util → slidge-0.1.1/slidge/slixfix}/xep_0077/register.py +1 -2
  57. slidge-0.1.1/slidge/slixfix/xep_0077/stanza.py +104 -0
  58. {slidge-0.1.0rc1/slidge/util → slidge-0.1.1/slidge/slixfix}/xep_0100/gateway.py +17 -12
  59. slidge-0.1.1/slidge/slixfix/xep_0153/__init__.py +10 -0
  60. slidge-0.1.1/slidge/slixfix/xep_0153/stanza.py +25 -0
  61. slidge-0.1.1/slidge/slixfix/xep_0153/vcard_avatar.py +23 -0
  62. slidge-0.1.1/slidge/slixfix/xep_0264/__init__.py +5 -0
  63. slidge-0.1.1/slidge/slixfix/xep_0264/stanza.py +36 -0
  64. slidge-0.1.1/slidge/slixfix/xep_0264/thumbnail.py +23 -0
  65. slidge-0.1.1/slidge/slixfix/xep_0292/__init__.py +5 -0
  66. slidge-0.1.1/slidge/slixfix/xep_0292/vcard4.py +100 -0
  67. slidge-0.1.1/slidge/slixfix/xep_0313/__init__.py +12 -0
  68. slidge-0.1.1/slidge/slixfix/xep_0313/mam.py +262 -0
  69. slidge-0.1.1/slidge/slixfix/xep_0313/stanza.py +359 -0
  70. slidge-0.1.1/slidge/slixfix/xep_0317/__init__.py +5 -0
  71. slidge-0.1.1/slidge/slixfix/xep_0317/hats.py +17 -0
  72. slidge-0.1.1/slidge/slixfix/xep_0317/stanza.py +28 -0
  73. {slidge-0.1.0rc1/slidge/util → slidge-0.1.1/slidge/slixfix}/xep_0356_old/privilege.py +9 -7
  74. slidge-0.1.1/slidge/slixfix/xep_0424/__init__.py +9 -0
  75. slidge-0.1.1/slidge/slixfix/xep_0424/retraction.py +77 -0
  76. slidge-0.1.1/slidge/slixfix/xep_0424/stanza.py +28 -0
  77. slidge-0.1.1/slidge/slixfix/xep_0490/__init__.py +8 -0
  78. slidge-0.1.1/slidge/slixfix/xep_0490/mds.py +47 -0
  79. slidge-0.1.1/slidge/slixfix/xep_0490/stanza.py +17 -0
  80. {slidge-0.1.0rc1 → slidge-0.1.1}/slidge/util/__init__.py +4 -6
  81. slidge-0.1.1/slidge/util/archive_msg.py +61 -0
  82. {slidge-0.1.0rc1 → slidge-0.1.1}/slidge/util/conf.py +25 -4
  83. {slidge-0.1.0rc1 → slidge-0.1.1}/slidge/util/db.py +23 -69
  84. slidge-0.1.1/slidge/util/schema.sql +126 -0
  85. slidge-0.1.1/slidge/util/sql.py +508 -0
  86. {slidge-0.1.0rc1 → slidge-0.1.1}/slidge/util/test.py +136 -86
  87. slidge-0.1.1/slidge/util/types.py +180 -0
  88. slidge-0.1.1/slidge/util/util.py +295 -0
  89. slidge-0.1.0rc1/PKG-INFO +0 -171
  90. slidge-0.1.0rc1/README.md +0 -132
  91. slidge-0.1.0rc1/pyproject.toml +0 -65
  92. slidge-0.1.0rc1/setup.py +0 -69
  93. slidge-0.1.0rc1/slidge/__init__.py +0 -38
  94. slidge-0.1.0rc1/slidge/core/adhoc.py +0 -492
  95. slidge-0.1.0rc1/slidge/core/cache.py +0 -101
  96. slidge-0.1.0rc1/slidge/core/chat_command.py +0 -197
  97. slidge-0.1.0rc1/slidge/core/config.py +0 -111
  98. slidge-0.1.0rc1/slidge/core/contact.py +0 -441
  99. slidge-0.1.0rc1/slidge/core/disco.py +0 -59
  100. slidge-0.1.0rc1/slidge/core/gateway.py +0 -899
  101. slidge-0.1.0rc1/slidge/core/mixins/base.py +0 -44
  102. slidge-0.1.0rc1/slidge/core/mixins/disco.py +0 -79
  103. slidge-0.1.0rc1/slidge/core/mixins/message.py +0 -396
  104. slidge-0.1.0rc1/slidge/core/mixins/presence.py +0 -120
  105. slidge-0.1.0rc1/slidge/core/muc/__init__.py +0 -3
  106. slidge-0.1.0rc1/slidge/core/muc/bookmarks.py +0 -74
  107. slidge-0.1.0rc1/slidge/core/muc/participant.py +0 -152
  108. slidge-0.1.0rc1/slidge/core/muc/room.py +0 -348
  109. slidge-0.1.0rc1/slidge/core/pubsub.py +0 -366
  110. slidge-0.1.0rc1/slidge/core/session.py +0 -700
  111. slidge-0.1.0rc1/slidge/plugins/discord/__init__.py +0 -121
  112. slidge-0.1.0rc1/slidge/plugins/discord/client.py +0 -121
  113. slidge-0.1.0rc1/slidge/plugins/discord/session.py +0 -172
  114. slidge-0.1.0rc1/slidge/plugins/dummy.py +0 -334
  115. slidge-0.1.0rc1/slidge/plugins/facebook.py +0 -591
  116. slidge-0.1.0rc1/slidge/plugins/hackernews.py +0 -209
  117. slidge-0.1.0rc1/slidge/plugins/mattermost/__init__.py +0 -1
  118. slidge-0.1.0rc1/slidge/plugins/mattermost/api.py +0 -288
  119. slidge-0.1.0rc1/slidge/plugins/mattermost/gateway.py +0 -417
  120. slidge-0.1.0rc1/slidge/plugins/mattermost/websocket.py +0 -248
  121. slidge-0.1.0rc1/slidge/plugins/signal/__init__.py +0 -4
  122. slidge-0.1.0rc1/slidge/plugins/signal/config.py +0 -4
  123. slidge-0.1.0rc1/slidge/plugins/signal/contact.py +0 -104
  124. slidge-0.1.0rc1/slidge/plugins/signal/gateway.py +0 -379
  125. slidge-0.1.0rc1/slidge/plugins/signal/group.py +0 -76
  126. slidge-0.1.0rc1/slidge/plugins/signal/session.py +0 -515
  127. slidge-0.1.0rc1/slidge/plugins/signal/txt.py +0 -13
  128. slidge-0.1.0rc1/slidge/plugins/signal/util.py +0 -32
  129. slidge-0.1.0rc1/slidge/plugins/skype.py +0 -310
  130. slidge-0.1.0rc1/slidge/plugins/steam.py +0 -400
  131. slidge-0.1.0rc1/slidge/plugins/telegram/__init__.py +0 -6
  132. slidge-0.1.0rc1/slidge/plugins/telegram/client.py +0 -325
  133. slidge-0.1.0rc1/slidge/plugins/telegram/config.py +0 -21
  134. slidge-0.1.0rc1/slidge/plugins/telegram/contact.py +0 -154
  135. slidge-0.1.0rc1/slidge/plugins/telegram/gateway.py +0 -182
  136. slidge-0.1.0rc1/slidge/plugins/telegram/group.py +0 -184
  137. slidge-0.1.0rc1/slidge/plugins/telegram/session.py +0 -275
  138. slidge-0.1.0rc1/slidge/plugins/telegram/util.py +0 -153
  139. slidge-0.1.0rc1/slidge/plugins/whatsapp/__init__.py +0 -6
  140. slidge-0.1.0rc1/slidge/plugins/whatsapp/config.py +0 -17
  141. slidge-0.1.0rc1/slidge/plugins/whatsapp/contact.py +0 -33
  142. slidge-0.1.0rc1/slidge/plugins/whatsapp/event.go +0 -455
  143. slidge-0.1.0rc1/slidge/plugins/whatsapp/gateway.go +0 -156
  144. slidge-0.1.0rc1/slidge/plugins/whatsapp/gateway.py +0 -69
  145. slidge-0.1.0rc1/slidge/plugins/whatsapp/go.mod +0 -17
  146. slidge-0.1.0rc1/slidge/plugins/whatsapp/go.sum +0 -22
  147. slidge-0.1.0rc1/slidge/plugins/whatsapp/session.go +0 -371
  148. slidge-0.1.0rc1/slidge/plugins/whatsapp/session.py +0 -370
  149. slidge-0.1.0rc1/slidge/util/types.py +0 -39
  150. slidge-0.1.0rc1/slidge/util/util.py +0 -121
  151. slidge-0.1.0rc1/slidge/util/xep_0030/__init__.py +0 -13
  152. slidge-0.1.0rc1/slidge/util/xep_0030/disco.py +0 -811
  153. slidge-0.1.0rc1/slidge/util/xep_0030/stanza/__init__.py +0 -7
  154. slidge-0.1.0rc1/slidge/util/xep_0030/stanza/info.py +0 -270
  155. slidge-0.1.0rc1/slidge/util/xep_0030/stanza/items.py +0 -147
  156. slidge-0.1.0rc1/slidge/util/xep_0030/static.py +0 -467
  157. slidge-0.1.0rc1/slidge/util/xep_0050/adhoc.py +0 -631
  158. slidge-0.1.0rc1/slidge/util/xep_0050/stanza.py +0 -180
  159. slidge-0.1.0rc1/slidge/util/xep_0077/stanza.py +0 -71
  160. slidge-0.1.0rc1/slidge/util/xep_0292/__init__.py +0 -1
  161. slidge-0.1.0rc1/slidge/util/xep_0292/stanza.py +0 -167
  162. slidge-0.1.0rc1/slidge/util/xep_0292/vcard4.py +0 -74
  163. slidge-0.1.0rc1/slidge/util/xep_0356/__init__.py +0 -7
  164. slidge-0.1.0rc1/slidge/util/xep_0356/permissions.py +0 -35
  165. slidge-0.1.0rc1/slidge/util/xep_0356/privilege.py +0 -160
  166. slidge-0.1.0rc1/slidge/util/xep_0356/stanza.py +0 -44
  167. slidge-0.1.0rc1/slidge/util/xep_0461/__init__.py +0 -6
  168. slidge-0.1.0rc1/slidge/util/xep_0461/reply.py +0 -48
  169. slidge-0.1.0rc1/slidge/util/xep_0461/stanza.py +0 -80
  170. {slidge-0.1.0rc1 → slidge-0.1.1}/LICENSE +0 -0
  171. /slidge-0.1.0rc1/slidge/plugins/__init__.py → /slidge-0.1.1/slidge/py.typed +0 -0
  172. {slidge-0.1.0rc1/slidge/util → slidge-0.1.1/slidge/slixfix}/xep_0077/__init__.py +0 -0
  173. {slidge-0.1.0rc1/slidge/util → slidge-0.1.1/slidge/slixfix}/xep_0100/__init__.py +0 -0
  174. {slidge-0.1.0rc1/slidge/util → slidge-0.1.1/slidge/slixfix}/xep_0100/stanza.py +0 -0
  175. {slidge-0.1.0rc1/slidge/util → slidge-0.1.1/slidge/slixfix}/xep_0356_old/__init__.py +0 -0
  176. {slidge-0.1.0rc1/slidge/util → slidge-0.1.1/slidge/slixfix}/xep_0356_old/stanza.py +0 -0
slidge-0.1.1/PKG-INFO ADDED
@@ -0,0 +1,110 @@
1
+ Metadata-Version: 2.1
2
+ Name: slidge
3
+ Version: 0.1.1
4
+ Summary: XMPP bridging framework
5
+ Home-page: https://sr.ht/~nicoco/slidge/
6
+ License: AGPL-3.0-or-later
7
+ Author: Nicolas Cedilnik
8
+ Author-email: nicoco@nicoco.fr
9
+ Requires-Python: >=3.9,<4.0
10
+ Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.9
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Requires-Dist: ConfigArgParse (>=1.5.3,<2.0.0)
16
+ Requires-Dist: Pillow (>=10,<11)
17
+ Requires-Dist: aiohttp[speedups] (>=3.8.3,<4.0.0)
18
+ Requires-Dist: blurhash-python (>=1.2.1,<2.0.0)
19
+ Requires-Dist: pickle-secure (>=0.99.9,<0.100.0)
20
+ Requires-Dist: python-magic (>=0.4.27,<0.5.0)
21
+ Requires-Dist: qrcode (>=7.4.1,<8.0.0)
22
+ Requires-Dist: slixmpp (>=1.8.5,<2.0.0)
23
+ Description-Content-Type: text/markdown
24
+
25
+ ![Slidge logo](./dev/assets/slidge-color-small.png)
26
+
27
+ [Home](https://sr.ht/~nicoco/slidge) |
28
+ [Docs](https://slidge.im/core) |
29
+ [Source](https://sr.ht/~nicoco/slidge/sources) |
30
+ [Issues](https://sr.ht/~nicoco/slidge/trackers) |
31
+ [Patches](https://lists.sr.ht/~nicoco/public-inbox) |
32
+ [Chat](xmpp:slidge@conference.nicoco.fr?join)
33
+
34
+ [![builds.sr.ht status](https://builds.sr.ht/~nicoco/slidge/commits/master/ci.yml.svg)](https://builds.sr.ht/~nicoco/slidge/commits/master/ci.yml?)
35
+ [![coverage](https://slidge.im/coverage.svg)](https://slidge.im/coverage)
36
+ [![pypi](https://badge.fury.io/py/slidge.svg)](https://pypi.org/project/slidge/)
37
+
38
+ Slidge is an XMPP (puppeteer) gateway library in python.
39
+ It makes
40
+ [writing gateways to other chat networks](https://slidge.im/core/dev/tutorial.html)
41
+ (*legacy modules*) as frictionless as possible.
42
+ It supports fancy IM features, such as
43
+ [(emoji) reactions](https://xmpp.org/extensions/xep-0444.html),
44
+ [replies](https://xmpp.org/extensions/xep-0461.html), and
45
+ [retractions](https://xmpp.org/extensions/xep-0424.html).
46
+ The full list of supported XEPs in on [xmpp.org](https://xmpp.org/software/slidge/).
47
+
48
+ Slidge is meant for gateway developers, if you are an XMPP server admin and
49
+ want to install gateways on your server, you are looking for one of these projects:
50
+
51
+ - [slidgnal](https://git.sr.ht/~nicoco/slidgnal) ([Signal](https://signal.org))
52
+ - [slidge-whatsapp](https://git.sr.ht/~nicoco/slidge-whatsapp) ([Whatsapp](https://whatsapp.com))
53
+ - [slidgram](https://git.sr.ht/~nicoco/slidgram) ([Telegram](https://telegram.org))
54
+ - [slidcord](https://git.sr.ht/~nicoco/slidcord) ([Discord](https://discord.com))
55
+ - [matteridge](https://git.sr.ht/~nicoco/matteridge) ([Mattermost](https://mattermost.com))
56
+ - [sleamdge](https://git.sr.ht/~nicoco/sleamdge) ([Steam](https://steamcommunity.com/))
57
+ - [skidge](https://git.sr.ht/~nicoco/skidge) ([Skype](https://skype.com/))
58
+ - [messlidger](https://git.sr.ht/~nicoco/messlidger) ([Facebook Messenger](https://messenger.com/))
59
+ - [matridge](https://git.sr.ht/~nicoco/matridge) ([Matrix](https://matrix.org/))
60
+ - [slidgevoipms](https://codeberg.org/boxedtoast/slidgevoipms) ([voip.ms](https://voip.ms/))
61
+
62
+ If you use debian, you might also be interested in the
63
+ [slidge-debian](https://git.sr.ht/~nicoco/slidge-debian)
64
+ bundle.
65
+
66
+ Status
67
+ ------
68
+
69
+ Slidge is **beta**-grade software for 1:1 chats.
70
+ Group chat support is **experimental**.
71
+
72
+ Try slidge and give us some
73
+ feedback, through the [MUC](xmpp:slidge@conference.nicoco.fr?join), the
74
+ [issue tracker](https://todo.sr.ht/~nicoco/slidge) or in the
75
+ [public inbox](https://lists.sr.ht/~nicoco/public-inbox).
76
+ Don't be shy!
77
+
78
+ Installation
79
+ ------------
80
+
81
+ Slidge is available on
82
+ [docker.io](https://hub.docker.com/u/nicocool84),
83
+ [pypi](https://pypi.org/project/slidge/) and as
84
+ [debian packages](https://slidge.im/core/admin/install.html#debian).
85
+ Refer to [the docs](https://slidge.im/core/admin/install.html) for details.
86
+
87
+ About privacy
88
+ -------------
89
+
90
+ Slidge (and most if not all XMPP gateway that I know of) will break
91
+ end-to-end encryption, or more precisely one of the 'ends' become the
92
+ gateway itself. If privacy is a major concern for you, my advice would
93
+ be to:
94
+
95
+ - use XMPP + OMEMO
96
+ - self-host your gateways
97
+ - have your gateways hosted by someone you know AFK and trust
98
+
99
+ Related projects
100
+ ----------------
101
+
102
+ - [Spectrum](https://www.spectrum.im/)
103
+ - [telegabber](https://dev.narayana.im/narayana/telegabber)
104
+ - [biboumi](https://biboumi.louiz.org/)
105
+ - [Bifröst](https://github.com/matrix-org/matrix-bifrost)
106
+ - [Mautrix](https://github.com/mautrix)
107
+ - [matterbridge](https://github.com/42wim/matterbridge)
108
+
109
+ Thank you, [Trung](https://trung.fun/), for the slidge logo!
110
+
slidge-0.1.1/README.md ADDED
@@ -0,0 +1,85 @@
1
+ ![Slidge logo](./dev/assets/slidge-color-small.png)
2
+
3
+ [Home](https://sr.ht/~nicoco/slidge) |
4
+ [Docs](https://slidge.im/core) |
5
+ [Source](https://sr.ht/~nicoco/slidge/sources) |
6
+ [Issues](https://sr.ht/~nicoco/slidge/trackers) |
7
+ [Patches](https://lists.sr.ht/~nicoco/public-inbox) |
8
+ [Chat](xmpp:slidge@conference.nicoco.fr?join)
9
+
10
+ [![builds.sr.ht status](https://builds.sr.ht/~nicoco/slidge/commits/master/ci.yml.svg)](https://builds.sr.ht/~nicoco/slidge/commits/master/ci.yml?)
11
+ [![coverage](https://slidge.im/coverage.svg)](https://slidge.im/coverage)
12
+ [![pypi](https://badge.fury.io/py/slidge.svg)](https://pypi.org/project/slidge/)
13
+
14
+ Slidge is an XMPP (puppeteer) gateway library in python.
15
+ It makes
16
+ [writing gateways to other chat networks](https://slidge.im/core/dev/tutorial.html)
17
+ (*legacy modules*) as frictionless as possible.
18
+ It supports fancy IM features, such as
19
+ [(emoji) reactions](https://xmpp.org/extensions/xep-0444.html),
20
+ [replies](https://xmpp.org/extensions/xep-0461.html), and
21
+ [retractions](https://xmpp.org/extensions/xep-0424.html).
22
+ The full list of supported XEPs in on [xmpp.org](https://xmpp.org/software/slidge/).
23
+
24
+ Slidge is meant for gateway developers, if you are an XMPP server admin and
25
+ want to install gateways on your server, you are looking for one of these projects:
26
+
27
+ - [slidgnal](https://git.sr.ht/~nicoco/slidgnal) ([Signal](https://signal.org))
28
+ - [slidge-whatsapp](https://git.sr.ht/~nicoco/slidge-whatsapp) ([Whatsapp](https://whatsapp.com))
29
+ - [slidgram](https://git.sr.ht/~nicoco/slidgram) ([Telegram](https://telegram.org))
30
+ - [slidcord](https://git.sr.ht/~nicoco/slidcord) ([Discord](https://discord.com))
31
+ - [matteridge](https://git.sr.ht/~nicoco/matteridge) ([Mattermost](https://mattermost.com))
32
+ - [sleamdge](https://git.sr.ht/~nicoco/sleamdge) ([Steam](https://steamcommunity.com/))
33
+ - [skidge](https://git.sr.ht/~nicoco/skidge) ([Skype](https://skype.com/))
34
+ - [messlidger](https://git.sr.ht/~nicoco/messlidger) ([Facebook Messenger](https://messenger.com/))
35
+ - [matridge](https://git.sr.ht/~nicoco/matridge) ([Matrix](https://matrix.org/))
36
+ - [slidgevoipms](https://codeberg.org/boxedtoast/slidgevoipms) ([voip.ms](https://voip.ms/))
37
+
38
+ If you use debian, you might also be interested in the
39
+ [slidge-debian](https://git.sr.ht/~nicoco/slidge-debian)
40
+ bundle.
41
+
42
+ Status
43
+ ------
44
+
45
+ Slidge is **beta**-grade software for 1:1 chats.
46
+ Group chat support is **experimental**.
47
+
48
+ Try slidge and give us some
49
+ feedback, through the [MUC](xmpp:slidge@conference.nicoco.fr?join), the
50
+ [issue tracker](https://todo.sr.ht/~nicoco/slidge) or in the
51
+ [public inbox](https://lists.sr.ht/~nicoco/public-inbox).
52
+ Don't be shy!
53
+
54
+ Installation
55
+ ------------
56
+
57
+ Slidge is available on
58
+ [docker.io](https://hub.docker.com/u/nicocool84),
59
+ [pypi](https://pypi.org/project/slidge/) and as
60
+ [debian packages](https://slidge.im/core/admin/install.html#debian).
61
+ Refer to [the docs](https://slidge.im/core/admin/install.html) for details.
62
+
63
+ About privacy
64
+ -------------
65
+
66
+ Slidge (and most if not all XMPP gateway that I know of) will break
67
+ end-to-end encryption, or more precisely one of the 'ends' become the
68
+ gateway itself. If privacy is a major concern for you, my advice would
69
+ be to:
70
+
71
+ - use XMPP + OMEMO
72
+ - self-host your gateways
73
+ - have your gateways hosted by someone you know AFK and trust
74
+
75
+ Related projects
76
+ ----------------
77
+
78
+ - [Spectrum](https://www.spectrum.im/)
79
+ - [telegabber](https://dev.narayana.im/narayana/telegabber)
80
+ - [biboumi](https://biboumi.louiz.org/)
81
+ - [Bifröst](https://github.com/matrix-org/matrix-bifrost)
82
+ - [Mautrix](https://github.com/mautrix)
83
+ - [matterbridge](https://github.com/42wim/matterbridge)
84
+
85
+ Thank you, [Trung](https://trung.fun/), for the slidge logo!
@@ -0,0 +1,88 @@
1
+ [tool.poetry]
2
+ name = "slidge"
3
+ version = "0.1.1"
4
+ description = "XMPP bridging framework"
5
+ authors = ["Nicolas Cedilnik <nicoco@nicoco.fr>"]
6
+ readme = "README.md"
7
+ license = "AGPL-3.0-or-later"
8
+ homepage = "https://sr.ht/~nicoco/slidge/"
9
+ include = ["slidge/util/schema.sql"]
10
+
11
+ [tool.poetry.dependencies]
12
+ python = "^3.9"
13
+ qrcode = "^7.4.1"
14
+ Pillow = "^10"
15
+ aiohttp = {version = "^3.8.3", extras = ["speedups"]}
16
+ ConfigArgParse = "^1.5.3"
17
+ pickle-secure = "^0.99.9"
18
+ python-magic = "^0.4.27"
19
+ slixmpp = "^1.8.5"
20
+ blurhash-python = "^1.2.1"
21
+
22
+ [build-system]
23
+ requires = ["poetry-core>=1.0.0"]
24
+ build-backend = "poetry.core.masonry.api"
25
+
26
+ [tool.poetry.group.dev.dependencies]
27
+ pytest = "^7.2.0"
28
+ pytest-asyncio = "*"
29
+ black = { version = "*", extras = ["d"] }
30
+ Sphinx = "^7"
31
+ Pygments = "^2.8.0"
32
+ sphinx-argparse = "^0.4.0"
33
+ sphinx-autoapi = "^3.0.0"
34
+ furo = "^2023.03.27"
35
+ mypy = "^1.2"
36
+ isort = "^5.11.4"
37
+ ruff = "^0.0.259"
38
+ xmldiff = "^2.5"
39
+ types-pillow = "^9.5.0.0"
40
+ pre-commit = "^3.3.0"
41
+ coverage = "^7.2.7"
42
+
43
+ [tool.poetry.group.dev.dependencies.slidge-dev-helpers]
44
+ git = "https://git.sr.ht/~nicoco/slidge-dev-helpers"
45
+ branch = "master"
46
+
47
+ [tool.poetry.scripts]
48
+ slidge = 'slidge.__main__:main'
49
+
50
+ [tool.mypy]
51
+ check_untyped_defs = true
52
+ files = ["slidge", "superduper"]
53
+ exclude = ["tests", "slidge.slixfix.*"]
54
+
55
+ [[tool.mypy.overrides]]
56
+ module = [
57
+ "blurhash",
58
+ "configargparse",
59
+ "qrcode",
60
+ ]
61
+ ignore_missing_imports = true
62
+
63
+ [tool.ruff]
64
+ line-length = 120
65
+ exclude = ["xep_*", "tests"]
66
+
67
+ [tool.isort]
68
+ profile = "black"
69
+
70
+ [tool.coverage.run]
71
+ source = ["slidge"]
72
+
73
+ [tool.coverage.report]
74
+ exclude_lines = [
75
+ "if .*TYPE_CHECKING:",
76
+ "raise NotImplementedError"
77
+ ]
78
+
79
+ [tool.pytest.ini_options]
80
+ log_cli = true
81
+ log_level = "DEBUG"
82
+ asyncio_mode = "strict"
83
+ filterwarnings = [
84
+ "ignore:The object should be created within an async function:DeprecationWarning:aiohttp",
85
+ "ignore:.*pkg_resources.*:DeprecationWarning",
86
+ "ignore::UserWarning:slidge",
87
+ "ignore:coroutine 'XMLStream._end_stream_wait' was never awaited.*:RuntimeWarning"
88
+ ]
@@ -0,0 +1,61 @@
1
+ """
2
+ The main slidge package.
3
+
4
+ Contains importable classes for a minimal function :term:`Legacy Module`.
5
+ """
6
+
7
+ import sys
8
+ import warnings
9
+
10
+ from . import slixfix # noqa: F401
11
+ from .command import FormField, SearchResult # noqa: F401
12
+ from .contact import LegacyContact, LegacyRoster # noqa: F401
13
+ from .core import config as global_config # noqa: F401
14
+ from .core.gateway import BaseGateway # noqa: F401
15
+ from .core.session import BaseSession # noqa: F401
16
+ from .group import LegacyBookmarks, LegacyMUC, LegacyParticipant # noqa: F401
17
+ from .util.db import GatewayUser, user_store # noqa: F401
18
+ from .util.types import MucType # noqa: F401
19
+ from .util.util import addLoggingLevel
20
+
21
+ from .__main__ import main # isort: skip
22
+
23
+
24
+ def entrypoint(module_name: str) -> None:
25
+ """
26
+ Entrypoint to be used in ``__main__.py`` of
27
+ :term:`legacy modules <Legacy Module>`.
28
+
29
+ :param module_name: An importable :term:`Legacy Module`.
30
+ """
31
+ sys.argv.extend(["--legacy", module_name])
32
+ main()
33
+
34
+
35
+ def formatwarning(message, category, filename, lineno, line=""):
36
+ return f"{filename}:{lineno}:{category.__name__}:{message}\n"
37
+
38
+
39
+ warnings.formatwarning = formatwarning
40
+
41
+
42
+ __all__ = [
43
+ "BaseGateway",
44
+ "BaseSession",
45
+ # For backwards compatibility, these names are still importable from the
46
+ # top-level slidge module, but this is deprecated.
47
+ # "GatewayUser",
48
+ # "LegacyBookmarks",
49
+ # "LegacyMUC",
50
+ # "LegacyContact",
51
+ # "LegacyParticipant",
52
+ # "LegacyRoster",
53
+ # "MucType",
54
+ # "FormField",
55
+ # "SearchResult",
56
+ "entrypoint",
57
+ "user_store",
58
+ "global_config",
59
+ ]
60
+
61
+ addLoggingLevel()
@@ -1,9 +1,22 @@
1
1
  """
2
2
  Slidge can be configured via CLI args, environment variables and/or INI files.
3
+
3
4
  To use env vars, use this convention: ``--home-dir`` becomes ``HOME_DIR``.
5
+
6
+ Everything in ``/etc/slidge/conf.d/*`` is automatically used.
7
+ To use a plugin-specific INI file, put it in another dir,
8
+ and launch slidge with ``-c /path/to/plugin-specific.conf``.
9
+ Use the long version of the CLI arg without the double dash prefix inside this
10
+ INI file, eg ``debug=true``.
11
+
12
+ An example configuration file is available at
13
+ https://git.sr.ht/~nicoco/slidge/tree/master/item/dev/confs/slidge-example.ini
4
14
  """
15
+
16
+ import asyncio
5
17
  import importlib
6
18
  import logging
19
+ import os
7
20
  import signal
8
21
  from pathlib import Path
9
22
 
@@ -12,13 +25,22 @@ import configargparse
12
25
  from slidge import BaseGateway
13
26
  from slidge.core import config
14
27
  from slidge.core.cache import avatar_cache
28
+ from slidge.migration import migrate
15
29
  from slidge.util.conf import ConfigModule
16
30
  from slidge.util.db import user_store
31
+ from slidge.util.util import get_version # noqa: F401
17
32
 
18
33
 
19
34
  class MainConfig(ConfigModule):
20
35
  def update_dynamic_defaults(self, args):
21
- logging.basicConfig(level=args.loglevel)
36
+ # force=True is needed in case we call a logger before this is reached,
37
+ # or basicConfig has no effect
38
+ logging.basicConfig(
39
+ level=args.loglevel,
40
+ filename=args.log_file,
41
+ force=True,
42
+ format=args.log_format,
43
+ )
22
44
 
23
45
  if args.home_dir is None:
24
46
  args.home_dir = Path("/var/lib/slidge") / str(args.jid)
@@ -33,7 +55,10 @@ class SigTermInterrupt(Exception):
33
55
 
34
56
  def get_configurator():
35
57
  p = configargparse.ArgumentParser(
36
- default_config_files=["/etc/slidge/conf.d/*.conf"], description=__doc__
58
+ default_config_files=os.getenv(
59
+ "SLIDGE_CONF_DIR", "/etc/slidge/conf.d/*.conf"
60
+ ).split(":"),
61
+ description=__doc__,
37
62
  )
38
63
  p.add_argument(
39
64
  "-c",
@@ -61,6 +86,11 @@ def get_configurator():
61
86
  const=logging.DEBUG,
62
87
  env_var="SLIDGE_DEBUG",
63
88
  )
89
+ p.add_argument(
90
+ "--version",
91
+ action="version",
92
+ version=f"%(prog)s {__version__}",
93
+ )
64
94
  configurator = MainConfig(config, p)
65
95
  return configurator
66
96
 
@@ -80,7 +110,7 @@ def configure():
80
110
  db_file = config.HOME_DIR / "slidge.db"
81
111
  user_store.set_file(db_file, args.secret_key)
82
112
 
83
- avatar_cache.set_dir(h / "slidge_avatars")
113
+ avatar_cache.set_dir(h / "slidge_avatars_v2")
84
114
 
85
115
  config.UPLOAD_REQUESTER = config.UPLOAD_REQUESTER or config.JID.bare
86
116
 
@@ -96,8 +126,15 @@ def main():
96
126
  signal.signal(signal.SIGTERM, handle_sigterm)
97
127
 
98
128
  unknown_argv = configure()
129
+ logging.info("Starting slidge version %s", __version__)
99
130
 
100
131
  legacy_module = importlib.import_module(config.LEGACY_MODULE)
132
+ logging.debug("Legacy module: %s", dir(legacy_module))
133
+ logging.info(
134
+ "Starting legacy module: '%s' version %s",
135
+ config.LEGACY_MODULE,
136
+ getattr(legacy_module, "__version__", "No version"),
137
+ )
101
138
 
102
139
  if plugin_config_obj := getattr(
103
140
  legacy_module, "config", getattr(legacy_module, "Config", None)
@@ -112,7 +149,10 @@ def main():
112
149
  if unknown_argv:
113
150
  raise RuntimeError("Some arguments have not been recognized", unknown_argv)
114
151
 
115
- gateway = BaseGateway.get_unique_subclass()()
152
+ migrate()
153
+
154
+ gateway: BaseGateway = BaseGateway.get_unique_subclass()()
155
+ avatar_cache.http = gateway.http
116
156
  gateway.connect()
117
157
 
118
158
  return_code = 0
@@ -136,17 +176,23 @@ def main():
136
176
  return_code = 3
137
177
  if gateway.is_connected():
138
178
  logging.debug("Gateway is connected, cleaning up")
139
- gateway.shutdown()
179
+ gateway.loop.run_until_complete(asyncio.gather(*gateway.shutdown()))
140
180
  gateway.disconnect()
141
181
  gateway.loop.run_until_complete(gateway.disconnected)
142
182
  else:
143
183
  logging.debug("Gateway is not connected, no need to clean up")
144
184
  user_store.close()
145
185
  avatar_cache.close()
186
+ gateway.loop.run_until_complete(gateway.http.close())
146
187
  logging.info("Successful clean shut down")
147
188
  logging.debug("Exiting with code %s", return_code)
148
189
  exit(return_code)
149
190
 
150
191
 
192
+ # this should be modified before publish, but if someone cloned from the repo,
193
+ # it can help
194
+ __version__ = get_version()
195
+
196
+
151
197
  if __name__ == "__main__":
152
198
  main()
@@ -0,0 +1,28 @@
1
+ """
2
+ This module implements an unified API to define :term:`adhoc <Ad-hoc Command>`
3
+ or :term:`chatbot <Chatbot Command>` commands. Just subclass a :class:`Command`,
4
+ and make sures it is imported in your legacy module's ``__init__.py``.
5
+ """
6
+
7
+ from . import admin, register, user # noqa: F401
8
+ from .base import (
9
+ Command,
10
+ CommandAccess,
11
+ CommandResponseType,
12
+ Confirmation,
13
+ Form,
14
+ FormField,
15
+ SearchResult,
16
+ TableResult,
17
+ )
18
+
19
+ __all__ = (
20
+ "Command",
21
+ "CommandAccess",
22
+ "CommandResponseType",
23
+ "Confirmation",
24
+ "Form",
25
+ "FormField",
26
+ "SearchResult",
27
+ "TableResult",
28
+ )