add x selections

This commit is contained in:
Tim Bendt
2025-07-02 23:13:15 -04:00
parent 0bbb9e6cd4
commit c8f9a22401
4 changed files with 244 additions and 36 deletions

View File

@@ -140,6 +140,37 @@ async def archive_message(message_id: int) -> bool:
return False
async def archive_messages(message_ids: List[str]) -> Tuple[Optional[str], bool]:
"""
Archive multiple messages by their IDs.
Args:
message_ids: A list of message IDs to archive.
Returns:
A tuple containing an optional output string and a boolean indicating success.
"""
try:
ids_str = " ".join(message_ids)
cmd = f"himalaya message move Archives {ids_str}"
process = await asyncio.create_subprocess_shell(
cmd,
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE,
)
stdout, stderr = await process.communicate()
if process.returncode == 0:
return stdout.decode(), True
else:
logging.error(f"Error archiving messages: {stderr.decode()}")
return None, False
except Exception as e:
logging.error(f"Exception during message archiving: {e}")
return None, False
async def get_message_content(message_id: int) -> Tuple[Optional[str], bool]:
"""
Retrieve the content of a message by its ID.