Refactor chat condition

This commit is contained in:
KnugiHK
2024-02-13 15:33:58 +08:00
parent dedfce8feb
commit 99a3a4bcd0
4 changed files with 53 additions and 40 deletions

View File

@@ -156,6 +156,16 @@ def get_file_name(contact: str, chat: ChatStore):
return "".join(x for x in file_name if x.isalnum() or x in "- "), name
def get_chat_condition(filter, include, column):
if filter is not None:
if include:
return f'''AND ({' OR '.join(f"{column} LIKE '%{chat}%'" for chat in filter)})'''
else:
return f'''AND ({' AND '.join(f"{column} NOT LIKE '%{chat}%'" for chat in filter)})'''
else:
return ""
# Android Specific
CRYPT14_OFFSETS = (
{"iv": 67, "db": 191},