diff --git a/pyproject.toml b/pyproject.toml index a19de44..99f294b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta" [project] name = "SignalCliAPi" -version = "0.5.10.5" +version = "0.5.10.6" authors = [ { name="Peter Nearing", email="me@peternearing.ca" } ] diff --git a/setup.cfg b/setup.cfg index f7484f5..f0e93ea 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = SignalCliApi -version = 0.5.10.5 +version = 0.5.10.6 author = Peter Nearing author_email = me@peternearing.ca description = A python interface to the signal-cli found at https://github.com/AsamK/signal-cli diff --git a/src/signal_cli_api/__init__.py b/src/signal_cli_api/__init__.py index 55a978f..3d7cfe8 100644 --- a/src/signal_cli_api/__init__.py +++ b/src/signal_cli_api/__init__.py @@ -2,7 +2,7 @@ File: __init__.py Description: A python3 interface to signal-cli. """ -__version__: str = '0.5.10.5' +__version__: str = '0.5.10.6' __author__: str = 'Peter Nearing' __email__: str = 'me@peternearing.ca' diff --git a/src/signal_cli_api/signal_contact.py b/src/signal_cli_api/signal_contact.py index c41847d..6b9c03e 100644 --- a/src/signal_cli_api/signal_contact.py +++ b/src/signal_cli_api/signal_contact.py @@ -223,9 +223,9 @@ def __eq__(self, other: Self) -> bool: if self.uuid == other.uuid or self.number == other.number: self.__update__(other) return True - # if super().__eq__(other): - # self.__update__(other) - # return True + if super().__eq__(other): + self.__update__(other) + return True return False def __str__(self) -> str: diff --git a/src/signal_cli_api/signal_contacts.py b/src/signal_cli_api/signal_contacts.py index 4317891..6dc7b79 100644 --- a/src/signal_cli_api/signal_contacts.py +++ b/src/signal_cli_api/signal_contacts.py @@ -123,9 +123,20 @@ def __init__(self, else: logger.debug("self-contact found, ensuring name is '%s'", SELF_CONTACT_NAME) self_contact.set_name(SELF_CONTACT_NAME) + # Merge duplicate contacts: + self.__drop_duplicates__() self.__save__() logger.info("Initialization complete.") + def __drop_duplicates__(self): + orig_contacts = self._contacts.copy() + for orig_contact in orig_contacts: + for contact in orig_contacts: + if contact == orig_contact: + self._contacts.remove(contact) + + + ########################## # Overrides: ##########################