slidge-whatsapp 0.2.0a0__cp311-cp311-manylinux_2_36_x86_64.whl → 0.2.1__cp311-cp311-manylinux_2_36_x86_64.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.

Potentially problematic release.


This version of slidge-whatsapp might be problematic. Click here for more details.

@@ -2,10 +2,16 @@
2
2
  WhatsApp gateway using the multi-device API.
3
3
  """
4
4
 
5
+ from slidge import entrypoint
5
6
  from slidge.util.util import get_version # noqa: F401
6
7
 
7
8
  from . import command, config, contact, group, session
8
9
  from .gateway import Gateway
9
10
 
10
- __version__ = "0.2.0alpha0"
11
- __all__ = "Gateway", "session", "command", "contact", "config", "group"
11
+
12
+ def main():
13
+ entrypoint("slidge_whatsapp")
14
+
15
+
16
+ __version__ = "0.2.1"
17
+ __all__ = "Gateway", "session", "command", "contact", "config", "group", "main"
@@ -1,9 +1,3 @@
1
- from slidge import entrypoint
1
+ from slidge_whatsapp import main
2
2
 
3
-
4
- def main():
5
- entrypoint("slidge_whatsapp")
6
-
7
-
8
- if __name__ == "__main__":
9
- main()
3
+ main()
slidge_whatsapp/config.py CHANGED
@@ -26,12 +26,6 @@ ALWAYS_SYNC_ROSTER__DOC = (
26
26
  "Whether or not to perform a full sync of the WhatsApp roster on startup."
27
27
  )
28
28
 
29
- SKIP_VERIFY_TLS = False
30
- SKIP_VERIFY_TLS__DOC = (
31
- "Whether or not HTTPS connections made by this plugin should verify TLS"
32
- " certificates."
33
- )
34
-
35
29
  ENABLE_LINK_PREVIEWS = True
36
30
  ENABLE_LINK_PREVIEWS__DOC = (
37
31
  "Whether or not previews for links (URLs) should be generated on outgoing messages"
@@ -47,16 +47,18 @@ class Roster(LegacyRoster[str, Contact]):
47
47
  """
48
48
  Adds a WhatsApp contact to local roster, filling all required and optional information.
49
49
  """
50
+ # Don't attempt to add ourselves to the roster.
50
51
  if data.JID == self.user_legacy_id:
51
- # with the current implementation, we don't allow that
52
52
  return None
53
53
  contact = await self.by_legacy_id(data.JID)
54
54
  contact.name = data.Name
55
55
  contact.is_friend = True
56
56
  try:
57
57
  avatar = self.session.whatsapp.GetAvatar(data.JID, contact.avatar or "")
58
- if avatar.URL:
58
+ if avatar.URL and contact.avatar != avatar.ID:
59
59
  await contact.set_avatar(avatar.URL, avatar.ID)
60
+ elif avatar.URL == "":
61
+ await contact.set_avatar(None)
60
62
  except RuntimeError as err:
61
63
  self.session.log.error(
62
64
  "Failed getting avatar for contact %s: %s", data.JID, err