mirror of
https://github.com/markqvist/Sideband.git
synced 2025-12-15 08:38:47 -05:00
Added option to block non-trusted callers
This commit is contained in:
parent
4d9bba3e4c
commit
dd12a76bf9
3 changed files with 77 additions and 11 deletions
|
|
@ -853,6 +853,8 @@ class SidebandCore():
|
|||
self.config["voice_input"] = None
|
||||
if not "voice_ringer" in self.config:
|
||||
self.config["voice_ringer"] = None
|
||||
if not "voice_trusted_only" in self.config:
|
||||
self.config["voice_trusted_only"] = False
|
||||
|
||||
# Make sure we have a database
|
||||
if not os.path.isfile(self.db_path):
|
||||
|
|
@ -1074,6 +1076,20 @@ class SidebandCore():
|
|||
RNS.log("Error while checking trust for "+RNS.prettyhexrep(context_dest)+": "+str(e), RNS.LOG_ERROR)
|
||||
return False
|
||||
|
||||
def voice_is_trusted(self, identity_hash):
|
||||
context_dest = identity_hash
|
||||
try:
|
||||
lxmf_destination_hash = RNS.Destination.hash_from_name_and_identity("lxmf.delivery", identity_hash)
|
||||
existing_voice = self._db_conversation(context_dest)
|
||||
existing_lxmf = self._db_conversation(lxmf_destination_hash)
|
||||
if existing_lxmf: trust = existing_lxmf["trust"]
|
||||
else: trust = existing_voice["trust"]
|
||||
return trust == 1
|
||||
|
||||
except Exception as e:
|
||||
RNS.log("Could not decode a valid peer name from data: "+str(e), RNS.LOG_DEBUG)
|
||||
return False
|
||||
|
||||
def is_object(self, context_dest, conv_data = None):
|
||||
try:
|
||||
if conv_data == None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue