slidge 0.3.0a2__py3-none-any.whl → 0.3.0b1__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.
Files changed (39) hide show
  1. slidge/contact/contact.py +2 -2
  2. slidge/core/gateway.py +3 -4
  3. slidge/core/mixins/attachment.py +36 -2
  4. slidge/core/mixins/avatar.py +22 -5
  5. slidge/core/session.py +6 -2
  6. slidge/db/alembic/versions/cef02a8b1451_initial_schema.py +361 -0
  7. slidge/db/models.py +1 -0
  8. slidge/group/participant.py +1 -1
  9. slidge/group/room.py +26 -52
  10. slidge/migration.py +14 -5
  11. {slidge-0.3.0a2.dist-info → slidge-0.3.0b1.dist-info}/METADATA +1 -1
  12. {slidge-0.3.0a2.dist-info → slidge-0.3.0b1.dist-info}/RECORD +16 -38
  13. {slidge-0.3.0a2.dist-info → slidge-0.3.0b1.dist-info}/WHEEL +1 -1
  14. slidge/db/alembic/versions/0337c90c0b96_unify_legacy_xmpp_id_mappings.py +0 -183
  15. slidge/db/alembic/versions/04cf35e3cf85_add_participant_nickname_no_illegal.py +0 -33
  16. slidge/db/alembic/versions/09f27f098baa_add_missing_attributes_in_room.py +0 -36
  17. slidge/db/alembic/versions/15b0bd83407a_remove_bogus_unique_constraints_on_room_.py +0 -85
  18. slidge/db/alembic/versions/2461390c0af2_store_contacts_caps_verstring_in_db.py +0 -36
  19. slidge/db/alembic/versions/29f5280c61aa_store_subject_setter_in_room.py +0 -37
  20. slidge/db/alembic/versions/2b1f45ab7379_store_room_subject_setter_by_nickname.py +0 -41
  21. slidge/db/alembic/versions/3071e0fa69d4_add_contact_client_type.py +0 -52
  22. slidge/db/alembic/versions/45c24cc73c91_add_bob.py +0 -42
  23. slidge/db/alembic/versions/4dbd23a3f868_new_avatar_store.py +0 -105
  24. slidge/db/alembic/versions/54ce3cde350c_use_hash_for_avatar_filenames.py +0 -50
  25. slidge/db/alembic/versions/58b98dacf819_refactor.py +0 -118
  26. slidge/db/alembic/versions/5bd48bfdffa2_lift_room_legacy_id_constraint.py +0 -61
  27. slidge/db/alembic/versions/75a62b74b239_ditch_hats_table.py +0 -74
  28. slidge/db/alembic/versions/82a4af84b679_add_muc_history_filled.py +0 -48
  29. slidge/db/alembic/versions/8b993243a536_add_vcard_content_to_contact_table.py +0 -43
  30. slidge/db/alembic/versions/8d2ced764698_rely_on_db_to_store_contacts_rooms_and_.py +0 -139
  31. slidge/db/alembic/versions/aa9d82a7f6ef_db_creation.py +0 -50
  32. slidge/db/alembic/versions/abba1ae0edb3_store_avatar_legacy_id_in_the_contact_.py +0 -79
  33. slidge/db/alembic/versions/b33993e87db3_move_everything_to_persistent_db.py +0 -214
  34. slidge/db/alembic/versions/b64b1a793483_add_source_and_legacy_id_for_archived_.py +0 -52
  35. slidge/db/alembic/versions/c4a8ec35a0e8_per_room_user_nick.py +0 -34
  36. slidge/db/alembic/versions/e91195719c2c_store_users_avatars_persistently.py +0 -26
  37. {slidge-0.3.0a2.dist-info → slidge-0.3.0b1.dist-info}/entry_points.txt +0 -0
  38. {slidge-0.3.0a2.dist-info → slidge-0.3.0b1.dist-info}/licenses/LICENSE +0 -0
  39. {slidge-0.3.0a2.dist-info → slidge-0.3.0b1.dist-info}/top_level.txt +0 -0
slidge/group/room.py CHANGED
@@ -18,6 +18,7 @@ from slixmpp.plugins.xep_0469.stanza import NS as PINNING_NS
18
18
  from slixmpp.plugins.xep_0492.stanza import NS as NOTIFY_NS
19
19
  from slixmpp.plugins.xep_0492.stanza import WhenLiteral
20
20
  from slixmpp.xmlstream import ET
21
+ from sqlalchemy.exc import InvalidRequestError
21
22
  from sqlalchemy.orm import Session as OrmSession
22
23
 
23
24
  from ..contact.contact import LegacyContact
@@ -87,17 +88,6 @@ class LegacyMUC(
87
88
  This is just a flag on archive responses that most clients ignore anyway.
88
89
  """
89
90
 
90
- KEEP_BACKFILLED_PARTICIPANTS = False
91
- """
92
- Set this to ``True`` if the participant list is not full after calling
93
- ``fill_participants()``. This is a workaround for networks with huge
94
- participant lists which do not map really well the MUCs where all presences
95
- are sent on join.
96
- It allows to ensure that the participants that last spoke (within the
97
- ``fill_history()`` method are effectively participants, thus making possible
98
- for XMPP clients to fetch their avatars.
99
- """
100
-
101
91
  _ALL_INFO_FILLED_ON_STARTUP = False
102
92
  """
103
93
  Set this to true if the fill_participants() / fill_participants() design does not
@@ -257,48 +247,33 @@ class LegacyMUC(
257
247
  return
258
248
  async with self.lock("fill participants"):
259
249
  parts: list[Participant] = []
260
- resources: set[str] = set()
250
+ resources = set[str]()
251
+ # During fill_participants(), self.get_participant*() methods may
252
+ # return a participant with a conflicting nick/resource.
261
253
  async for participant in self.fill_participants():
262
- if participant.stored.id is not None:
254
+ if participant.stored.resource in resources:
255
+ self.log.warning(
256
+ "Participant '%s' was yielded more than once by fill_participants()",
257
+ participant.stored.resource,
258
+ )
263
259
  continue
264
- # During fill_participants(), self.get_participant*() methods may
265
- # return a participant with a conflicting nick/resource. There is
266
- # a better way to fix this than the logic below, but this better way
267
- # has not been found yet.
268
- if participant.jid.resource in resources:
269
- if participant.contact is None:
270
- self.log.warning(
271
- "Ditching participant %s", participant.nickname
272
- )
273
- del participant
274
- continue
275
- else:
276
- nickname = (
277
- f"{participant.nickname} ({participant.contact.jid.node})"
278
- )
279
- participant = self._participant_cls(
280
- self,
281
- Participant(nickname=nickname, room=self.stored),
282
- contact=participant.contact,
283
- )
284
- resources.add(participant.jid.resource)
285
260
  parts.append(participant.stored)
261
+ resources.add(participant.stored.resource)
286
262
  with self.xmpp.store.session(expire_on_commit=False) as orm:
287
- # FIXME: something must be wrong with all these refreshes and merge,
288
- # but I did not manage to get rid of them without getting various
289
- # sqlalchemy exceptions raised everywhere
290
263
  orm.add(self.stored)
291
- orm.refresh(self.stored)
292
- known = {p.resource for p in self.stored.participants}
293
- self.stored.participants_filled = True
264
+ # because self.participants() is async, self.stored may be out of sync at
265
+ # this point.
266
+ with orm.no_autoflush:
267
+ orm.refresh(self.stored)
294
268
  for part in parts:
295
- if part.resource in known:
296
- continue
297
- part = orm.merge(part)
298
- orm.add(part)
299
- self.stored.participants.append(part)
269
+ try:
270
+ self.stored.participants.append(part)
271
+ except InvalidRequestError:
272
+ # the participant was already stored in the DB. `part` may even
273
+ # be out-of-sync, so it's fine to just ditch it.
274
+ pass
275
+ self.stored.participants_filled = True
300
276
  orm.commit()
301
- orm.refresh(self.stored)
302
277
 
303
278
  async def get_participants(
304
279
  self, affiliation: Optional[MucAffiliation] = None
@@ -320,10 +295,6 @@ class LegacyMUC(
320
295
  return
321
296
  async with self.lock("fill history"):
322
297
  log.debug("Fetching history for %s", self)
323
- if not self.KEEP_BACKFILLED_PARTICIPANTS:
324
- with self.xmpp.store.session() as orm:
325
- orm.add(self.stored)
326
- participants = list(self.stored.participants)
327
298
  try:
328
299
  before, after = self.archive.get_hole_bounds()
329
300
  if before is not None:
@@ -339,8 +310,7 @@ class LegacyMUC(
339
310
  return
340
311
  except Exception as e:
341
312
  self.log.exception("Could not backfill", exc_info=e)
342
- if not self.KEEP_BACKFILLED_PARTICIPANTS:
343
- self.stored.participants = participants
313
+
344
314
  self.stored.history_filled = True
345
315
  self.commit(merge=True)
346
316
 
@@ -657,6 +627,10 @@ class LegacyMUC(
657
627
 
658
628
  if user_participant is None:
659
629
  user_participant = await self.get_user_participant()
630
+ with self.xmpp.store.session() as orm:
631
+ orm.add(self.stored)
632
+ with orm.no_autoflush:
633
+ orm.refresh(self.stored, ["participants"])
660
634
  if not user_participant.is_user:
661
635
  self.log.warning("is_user flag not set participant on user_participant")
662
636
  user_participant.is_user = True # type:ignore
slidge/migration.py CHANGED
@@ -1,16 +1,13 @@
1
1
  import logging
2
2
  import shutil
3
3
  import sys
4
+ import traceback
4
5
  from pathlib import Path
5
6
 
6
7
  from alembic import command
7
8
  from alembic.config import Config
8
- from slixmpp import JID
9
9
 
10
10
  from .core import config
11
- from .db.meta import get_engine
12
- from .db.models import GatewayUser
13
- from .db.store import SlidgeStore
14
11
 
15
12
 
16
13
  def remove_avatar_cache_v1() -> None:
@@ -32,7 +29,15 @@ def get_alembic_cfg() -> Config:
32
29
 
33
30
  def migrate() -> None:
34
31
  remove_avatar_cache_v1()
35
- command.upgrade(get_alembic_cfg(), "head")
32
+ try:
33
+ command.upgrade(get_alembic_cfg(), "head")
34
+ except Exception as e:
35
+ traceback.print_exception(e)
36
+ print(
37
+ "Something went wrong during the migration. "
38
+ "This is expected if you upgrade from slidge 0.2, in this case you need to start from a fresh database."
39
+ )
40
+ exit(1)
36
41
 
37
42
 
38
43
  def main() -> None:
@@ -41,6 +46,10 @@ def main() -> None:
41
46
 
42
47
  Usage: python -m slidge.migration "Revision message blah blah blah"
43
48
  """
49
+ dev_db = Path(".") / "dev" / "slidge.sqlite"
50
+ if dev_db.exists():
51
+ # always start from a clean state
52
+ dev_db.unlink()
44
53
  alembic_cfg = get_alembic_cfg()
45
54
  command.upgrade(alembic_cfg, "head")
46
55
  command.revision(alembic_cfg, sys.argv[1], autogenerate=True)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: slidge
3
- Version: 0.3.0a2
3
+ Version: 0.3.0b1
4
4
  Summary: XMPP bridging framework
5
5
  Author-email: Nicolas Cedilnik <nicoco@nicoco.fr>
6
6
  License-Expression: AGPL-3.0-or-later
@@ -1,7 +1,7 @@
1
1
  slidge/__init__.py,sha256=OWGOMz8wl6I6XNUT9ipE9IFD-OinS8zQGGn4U_z3IWw,1835
2
2
  slidge/__main__.py,sha256=ydjUklOoavS4YlGfjRX_8BQN2DaSbaXPMi47RkOgcFI,37
3
3
  slidge/main.py,sha256=Q2memNl050JJhUk-ZKHV2Q2lVpdMtoyLKupKswq-swM,7070
4
- slidge/migration.py,sha256=gq14UVm0zGP7VankizT3jy9Q9zu7hJeTYpVlInrswf8,1221
4
+ slidge/migration.py,sha256=Y_PJ9ahHwcgwP1gnGByIiUJSxTu2DYFpmNiPdOpVgoQ,1545
5
5
  slidge/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  slidge/command/__init__.py,sha256=UYf1mjCYbZ5G7PIgaFTWSQRAzEJkQ6dTH8Fu_e_XnO0,613
7
7
  slidge/command/adhoc.py,sha256=NCHammJdl30eHniiYukYQZKp1IeI-5qv5u9NncLNSNM,10760
@@ -12,13 +12,13 @@ slidge/command/chat_command.py,sha256=r_qalygOCsEoS-OgWw8IIlAzTufhXNjduONbeoepUI
12
12
  slidge/command/register.py,sha256=BduDI31Kx8CbWWEdjybimTA5Wcfhn-Jkt8sSPsySCpo,6724
13
13
  slidge/command/user.py,sha256=VS7xuADXXes941OyiJbxC_C8d5hcqm-TSS4Gu82_8PQ,12173
14
14
  slidge/contact/__init__.py,sha256=WMMaHk7UW7YT9EH2LtPdkU0bHQaOp4ikBhbBQskmoc8,191
15
- slidge/contact/contact.py,sha256=ubqd3aH-TOcv5hsHGPSlDGyojQXn3wjalrO7l_LfZk8,19449
15
+ slidge/contact/contact.py,sha256=AZSpBInijGXn5hP_eJQhdyCOcUnzM62h65ZliyFZWhg,19497
16
16
  slidge/contact/roster.py,sha256=TAPvaPWUn77CHt8la_BLfQRkZZJhlG-hn2wEQZbGzJ8,9706
17
17
  slidge/core/__init__.py,sha256=RG7Jj5JCJERjhqJ31lOLYV-7bH_oblClQD1KF9LsTXo,68
18
18
  slidge/core/config.py,sha256=1HxHQ5BOnYghi8V5KbCQ6sUsNnXzAZAIoFA5PrMqH4E,6060
19
- slidge/core/gateway.py,sha256=IpnHk0D-MXBY2-oPu8u-WrO6bV2Smq95Quqeec5-DEI,40930
19
+ slidge/core/gateway.py,sha256=0nuWlig6K4urNowoEKCVkSvEVH46BhR70A52fH6O4AE,40956
20
20
  slidge/core/pubsub.py,sha256=-YK49tEdz_SLM3O8Y9zvu3p5KYhxgNpqbsD57rOIdNI,12141
21
- slidge/core/session.py,sha256=Arz8hQ99o_DJd4NnhRTPaeurywD48xahpjbUVFR8Lkk,29382
21
+ slidge/core/session.py,sha256=H6eZqjDYrQu5k26dCYH3GAWg-P2tdYin06aufuIrnWw,29464
22
22
  slidge/core/dispatcher/__init__.py,sha256=1EXcjXietUKlxEqdrCWCV3xZ3q_DSsjHoqWrPMbtYao,84
23
23
  slidge/core/dispatcher/caps.py,sha256=gISaHtFwFDXtkSrSsAkZfPiHQyXfmXg3v_YYU0w9iDg,2254
24
24
  slidge/core/dispatcher/disco.py,sha256=xVPyBFnnkON-JjjM1oydRa-dqnDbwAZER2MGQACRhVk,2309
@@ -39,8 +39,8 @@ slidge/core/dispatcher/muc/misc.py,sha256=FYo5FdmzksEuUCfCLLOOm8_8plXtZFQP8IzvzV
39
39
  slidge/core/dispatcher/muc/owner.py,sha256=dDAxpRaA8H_NJQNIyBNixck2oG4GHZeEQqPhKd7MmDQ,3359
40
40
  slidge/core/dispatcher/muc/ping.py,sha256=EgKKS9AvMnW-vINGcoGbtk6NdbN9A7zVaGfT5T7F6YE,1699
41
41
  slidge/core/mixins/__init__.py,sha256=Zea39CCwjJU5XfHwcYPEZ9Sin8z1BZxoV68G2RwC3nE,386
42
- slidge/core/mixins/attachment.py,sha256=nR_ZHaPbrrXi3Ko8we6vhlu6GD0k4lU6JD3PPzsnFwU,20484
43
- slidge/core/mixins/avatar.py,sha256=X5tS6jJmjEoHC6O9kMgkNJoXM8eCY53tzW8kv2NOyv4,5346
42
+ slidge/core/mixins/attachment.py,sha256=f_8SZGyEAK00fzpwUWyIocPzdkSl5awPihR6_GCgdDo,21766
43
+ slidge/core/mixins/avatar.py,sha256=x-PAbJFoMKZLoScVjIVzFuQvnJ4geXoAQrFHr5G_SOA,6113
44
44
  slidge/core/mixins/base.py,sha256=MOd-pas38_52VawQVlxWtBtmTKC6My9G0ZaCeQxOJbs,748
45
45
  slidge/core/mixins/db.py,sha256=a6idm-FgHWfDK-MJZWy5AkkBlyY8JmwOB8xAFmm0E9g,1934
46
46
  slidge/core/mixins/disco.py,sha256=jk3Z1B6zTuisHv8VKNRJodIo0ee5btYHh2ZrlflPj_Q,3670
@@ -52,39 +52,17 @@ slidge/core/mixins/recipient.py,sha256=b0uFnpym-hOFgYxGjXT1xQcZ4YRbDSBftPcNWLzSw
52
52
  slidge/db/__init__.py,sha256=EBDH1JSEhgqYcli2Bw11CRC749wJk8AOucgBzmhDSvU,105
53
53
  slidge/db/avatar.py,sha256=MXFd1oe0eL5CCUYbc5CpsIcbio3cY3xVoKt39RAoj9I,8240
54
54
  slidge/db/meta.py,sha256=NtjGWcqPfG7uPfwR_cC6_23zyo8ftqgKX8CbP9IBq6U,2185
55
- slidge/db/models.py,sha256=xkTveglIbJDwcm1YEF7urEC1LTlwyXYrxgT4Vppdmmg,12763
55
+ slidge/db/models.py,sha256=8z5bbaEINfU1Qx12iyHu4zRD9s3PwC6oUOz-PyBoqYg,12841
56
56
  slidge/db/store.py,sha256=shgBqGutbAeMD6T3sqH7Qo4IKs9TWwjwfH5-NDpj-kY,19399
57
57
  slidge/db/alembic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
58
58
  slidge/db/alembic/env.py,sha256=hsBlRNs0zF5diSHGRSa8Fi3qRVQDA2rJdR41AEIdvxc,1642
59
59
  slidge/db/alembic/script.py.mako,sha256=MEqL-2qATlST9TAOeYgscMn1uy6HUS9NFvDgl93dMj8,635
60
- slidge/db/alembic/versions/0337c90c0b96_unify_legacy_xmpp_id_mappings.py,sha256=51Z7jCMEKtSeex4FUikEy2g-KQggW0kB-qxpBFKQh-0,6832
61
- slidge/db/alembic/versions/04cf35e3cf85_add_participant_nickname_no_illegal.py,sha256=Dwz_azOXr7Tsw7Wnj0L8mknITIPXO9ewEsRn169EUNA,904
62
- slidge/db/alembic/versions/09f27f098baa_add_missing_attributes_in_room.py,sha256=mUL-0Io6ZPd_QbnKfwGYyjdMcM2uxQ0Wg72H23-2t_E,1033
63
- slidge/db/alembic/versions/15b0bd83407a_remove_bogus_unique_constraints_on_room_.py,sha256=kzHuHGhzey5CY0p_OsKf5a-3zSk2649wqg2ToLiSD1I,2927
64
- slidge/db/alembic/versions/2461390c0af2_store_contacts_caps_verstring_in_db.py,sha256=CLB-kOP9Rc0FJIKDLef912L5sYkjpTIPC8fhrIdrC7k,1084
65
- slidge/db/alembic/versions/29f5280c61aa_store_subject_setter_in_room.py,sha256=f8TFS28CXjGhvIn41UYMoHYeODfqhKfo4O7gk-JwA1E,1134
66
- slidge/db/alembic/versions/2b1f45ab7379_store_room_subject_setter_by_nickname.py,sha256=CMVP2wFz6s7t57eWdSaGtck8BXzfVPJhHE5AoWi34tI,1359
67
- slidge/db/alembic/versions/3071e0fa69d4_add_contact_client_type.py,sha256=jCdwCOnX9VDgnqIFFHGKaPA7w87Hm9nvR1rMY0LrA30,1394
68
- slidge/db/alembic/versions/45c24cc73c91_add_bob.py,sha256=UjMySZ5LaInyPt0KbAxx0rF4GQhZh8CwBeqHtNPdG1c,1249
69
- slidge/db/alembic/versions/4dbd23a3f868_new_avatar_store.py,sha256=JhT83RJfXlKu2y8iB4twtuINGfa9YKNh6jURXVedHOc,4002
70
- slidge/db/alembic/versions/54ce3cde350c_use_hash_for_avatar_filenames.py,sha256=aNwlpXCHI_TEnVt2w-C8OrdH02-FhgrKbZkEqt40ay4,1495
71
- slidge/db/alembic/versions/58b98dacf819_refactor.py,sha256=bQG57V7b0UK6of4MdDpoBNDtPQH5AYHqAkt3RL9OmaI,5001
72
- slidge/db/alembic/versions/5bd48bfdffa2_lift_room_legacy_id_constraint.py,sha256=m3USa76h0O2Xut-NePXIOZfkXl0bx0d5FyjOYpd34Jo,1977
73
- slidge/db/alembic/versions/75a62b74b239_ditch_hats_table.py,sha256=INKDe7Y5iMETpyFmwMyQm-RrnGjP9gbcC_pWKuXoi2I,2388
74
- slidge/db/alembic/versions/82a4af84b679_add_muc_history_filled.py,sha256=g37po0ydp8ZmzJrE5oFV7GscnploxjCtPDpw28SqVGk,1429
75
- slidge/db/alembic/versions/8b993243a536_add_vcard_content_to_contact_table.py,sha256=18tG8B03Kq8Qz_-mMd28Beed6jow8XNTtrz7gT5QY3g,1210
76
- slidge/db/alembic/versions/8d2ced764698_rely_on_db_to_store_contacts_rooms_and_.py,sha256=ikoAlRV3_BJcDcFRANF-9HTB--0xpY0C5XdGuMuW9c0,4866
77
- slidge/db/alembic/versions/aa9d82a7f6ef_db_creation.py,sha256=eFlfn-LiDph05yyCc8gmtJwVKzgrSHwyWJ6nuVfEpQA,1391
78
- slidge/db/alembic/versions/abba1ae0edb3_store_avatar_legacy_id_in_the_contact_.py,sha256=VprqEVHipYuM-ea-CIM4_ubOD5zJ9inLTbhXc869n3A,2779
79
- slidge/db/alembic/versions/b33993e87db3_move_everything_to_persistent_db.py,sha256=2tiRxoC9PYOQn6XQrwK0JTEsb45Pzp2PsKoZSS4rcIA,7564
80
- slidge/db/alembic/versions/b64b1a793483_add_source_and_legacy_id_for_archived_.py,sha256=r2sOgR5HcfueJyc3cWNDRmlZzdHOSX6nl2gef54wDbk,1559
81
- slidge/db/alembic/versions/c4a8ec35a0e8_per_room_user_nick.py,sha256=jjQmlRv6nqdm5q6LbwVpSUSkTBj1c76Hiq8e8q77q3g,933
82
- slidge/db/alembic/versions/e91195719c2c_store_users_avatars_persistently.py,sha256=8Ga3VFgKrzMs_-B8OPtfP-0rey_MFaDg-QGtSbaft3o,640
60
+ slidge/db/alembic/versions/cef02a8b1451_initial_schema.py,sha256=D1K-flfTM9Vkk0YFzg6HbmoDyEb2u5c751aXk2YzVVg,14881
83
61
  slidge/group/__init__.py,sha256=yFt7cHqeaKIMN6f9ZyhhspOcJJvBtLedGv-iICG7lto,258
84
62
  slidge/group/archive.py,sha256=DKwyde15-Op2rXuQBvdSmFcAKhUyWuorpEFcRSmDHec,5956
85
63
  slidge/group/bookmarks.py,sha256=UWrUjZMWlDmwKFRuNEqxZSx4cvXFib4AP_l388ApJa8,7086
86
- slidge/group/participant.py,sha256=6atjdHEgbfhPjPAkOVAQFFuCv5b8TO279HPHq-qpqIE,17651
87
- slidge/group/room.py,sha256=KKj1mmASoRH80AfI-IZMOeahdThEEGu77-DFUw0ZsZo,49299
64
+ slidge/group/participant.py,sha256=eMwUgbEtxGjWMmIqUfS8uSKlaStitZ3D68M_RixQeso,17676
65
+ slidge/group/room.py,sha256=meASJZXRVM39SEzoLNjm0NAx6mLLa8dgA21tK828kik,47939
88
66
  slidge/slixfix/__init__.py,sha256=LvaYZQYjr4l_45AYYpod1dB3MUaZye18vKF-4H8Bm20,4758
89
67
  slidge/slixfix/delivery_receipt.py,sha256=JmogxsiXYEbTmCM4fvC5wkQs0jBsaJtKl4j_B_18riE,1415
90
68
  slidge/slixfix/roster.py,sha256=DjjHQqCsKsPChUxV7S0Pm4IAgjfrwgm5tcTdJi3N_gY,1670
@@ -109,9 +87,9 @@ slidge/util/lock.py,sha256=ZnUi3LGiz271-YeYKo9JzxovJCoSwlP9P65pNyHIO9o,1029
109
87
  slidge/util/test.py,sha256=_E6er2BtQlpyzTUmp4u8C9KhBYzbLrmTwSVgxGObKHU,13988
110
88
  slidge/util/types.py,sha256=xJ84ZvaUOU_VVJSjEMysgNSl05k0_O9YKbyW-JUrsMI,5635
111
89
  slidge/util/util.py,sha256=4hihLCl4SsB5S14TT3bP8tDPP_Zg9rYbSfLdLB9-G_Q,9332
112
- slidge-0.3.0a2.dist-info/licenses/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
113
- slidge-0.3.0a2.dist-info/METADATA,sha256=CZbiWq5Y-njBhLaMQb03Io2iLLL6RiRkPLVh4mAEE4E,5056
114
- slidge-0.3.0a2.dist-info/WHEEL,sha256=GHB6lJx2juba1wDgXDNlMTyM13ckjBMKf-OnwgKOCtA,91
115
- slidge-0.3.0a2.dist-info/entry_points.txt,sha256=py3_x834fFJ2TEzPd18Wt2DnysdAfuVqJ5zzBrXbAZs,44
116
- slidge-0.3.0a2.dist-info/top_level.txt,sha256=2LRjDYHaGZ5ieCMF8xy58JIiabRMzX-MGMbCZwfE17c,7
117
- slidge-0.3.0a2.dist-info/RECORD,,
90
+ slidge-0.3.0b1.dist-info/licenses/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
91
+ slidge-0.3.0b1.dist-info/METADATA,sha256=6PmV4nthNFFylMq1FHcXwhSuEgN9mQ9EaeUWuGNNNl4,5056
92
+ slidge-0.3.0b1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
93
+ slidge-0.3.0b1.dist-info/entry_points.txt,sha256=py3_x834fFJ2TEzPd18Wt2DnysdAfuVqJ5zzBrXbAZs,44
94
+ slidge-0.3.0b1.dist-info/top_level.txt,sha256=2LRjDYHaGZ5ieCMF8xy58JIiabRMzX-MGMbCZwfE17c,7
95
+ slidge-0.3.0b1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.3.0)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,183 +0,0 @@
1
- """Unify legacy/XMPP id mappings
2
-
3
- Revision ID: 0337c90c0b96
4
- Revises: 58b98dacf819
5
- Create Date: 2025-04-25 20:22:47.612652
6
-
7
- """
8
-
9
- from typing import Sequence, Union
10
-
11
- import sqlalchemy as sa
12
- from alembic import op
13
-
14
- # revision identifiers, used by Alembic.
15
- revision: str = "0337c90c0b96"
16
- down_revision: Union[str, None] = "58b98dacf819"
17
- branch_labels: Union[str, Sequence[str], None] = None
18
- depends_on: Union[str, Sequence[str], None] = None
19
-
20
-
21
- def upgrade() -> None:
22
- # ### commands auto generated by Alembic - please adjust! ###
23
- op.create_table(
24
- "direct_msg",
25
- sa.Column("foreign_key", sa.Integer(), nullable=False),
26
- sa.Column("id", sa.Integer(), nullable=False),
27
- sa.Column("legacy_id", sa.String(), nullable=False),
28
- sa.Column("xmpp_id", sa.String(), nullable=False),
29
- sa.ForeignKeyConstraint(
30
- ["foreign_key"],
31
- ["contact.id"],
32
- name=op.f("fk_direct_msg_foreign_key_contact"),
33
- ),
34
- sa.PrimaryKeyConstraint("id", name=op.f("pk_direct_msg")),
35
- )
36
- with op.batch_alter_table("direct_msg", schema=None) as batch_op:
37
- batch_op.create_index(
38
- "ix_direct_msg_legacy_id", ["legacy_id", "foreign_key"], unique=False
39
- )
40
-
41
- op.create_table(
42
- "direct_thread",
43
- sa.Column("foreign_key", sa.Integer(), nullable=False),
44
- sa.Column("id", sa.Integer(), nullable=False),
45
- sa.Column("legacy_id", sa.String(), nullable=False),
46
- sa.Column("xmpp_id", sa.String(), nullable=False),
47
- sa.ForeignKeyConstraint(
48
- ["foreign_key"],
49
- ["contact.id"],
50
- name=op.f("fk_direct_thread_foreign_key_contact"),
51
- ),
52
- sa.PrimaryKeyConstraint("id", name=op.f("pk_direct_thread")),
53
- )
54
- with op.batch_alter_table("direct_thread", schema=None) as batch_op:
55
- batch_op.create_index(
56
- "ix_direct_direct_thread_id", ["legacy_id", "foreign_key"], unique=False
57
- )
58
-
59
- op.create_table(
60
- "group_msg",
61
- sa.Column("foreign_key", sa.Integer(), nullable=False),
62
- sa.Column("id", sa.Integer(), nullable=False),
63
- sa.Column("legacy_id", sa.String(), nullable=False),
64
- sa.Column("xmpp_id", sa.String(), nullable=False),
65
- sa.ForeignKeyConstraint(
66
- ["foreign_key"], ["room.id"], name=op.f("fk_group_msg_foreign_key_room")
67
- ),
68
- sa.PrimaryKeyConstraint("id", name=op.f("pk_group_msg")),
69
- )
70
- with op.batch_alter_table("group_msg", schema=None) as batch_op:
71
- batch_op.create_index(
72
- "ix_group_msg_legacy_id", ["legacy_id", "foreign_key"], unique=False
73
- )
74
-
75
- op.create_table(
76
- "group_thread",
77
- sa.Column("foreign_key", sa.Integer(), nullable=False),
78
- sa.Column("id", sa.Integer(), nullable=False),
79
- sa.Column("legacy_id", sa.String(), nullable=False),
80
- sa.Column("xmpp_id", sa.String(), nullable=False),
81
- sa.ForeignKeyConstraint(
82
- ["foreign_key"], ["room.id"], name=op.f("fk_group_thread_foreign_key_room")
83
- ),
84
- sa.PrimaryKeyConstraint("id", name=op.f("pk_group_thread")),
85
- )
86
- with op.batch_alter_table("group_thread", schema=None) as batch_op:
87
- batch_op.create_index(
88
- "ix_direct_group_thread_id", ["legacy_id", "foreign_key"], unique=False
89
- )
90
-
91
- with op.batch_alter_table("xmpp_ids_multi", schema=None) as batch_op:
92
- batch_op.drop_index("legacy_ids_multi_user_account_id_xmpp_id")
93
-
94
- op.drop_table("xmpp_ids_multi")
95
- with op.batch_alter_table("xmpp_to_legacy_ids", schema=None) as batch_op:
96
- batch_op.drop_index("xmpp_legacy")
97
-
98
- op.drop_table("xmpp_to_legacy_ids")
99
- with op.batch_alter_table("legacy_ids_multi", schema=None) as batch_op:
100
- batch_op.drop_index("legacy_ids_multi_user_account_id_legacy_id")
101
-
102
- op.drop_table("legacy_ids_multi")
103
- # ### end Alembic commands ###
104
-
105
-
106
- def downgrade() -> None:
107
- # ### commands auto generated by Alembic - please adjust! ###
108
- op.create_table(
109
- "legacy_ids_multi",
110
- sa.Column("id", sa.INTEGER(), nullable=False),
111
- sa.Column("user_account_id", sa.INTEGER(), nullable=False),
112
- sa.Column("legacy_id", sa.VARCHAR(), nullable=False),
113
- sa.ForeignKeyConstraint(
114
- ["user_account_id"],
115
- ["user_account.id"],
116
- ),
117
- sa.PrimaryKeyConstraint("id"),
118
- )
119
- with op.batch_alter_table("legacy_ids_multi", schema=None) as batch_op:
120
- batch_op.create_index(
121
- "legacy_ids_multi_user_account_id_legacy_id",
122
- ["user_account_id", "legacy_id"],
123
- unique=1,
124
- )
125
-
126
- op.create_table(
127
- "xmpp_to_legacy_ids",
128
- sa.Column("id", sa.INTEGER(), nullable=False),
129
- sa.Column("user_account_id", sa.INTEGER(), nullable=False),
130
- sa.Column("xmpp_id", sa.VARCHAR(), nullable=False),
131
- sa.Column("legacy_id", sa.VARCHAR(), nullable=False),
132
- sa.Column("type", sa.VARCHAR(length=10), nullable=False),
133
- sa.ForeignKeyConstraint(
134
- ["user_account_id"],
135
- ["user_account.id"],
136
- ),
137
- sa.PrimaryKeyConstraint("id"),
138
- )
139
- with op.batch_alter_table("xmpp_to_legacy_ids", schema=None) as batch_op:
140
- batch_op.create_index(
141
- "xmpp_legacy", ["user_account_id", "xmpp_id", "legacy_id"], unique=1
142
- )
143
-
144
- op.create_table(
145
- "xmpp_ids_multi",
146
- sa.Column("id", sa.INTEGER(), nullable=False),
147
- sa.Column("user_account_id", sa.INTEGER(), nullable=False),
148
- sa.Column("xmpp_id", sa.VARCHAR(), nullable=False),
149
- sa.Column("legacy_ids_multi_id", sa.INTEGER(), nullable=False),
150
- sa.ForeignKeyConstraint(
151
- ["legacy_ids_multi_id"],
152
- ["legacy_ids_multi.id"],
153
- ),
154
- sa.ForeignKeyConstraint(
155
- ["user_account_id"],
156
- ["user_account.id"],
157
- ),
158
- sa.PrimaryKeyConstraint("id"),
159
- )
160
- with op.batch_alter_table("xmpp_ids_multi", schema=None) as batch_op:
161
- batch_op.create_index(
162
- "legacy_ids_multi_user_account_id_xmpp_id",
163
- ["user_account_id", "xmpp_id"],
164
- unique=1,
165
- )
166
-
167
- with op.batch_alter_table("group_thread", schema=None) as batch_op:
168
- batch_op.drop_index("ix_direct_group_thread_id")
169
-
170
- op.drop_table("group_thread")
171
- with op.batch_alter_table("group_msg", schema=None) as batch_op:
172
- batch_op.drop_index("ix_group_msg_legacy_id")
173
-
174
- op.drop_table("group_msg")
175
- with op.batch_alter_table("direct_thread", schema=None) as batch_op:
176
- batch_op.drop_index("ix_direct_direct_thread_id")
177
-
178
- op.drop_table("direct_thread")
179
- with op.batch_alter_table("direct_msg", schema=None) as batch_op:
180
- batch_op.drop_index("ix_direct_msg_legacy_id")
181
-
182
- op.drop_table("direct_msg")
183
- # ### end Alembic commands ###
@@ -1,33 +0,0 @@
1
- """Add Participant.nickname_no_illegal
2
-
3
- Revision ID: 04cf35e3cf85
4
- Revises: 15b0bd83407a
5
- Create Date: 2025-02-22 06:57:45.491326
6
-
7
- """
8
-
9
- from typing import Sequence, Union
10
-
11
- import sqlalchemy as sa
12
- from alembic import op
13
-
14
- # revision identifiers, used by Alembic.
15
- revision: str = "04cf35e3cf85"
16
- down_revision: Union[str, None] = "15b0bd83407a"
17
- branch_labels: Union[str, Sequence[str], None] = None
18
- depends_on: Union[str, Sequence[str], None] = None
19
-
20
-
21
- def upgrade() -> None:
22
- # ### commands auto generated by Alembic - please adjust! ###
23
- with op.batch_alter_table("participant", schema=None) as batch_op:
24
- batch_op.add_column(
25
- sa.Column("nickname_no_illegal", sa.String(), nullable=True)
26
- )
27
-
28
- # ### end Alembic commands ###
29
-
30
-
31
- def downgrade() -> None:
32
- with op.batch_alter_table("participant", schema=None) as batch_op:
33
- batch_op.drop_column("nickname_no_illegal")
@@ -1,36 +0,0 @@
1
- """Add n_participants attributes to Room
2
-
3
- Should have been part of another commit, but I messed up some rebase
4
-
5
- Revision ID: 09f27f098baa
6
- Revises: 29f5280c61aa
7
- Create Date: 2024-07-11 10:54:21.155871
8
-
9
- """
10
-
11
- from typing import Sequence, Union
12
-
13
- import sqlalchemy as sa
14
- from alembic import op
15
-
16
- # revision identifiers, used by Alembic.
17
- revision: str = "09f27f098baa"
18
- down_revision: Union[str, None] = "29f5280c61aa"
19
- branch_labels: Union[str, Sequence[str], None] = None
20
- depends_on: Union[str, Sequence[str], None] = None
21
-
22
-
23
- def upgrade() -> None:
24
- # ### commands auto generated by Alembic - please adjust! ###
25
- with op.batch_alter_table("room", schema=None) as batch_op:
26
- batch_op.add_column(sa.Column("n_participants", sa.Integer(), nullable=True))
27
-
28
- # ### end Alembic commands ###
29
-
30
-
31
- def downgrade() -> None:
32
- # ### commands auto generated by Alembic - please adjust! ###
33
- with op.batch_alter_table("room", schema=None) as batch_op:
34
- batch_op.drop_column("n_participants")
35
-
36
- # ### end Alembic commands ###
@@ -1,85 +0,0 @@
1
- """Remove bogus unique constraints on room table
2
-
3
- Revision ID: 15b0bd83407a
4
- Revises: 45c24cc73c91
5
- Create Date: 2024-08-28 06:57:25.022994
6
-
7
- """
8
-
9
- from typing import Sequence, Union
10
-
11
- import sqlalchemy as sa
12
- from alembic import op
13
-
14
- import slidge.db.meta
15
-
16
- # revision identifiers, used by Alembic.
17
- revision: str = "15b0bd83407a"
18
- down_revision: Union[str, None] = "45c24cc73c91"
19
- branch_labels: Union[str, Sequence[str], None] = None
20
- depends_on: Union[str, Sequence[str], None] = None
21
-
22
- meta = sa.MetaData()
23
- room_table = sa.Table(
24
- "room",
25
- meta,
26
- sa.Column("id", sa.Integer(), nullable=False),
27
- sa.Column("user_account_id", sa.Integer(), nullable=False),
28
- sa.Column("legacy_id", sa.String(), nullable=False),
29
- sa.Column("jid", slidge.db.meta.JIDType(), nullable=False),
30
- sa.Column("avatar_id", sa.Integer(), nullable=True),
31
- sa.Column("name", sa.String(), nullable=True),
32
- sa.Column("description", sa.String(), nullable=True),
33
- sa.Column("subject", sa.String(), nullable=True),
34
- sa.Column("subject_date", sa.DateTime(), nullable=True),
35
- sa.Column("subject_setter", sa.String(), nullable=True),
36
- sa.Column("n_participants", sa.Integer(), nullable=True),
37
- sa.Column(
38
- "muc_type",
39
- sa.Enum("GROUP", "CHANNEL", "CHANNEL_NON_ANONYMOUS", name="muctype"),
40
- nullable=True,
41
- ),
42
- sa.Column("user_nick", sa.String(), nullable=True),
43
- sa.Column("user_resources", sa.String(), nullable=True),
44
- sa.Column("participants_filled", sa.Boolean(), nullable=False),
45
- sa.Column("history_filled", sa.Boolean(), nullable=False),
46
- sa.Column("extra_attributes", slidge.db.meta.JSONEncodedDict(), nullable=True),
47
- sa.Column("updated", sa.Boolean(), nullable=False),
48
- sa.Column("avatar_legacy_id", sa.String(), nullable=True),
49
- sa.ForeignKeyConstraint(
50
- ["avatar_id"],
51
- ["avatar.id"],
52
- ),
53
- sa.ForeignKeyConstraint(
54
- ["user_account_id"],
55
- ["user_account.id"],
56
- ),
57
- sa.PrimaryKeyConstraint("id"),
58
- )
59
-
60
-
61
- def upgrade() -> None:
62
- if op.get_bind().engine.name == "postgresql":
63
- return
64
- with op.batch_alter_table(
65
- "room",
66
- schema=None,
67
- # without copy_from, the newly created table keeps the constraints
68
- # we actually want to ditch.
69
- copy_from=room_table,
70
- ) as batch_op:
71
- batch_op.create_unique_constraint(
72
- "uq_room_user_account_id_jid", ["user_account_id", "jid"]
73
- )
74
- batch_op.create_unique_constraint(
75
- "uq_room_user_account_id_legacy_id", ["user_account_id", "legacy_id"]
76
- )
77
-
78
-
79
- def downgrade() -> None:
80
- # ### commands auto generated by Alembic - please adjust! ###
81
- with op.batch_alter_table("room", schema=None) as batch_op:
82
- batch_op.drop_constraint("uq_room_user_account_id_legacy_id", type_="unique")
83
- batch_op.drop_constraint("uq_room_user_account_id_jid", type_="unique")
84
-
85
- # ### end Alembic commands ###
@@ -1,36 +0,0 @@
1
- """Store contacts caps verstring in DB
2
-
3
- Revision ID: 2461390c0af2
4
- Revises: 2b1f45ab7379
5
- Create Date: 2024-07-20 08:00:11.675735
6
-
7
- """
8
-
9
- from typing import Sequence, Union
10
-
11
- import sqlalchemy as sa
12
- from alembic import op
13
-
14
- # revision identifiers, used by Alembic.
15
- revision: str = "2461390c0af2"
16
- down_revision: Union[str, None] = "2b1f45ab7379"
17
- branch_labels: Union[str, Sequence[str], None] = None
18
- depends_on: Union[str, Sequence[str], None] = None
19
-
20
-
21
- def upgrade() -> None:
22
- # ### commands auto generated by Alembic - please adjust! ###
23
- with op.batch_alter_table("contact", schema=None) as batch_op:
24
- batch_op.add_column(sa.Column("caps_ver_bare", sa.String(), nullable=True))
25
- batch_op.add_column(sa.Column("caps_ver", sa.String(), nullable=True))
26
-
27
- # ### end Alembic commands ###
28
-
29
-
30
- def downgrade() -> None:
31
- # ### commands auto generated by Alembic - please adjust! ###
32
- with op.batch_alter_table("contact", schema=None) as batch_op:
33
- batch_op.drop_column("caps_ver")
34
- batch_op.drop_column("caps_ver_bare")
35
-
36
- # ### end Alembic commands ###