Introducing a new way to review your PRs.

Read the announcement

crmne / zapfast

ZapFast: a fast, native WhatsApp client in Rust and egui

View on GitHub

19 documents · Updated Nov 18, 2026

docs / chat-archive-and-export

Chat archive and export

Chat archive and export serve two different needs. Archiving removes a conversation from the main chat list while keeping it available. Export copies the locally saved part of one conversation to a file that the user chooses.

This page belongs to Messaging and conversations. For nearby message flows, see Chat interaction and composition, Groups, contacts, and blocking, and Interactive messages and polls.

Chat archiving

Chat archiving is a phone-synced state. ZapFast changes the state only after WhatsApp accepts the request, then stores the confirmed result in the local chat archive so later history cannot undo a newer choice. src/…/archive_chats.rs• L17-97

The user can archive or unarchive the open chat from its More menu. The same action is available from the chat list menu, the chat information panel, and the Ctrl+E shortcut on supported keyboards. The label changes with the current state. src/…/conversation.rs• L679-797, src/…/chats.rs• L2168-2175, src/…/info.rs• L846-880, src/…/keys.rs• L1004-1017

The Archived destination in the left rail opens the archive in the chat-list column. The main list and the archive list use the same chat records but apply opposite archive-state filters. Search remains a separate view and can still find chats outside the current archive view. src/…/rail.rs• L73-141, src/app.rs• L3399-3429

References: src/…/archive_chats.rs• L17-97 src/…/conversation.rs• L679-797 src/…/chats.rs• L2168-2175 src/…/info.rs• L846-880 src/…/keys.rs• L1004-1017 src/…/rail.rs• L73-141 src/app.rs• L3399-3429

Archive state and message arrival

The Keep chats archived setting controls whether a new message moves an archived chat back to the main list. When this setting is on, the chat stays archived. When it is off, a newer message can unarchive it. Older messages do not reverse a later archive action. src/…/settings.rs• L442-480, src/archive.rs• L692-712

The archive request follows a short confirmation flow:

sequenceDiagram
    participant User
    participant UI as Chat UI
    participant Worker as Account worker
    participant Phone as WhatsApp phone
    participant Store as Local archive

    User->>UI: Choose Archive or Unarchive
    UI->>Worker: Send state change
    Worker->>Phone: Request archive state
    Phone-->>Worker: Confirm or reject
    alt Confirmed
        Worker->>Store: Save confirmed state
        Worker-->>UI: Refresh chat list
    else Rejected or unavailable
        Worker-->>UI: Show failure
    end

Archiving needs a connection because the phone is the authority for the change. Offline requests, unreadable chat data, failed phone confirmation, and local write failures stay visible as errors instead of silently changing the list. src/…/archive_chats.rs• L26-96, src/app.rs• L4990-5018

References: src/…/settings.rs• L442-480 src/archive.rs• L692-712 src/…/archive_chats.rs• L26-96 src/app.rs• L4990-5018

Chat export entry point

Chat export starts from the open conversation's More menu. The menu disables the entry for locked chats and while another export is active. The export dialog then lets the user save plain text or include downloaded attachments in a ZIP file. src/…/conversation.rs• L684-797

The dialog states the export boundary before the user saves it: the export includes only messages stored on this computer. It does not fetch missing history or attachments. Exported files are not encrypted, and locked chats cannot be exported. src/…/chat_export.rs• L7-24

References: src/…/conversation.rs• L684-797 src/…/chat_export.rs• L7-24

Exported conversation data

The export turns the selected chat into a readable transcript. A text export contains the saved messages in chat order with UTC times, sender names, message summaries, and notes for attachments that are omitted or unavailable. A ZIP export adds the downloaded attachment files and includes the transcript as _chat.txt. src/…/chat_export.rs• L34-63, src/…/chat_export.rs• L106-182

The export is a snapshot of the messages known when the job starts. New messages that arrive after that point are not added to the same file. Missing attachment slots remain visible in the transcript so the user can distinguish unavailable files from attachments that were not requested. src/…/chat_export.rs• L64-85, src/…/chat_export.rs• L125-157

References: src/…/chat_export.rs• L34-63 src/…/chat_export.rs• L106-182

Background export processing

Export runs outside the interface and account worker so large chats and file copies do not block normal messaging. The worker first checks account privacy state and chat access, opens a read-only view of the encrypted archive, and then asks the user for a destination. It reports message, attachment, and unavailable-file counts while the job runs. src/…/chat_export.rs• L28-119, src/…/chat_export.rs• L23-41, src/…/chat_export.rs• L42-55

The save path must be outside the application's data folders. The export writes temporary files in the chosen folder and publishes the final file only after the transcript and requested attachments are complete. This keeps a cancelled or failed job from replacing an existing export with partial data. src/…/chat_export.rs• L164-200, src/…/chat_export.rs• L164-182

The user can cancel from the dialog or close it while work is active. Cancellation reaches the background task, removes temporary output, preserves an existing destination, and returns the interface to an idle state. Progress and completion events are tied to the active request so an old job cannot update a newer export. src/…/chat_export.rs• L20-65, src/…/chat_export.rs• L203-229, src/app.rs• L4143-4173, src/app.rs• L9146-9151

References: src/…/chat_export.rs• L28-119 src/…/chat_export.rs• L23-41 src/…/chat_export.rs• L164-200 src/…/chat_export.rs• L164-182 src/…/chat_export.rs• L20-65 src/…/chat_export.rs• L203-229 src/app.rs• L4143-4173 src/app.rs• L9146-9151

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the archive state contract aligned across the phone request, confirmation event, timestamped local state, and chat-list filters.
  • Keep the Keep chats archived setting aligned with the message-arrival rule and the phone's matching setting.
  • Keep export eligibility aligned across the chat menu, dialog, account privacy state, and locked-chat state.
  • Keep export progress counts and completion results aligned between the background worker and the dialog status and toast messages.
  • Keep cancellation and request identity checks in place so stale picker, progress, or completion events cannot affect a later export.
  • Keep the text and ZIP output boundary aligned with the promise that exports use only locally saved data and downloaded attachments.

Important failure modes

TriggerConsequenceGuard
Archive or unarchive is requested while offlineThe chat state does not change and the user sees a connection errorThe worker rejects the request before sending it to the phone
WhatsApp rejects or fails to confirm the archive changeThe previous local state remains in forceThe worker saves the new state only after confirmation
Export targets a locked chat or the account is not ready for exportNo picker or export output is producedUI and worker checks both enforce export access
History or an attachment is not stored locallyThe export is incomplete for that itemThe transcript states that history was not downloaded and counts unavailable files
Export is cancelled or fails during file workPartial output is not published and an existing destination stays unchangedTemporary files and final-file publication are separated
A stale export event arrives after a new request startsThe new export could show wrong progress or finish earlyRequest IDs limit progress and completion events to the active job

Key files

FileWhy to read it
src/…/conversation.rsShows the open-chat menu entry points for archive and export.
src/…/chats.rsShows chat-list archive actions and the archived-list empty state.
src/…/rail.rsShows how the Archived destination opens and closes.
src/…/chat_export.rsShows the export dialog, local-data warning, options, and progress counts.
src/…/archive_chats.rsShows the phone-confirmed archive workflow and its failure results.
src/…/chat_export.rsShows background export ownership, cancellation, destination selection, and progress.
src/…/chat_export.rsShows the transcript and ZIP output boundary and safe final-file publication.
src/archive.rsShows the durable archive state and the rule for message-driven unarchiving.