Added image and file attachment sending

This commit is contained in:
Mark Qvist 2024-03-16 22:59:19 +01:00
parent 8f8c1ec68f
commit 7f891d68e0
2 changed files with 269 additions and 48 deletions

View file

@ -3244,7 +3244,7 @@ class SidebandCore():
RNS.log("Error while creating paper message: "+str(e), RNS.LOG_ERROR)
return False
def send_message(self, content, destination_hash, propagation, skip_fields=False, no_display=False):
def send_message(self, content, destination_hash, propagation, skip_fields=False, no_display=False, attachment = None, image = None, audio = None):
try:
if content == "":
raise ValueError("Message content cannot be empty")
@ -3263,6 +3263,11 @@ class SidebandCore():
else:
fields = self.get_message_fields(destination_hash)
if attachment != None:
fields[LXMF.FIELD_FILE_ATTACHMENTS] = [attachment]
if image != None:
fields[LXMF.FIELD_IMAGE] = image
lxm = LXMF.LXMessage(dest, source, content, title="", desired_method=desired_method, fields = fields)
if not no_display: